When I connect my application using webpack with React 16, I get the message “Uncaught ReferenceError: require undefined” in the browser for both responsive and responsive. The resources causing the error are the reactions .production.min.js and the reaction-dom.production.min.js (from node_modules / reaction / cjs). When I check these files, I clearly see the "require" links, which are the source of the error. This does not happen with React 15.6.2 (or lower) because there are no calls in production packages. Webpack does not seem to convert these files, and I have no idea why not. I have google and google, re-read the documents in the web package, and I just come completely empty-handed. I am sure this is a basic webpack configuration issue, but I just don't understand it. I am using webpack 3.6.0. Exactly the same project is good with React 15.6.2 (which seems reasonable since there are no calls in these production packages). This is only a problem when I create production packages. In "development mode" I use hot-loader (version 3.0.0-beta.7) and have no problems. The webpack development and production configuration supports the same module.rules as:
config.module.rules = [ // javascript { test: /\.jsx?$/, use: 'babel-loader', include: [path.join(__dirname, '../src/client'), path.join(__dirname, '../src/common')] }, ];
How can I get webpack to convert reaction processing files? I am surprised that I am the only one who comes across this ... but sometimes I feel that webpack has more control over me than I do. Any advice would be really appreciated.
source share