You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@najamkhn, just in case, are you trying to build a web-client app (= to be running in the browser) using LokiJS with the webpack / babel toolchain (or alike)?
@najamkhn Okay, that's what I suspected, based on the specific issue that you reported. But I needed to double-check my guess with you first. What you need to do is, to add the following configuration section and parameters into your webpack.config.js file:
@najamkhn Also, depending on your specific configuration and other modules that you use in your web app, you may need to extend that section above to something like:
For what it's worth, I was having this problem with Angular 5 and Angular CLI 1.5.0 when running unit tests, but not when doing a regular build / serve.
While the webpack.config that angular cli was using already had fs: 'empty' set, the problem was that karma was using different settings for webpack. I fixed this issue by putting the following in my karma.config.js
webpack: {node: {fs: 'empty'}}
The nice thing about this problem / solution was that it doesn't require having to eject the webpack config that angular cli is using.
Would someone give me some guidance as to how to fix the configuration in Rollup instead of Webpack? I also get the fs is not defined error. I tried adding
at the root of the default exported object of the rollup.config.js file with no success...
EDIT: Finally found it! I had to install node-globals and node-builtins plugins and use them after the commonjs one (for a Svelte app). Here's the simplified configuration:
Activity
VladimirTechMan commentedon Jul 10, 2016
@najamkhn, just in case, are you trying to build a web-client app (= to be running in the browser) using LokiJS with the webpack / babel toolchain (or alike)?
najamkhn commentedon Jul 10, 2016
Yes using it with webpack and building web app.
VladimirTechMan commentedon Jul 10, 2016
@najamkhn Okay, that's what I suspected, based on the specific issue that you reported. But I needed to double-check my guess with you first. What you need to do is, to add the following configuration section and parameters into your webpack.config.js file:
VladimirTechMan commentedon Jul 10, 2016
@najamkhn Also, depending on your specific configuration and other modules that you use in your web app, you may need to extend that section above to something like:
VladimirTechMan commentedon Jul 10, 2016
@najamkhn Finally, in the case if you need a piece of Webpack's official documentation on that part, you can refer to: https://webpack.github.io/docs/configuration.html#node
jetiny commentedon Aug 22, 2016
will you extract it outside ?
VladimirTechMan commentedon Aug 28, 2016
@jetiny, extract what? I am not sure if I understand your question. Please, elaborate.
obeliskos commentedon Oct 23, 2016
Thanks to all who answered, I believe this is resolved. In future releases we may extract the (node) filesystem adapter out into its own module.
jamesmikesell commentedon Nov 25, 2017
For what it's worth, I was having this problem with Angular 5 and Angular CLI 1.5.0 when running unit tests, but not when doing a regular build / serve.
While the webpack.config that angular cli was using already had
fs: 'empty'set, the problem was that karma was using different settings for webpack. I fixed this issue by putting the following in mykarma.config.jsThe nice thing about this problem / solution was that it doesn't require having to
ejectthe webpack config that angular cli is using.davidsavoie1 commentedon Apr 27, 2020
Would someone give me some guidance as to how to fix the configuration in Rollup instead of Webpack? I also get the
fs is not definederror. I tried addingat the root of the default exported object of the
rollup.config.jsfile with no success...EDIT: Finally found it! I had to install
node-globalsandnode-builtinsplugins and use them after thecommonjsone (for a Svelte app). Here's the simplified configuration:jeremychone commentedon Sep 14, 2020
Thanks @davidsavoie1 Big time-saver, I was going to give up.
I wished LokiJs would be more browser-friendly out of the box, or have a lokijs-browser. Anyway, the functionalities look to be what I am looking for.