Closed mizziness closed 3 years ago
I thought originally that using webpack-cli
might be the issue, and instead swapped it out for webpack-nano
, but the same error occurs:
$ yarn wp dev
yarn run v1.22.5
$ wp dev
TypeError: ManifestPlugin is not a constructor
at Object.<anonymous> (/Applications/MAMP/help.applause.com/webpack.config.js:79:5)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at loadConfig (/Applications/MAMP/help.applause.com/node_modules/webpack-nano/lib/config.js:86:24)
at doeet (/Applications/MAMP/help.applause.com/node_modules/webpack-nano/bin/wp.js:78:24)
at Object.<anonymous> (/Applications/MAMP/help.applause.com/node_modules/webpack-nano/bin/wp.js:88:28)
error Command failed with exit code 1.
I then thought that maybe going back to webpack 4 might work, but swapping out for webpack@4.44.2
also results in the same error.
There is no longer a default export, try changing the require to
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
(and switch ManifestPlugin with WebpackManifestPlugin in the webpack config)
Always read the documentation again after updating major versions: https://github.com/shellscape/webpack-manifest-plugin#usage
@shellscape Side note: The replication project is still running the old method from version 2 :) It would be helpful to have the above syntax used there.
Thanks for the heads up, I'll get right on that
Updated!
@shellscape Thanks for your work. But this is a breaking change that should be listed in the release note.
It's in the README. Always read the docs when upgrading majors.
@shwao I've removed your rude comment. You're welcome to use an alternative, and given your attitude, I suggest you do. This is your only warning, further rudeness will result in a block.
(Note: the above repro is an exact copypasta of my local project, however, I get a the same thing with a minimal build, so I am able to rule out my other plugins and config. A link to that super minimal repo is: https://repl.it/@mizziness/manifest-plugin-repro-1#package.json )
Expected Behavior
I expect to be able to run basic webpack commands without error.
Actual Behavior
Webpack commands, such as
webpack --mode development
result in the error:[webpack-cli] TypeError: ManifestPlugin is not a constructor
Additional Information
Local stack trace using yarn:
Workaround:
Currently, using
webpack-manifest-plugin@^2.0.3
will allow me to build correctly.