raineorshine / memrise-export

Export all words from a Memrise course to a CSV file
7 stars 3 forks source link

Manual install: Uncaught ReferenceError: require is not defined const cheerio = require('cheerio') #5

Closed MagTun closed 3 years ago

MagTun commented 3 years ago

Hi,

I would like to add a feature (export difficult words) to this extension so I tried to manually install it. But I can't make it run as there is an error with cheerio:

image

I don't know how to include Cheerio in the local extension as I could find a link to the script on the cheerio repo.

So my question is actually quite simple: how can I install this extension locally?

Thanks for you help and also thanks a lot for this extension!

raineorshine commented 3 years ago

Hi! Thanks for reaching out!

It looks like the instructions for manual installation were not updated since the move to CommonJS modules such as cheerio, which utilize require. require is built-in to NodeJS but is not supported by default in the browser. I use browserify to make them work in the browser. You'll have to run the same build process to get it to work from source. I have the build script defined in the package file so it should be as simple as running two additional commands, npm install and npm run build in the repo directory.

Check out the README for the full, updated instructions and let me know if you have any difficulties!

MagTun commented 3 years ago

Thanks a lot for your quick reply and the updated instructions!

I was able to add the "difficult words" feature, and if you are interested to add it to your extension, I created a pull request for it.

An again, thanks for having created this extension, it really helps me in my learning journey!

raineorshine commented 3 years ago

Cool, I'll check it out!