control-panel
control-panel copied to clipboard
Webpack is unsupported?
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).
the same issue
I found solution
npm i -D transform-loader
and inside webpack.config.js
rules : [ { test: /node_modules/(control-panel)/, loader: 'transform-loader?brfs', } ]
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