How to Read/Write Json files with webpack?

I’m running an admin panel on localhost using webpack.

I’m trying to save a bunch of objects into a json file in the same directory using fs which doesn’t work.

The error I receive: Node cannot find module "fs"

I understand that ‘fs’ belongs to NodeJS environement which webpack can’t really use, so my question is whether there’s another alternative to reading/writing json files with webpack.

Thanks!

Leave a Comment