TypeError: ManifestPlugin is not a constructor

See original GitHub issue

(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:

yarn run v1.22.5
$ webpack --mode development
[webpack-cli] TypeError: ManifestPlugin is not a constructor
    at Object.<anonymous> (/Applications/MAMP/help.applause.com/webpack.config.js:79:5)
    at Module._compile (/Applications/MAMP/help.applause.com/node_modules/v8-compile-cache/v8-compile-cache.js:192: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 (/Applications/MAMP/help.applause.com/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at requireConfig (/Applications/MAMP/help.applause.com/node_modules/webpack-cli/lib/groups/resolveConfig.js:73:18)
    at Array.map (<anonymous>)
    at resolveConfigFiles (/Applications/MAMP/help.applause.com/node_modules/webpack-cli/lib/groups/resolveConfig.js:124:40)
error Command failed with exit code 2.

Workaround:

Currently, using webpack-manifest-plugin@^2.0.3 will allow me to build correctly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
erik-perricommented, Dec 4, 2020

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)

1reaction
shellscapecommented, Dec 23, 2020

It’s in the README. Always read the docs when upgrading majors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ManifestPlugin is not a constructor Β· Issue #230 - GitHub
I had this issue just now, and it turned out to be because npm i webpack-manifest-plugin had inexplicably installed version 2.2.0 (why?), which...
Read more >
TypeError: webpackManifestPlugin is not a constructor
My build script is failing after upgrading webpack with the following error: TypeError: webpackManifestPlugin is not a constructor.
Read more >
Error in node.js webpack-cli failed to load config, typeError
The error you get is: [webpack-cli] TypeError: ManifestPlugin is not a constructor. You are trying to load weback-manifest-plugin it likeΒ ...
Read more >
TypeError: CleanwebpackPlugin is not a constructor-Vue.js
[Solved]-TypeError: CleanwebpackPlugin is not a constructor-Vue.js ... It is class name of this plugin which is being imported, so there is no place...
Read more >
webpack-manifest-plugin - npm
A Webpack Plugin for generating Asset Manifests. Latest version: 5.0.0, last published: 10 months ago. Start using webpack-manifest-plugin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found