datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
80 stars 12 forks source link

figure out how to import node_modules libraries into vanilla javascript #282

Closed smcalilly closed 1 year ago

smcalilly commented 1 year ago

We can do this in React, but it doesn't currently work when you try to use npm dependencies in vanilla javascript files. My current workaround is to source the dependencies from a cdn via the script tag within the html. But this breaks eslint — the linter treats that dependency as undefined if you use it in a javascript file. Here's an example where eslint fails because of this: https://github.com/datamade/il-nwss-dashboard/runs/7433410692?check_suite_focus=true. You can work that by adding /*global Plot */ to the top of the failing file, which I'd rather not do because that can get messy and out of hand.

smcalilly commented 1 year ago

closing as this will be irrelevant once we incorporate webpack.