Closed ScriptedAlchemy closed 4 years ago
require('webpack').version
requires Webpack at runtime, and Webpack in not installed at production time with npm install --production
and yarn install --production
, as it is a dev dependencies.
So this is why you need to pass a flag, because require('webpack')
would throw at runtime on production.
sidenote: It works for Next.js because they only use it at build time, and not at runtime (and next.config.js
is executed also at runtime)
Thanks! Was wondering ðŸ’
I noticed you opted towards
unstable_webpack5
flag that's manually passed.Just wanted some information on why we need a manual flag for this, the rest of next and patched community plugins / loaders use the require('webpack').version to determine if its WP5 automatically