Lurker News

Comments (87) 23 threads

Show all comments

Showing thread 13 of 23

boffinism3 replies#
Question: For codebases that are all about package managers Yarn, what's best practice for integrating something like this? Just push it into a 'vendor' folder?
paultannenbaum#
You would have to dive into how the library was implemented and see if it is compatible as a node module. There is an issue right here in the repo you can follow: https://github.com/frappe/charts/issues/6
TheAceOfHearts#
It depends on how the library is implemented, so you're expected to look at the source.

If you're using something like Webpack and the library just places everything on the global scope, you can configure exports-loader [0]. That way you can reference the module as if it were written with CJS or ESM, without having to change the source.
If it's not published on npm, you can reference the git repo along with the specific release tag you want to use. My suggestion would be to fork the repo and point to your fork in package.json, so things continue to work if the original repo ever gets taken down.
[0] https://webpack.js.org/loaders/exports-loader/