Hi!
We're using node-localstorage in Next.js apps and noticed that node-localstorage ends up in our browser bundle. We've been able to remove it by doing some webpack tomfoolery and wanted to check if this instead can be fixed in the package?
Another thing would be to have a browser field in package.json that points to a file that basically just does this:
module.exports = window.localStorage;
webpack and other bundlers would then prefer that file when the build target is for the browser, and you wouldn't end up with the real node-localstorage in the browser bundles.
I would have contributed with a PR but my coffeescript skills are less than ideal.
Hi! We're using node-localstorage in Next.js apps and noticed that node-localstorage ends up in our browser bundle. We've been able to remove it by doing some webpack tomfoolery and wanted to check if this instead can be fixed in the package?
One thing is having
"sideEffects": false
in package.json: https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-freeAnother thing would be to have a
browser
field in package.json that points to a file that basically just does this:webpack and other bundlers would then prefer that file when the build target is for the browser, and you wouldn't end up with the real node-localstorage in the browser bundles.
I would have contributed with a PR but my coffeescript skills are less than ideal.