3 ms·
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 ever
by TheAceOfHearts 9y ago
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/ https://webpack.js.org/loaders/exports-loader/