redux-api-middleware – iconv-loader warning August 15, 2016
Posted by kevinbe71 in Development, Javascript.Tags: electron, iconv-loader, Javascript, node, redux, redux-api-middleware, webpack
add a comment
I recently ran into an error using webpack with an electron based app I’m working on. The error manifested from a webpack warning:
WARNING in [...base path removed...]~/encoding/lib/iconv-loader.js Critical dependencies: 9:12-34 the request of a dependency is an expression @ [...base path removed...]~/encoding/lib/iconv-loader.js 9:12-34
How I ended up with this was:
- I produced an isomorphic web app with react, redux and redux-api-middleware (using a gulpfile to bundle it because that’s what the yeoman template used).
- I thought it would be great to share common code with an electron-based desktop app I was working on (using webpack because that’s what I’d chosen to use).
- I combined code and ran into the error.
To help resolve the issue I explored a few web pages and found this one that solved the problem (thanks Jim Pick!): https://github.com/andris9/encoding/issues/16
I added the following to my webpack.config.js:
plugins: [
... other plugins listed here ...,
new webpack.NormalModuleReplacementPlugin(
/\/iconv-loader$/, 'node-noop'
)
]