lmaccherone/node-localstorage

Compile node-localstorage with webpack

carloscuatin opened this issue · 2 comments

ismorphic application use, have error

iterm

I have recently started using webpack and I have found that several of my projects do not play nice with webpack. I'm upgrading them as I have need but node-localstorage is not a candidate. node-localstorage is intended to be run in node.js and it both reads from and writes to the file system. Webpack is primarily targeted at the browser, although I understand it's possible to use it for node.js. So, if you are targeting node.js, you can use the webpack externals config option as described here: http://jlongster.com/Backend-Apps-with-Webpack--Part-I. If, on the other hand, you are targeting the browser, then you should use the browser native localStorage. By isomorphic I assume that the code could run on either the browser or server sensing where it is at runtime. Here's a hack you can use to make it so that browser targeted packages don't even get the code the server-only code: http://stackoverflow.com/questions/31724950/with-webpack-can-i-put-node-js-and-browser-code-in-the-same-file-but-prevent-t

oh yea, problem in importation thanks !