control-panel icon indicating copy to clipboard operation
control-panel copied to clipboard

Webpack is unsupported?

Open j0hnm4r5 opened this issue 6 years ago • 3 comments

When trying to use control-panel with Webpack, I get:

Uncaught Error: Cannot find module "fs"

and

./node_modules/control-panel/index.js Module not found: Error: Can't resolve 'fs' in '$PATH_TO_PROJECT/node_modules/control-panel'.

This seems to be a known problem with other repos (see here, for example), but the solutions provided for those repos (namely, adding node: { fs: "empty: } to the webpack.config.js) do not seem to work — trying that results in a new error: Uncaught TypeError: fs.readFileSync is not a function.

Following up on that error leads to information that fs.readFileSync will never truly work in the browser, as it is a Node function (see here).

j0hnm4r5 avatar Mar 06 '18 22:03 j0hnm4r5

the same issue

caracal7 avatar Apr 28 '18 10:04 caracal7

I found solution

npm i -D transform-loader

and inside webpack.config.js

rules : [ { test: /node_modules/(control-panel)/, loader: 'transform-loader?brfs', } ]

caracal7 avatar Apr 28 '18 10:04 caracal7

I had a little trouble with this solution (I'm on webpack ^4.16.5), but I did get it working with what's in #23

ghost avatar Aug 16 '18 00:08 ghost