freeman-lab / control-panel

embeddable panel of inputs for parameter setting
MIT License
237 stars 17 forks source link

Webpack is unsupported? #21

Open j0hnm4r5 opened 6 years ago

j0hnm4r5 commented 6 years ago

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).

caracal7 commented 6 years ago

the same issue

caracal7 commented 6 years ago

I found solution

npm i -D transform-loader

and inside webpack.config.js

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

ghost commented 5 years ago

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