How can I include Papaparse so I can use it in Web Extension Javascript code?
I know this might be obvious to any experienced JavaScript programmer, but I am not very experienced with JavaScript. Other programming languages, yes, but not JavaScript.
I have been working on a Web Extension. It gets bundled into an xpi file to be installed into my browser. And now I want to add the ability to parse CSV input.
I just cannot figure out how to make it so I can use papaparse.min.js in my JavaScript. The Readme on GitHub makes it look so easy:
import Papa from 'papaparse';
Papa.parse(file, config);
But I think that requires an npm setup that my code cannot rely on, no? My code is not using node.js at all.
I have downloaded papaparse.min.js directly into my project directories. And I have tried using an import like my code is using for several other modules that it requires:
import { Papa } from '../modules/papaparse.min.js';
And of course I get an error message like this:
Uncaught SyntaxError: The requested module '<project directory>/modules/papaparse.min.js' doesn't provide an export named: 'Papa'
With all the other imports my code needs -- mostly from npm modules I have installed and whose source files I have then copied into my project directory -- I have been able to find the exports my code needs in order to use the modules, but not with Papaparse. I can't see any export statements in the code.
I have tried installing the entire npm module. I copied all its files into my project, then I have tried these as well:
import * as Papa from '../modules/papaparse/papaparse.min.js';
import * as Papa from '../modules/papaparse/papaparse.js';
papaparse.min.js gives: Uncaught TypeError: e is undefined
papaparse.js gives: Uncaught TypeError: root is undefined
I am stuck.
Thank you for any help you might give me.