[5.0.0] TypeError: webpack.HashedModuleIdsPlugin is not a constructor

See original GitHub issue

Bug report

What is the current behavior? I get this error when building the project after upgrading to 5.0.0:

[webpack-cli] TypeError: webpack.HashedModuleIdsPlugin is not a constructor

If the current behavior is a bug, please provide the steps to reproduce.

const webpack = require('webpack')

// ...

  plugins: [
    // ...

    new webpack.HashedModuleIdsPlugin(), 

    // ...
  ],

// ...

What is the expected behavior? At least migration information should be shown on screen or in the docs.

Other relevant information: webpack version: 5.0.0 Node.js version: 14.12.0 Operating System: Windows 10 64 bit Additional tools: npm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
chenxsancommented, Nov 23, 2020

@dvopalecky I’ve filed a pull request to fix it.

1reaction
jouni-kantolacommented, Oct 11, 2020

Update the following options to their new version (if used): optimization.hashedModuleIds: true ↦ optimization.moduleIds: ‘hashed’

HashedModulesPlugin ↦ optimization.moduleIds: ‘hashed’

https://webpack.js.org/migrate/5/#update-outdated-options

Further, the recommend solution with webpack 5 is using “deterministic”, which is the default in production mode. https://webpack.js.org/migrate/5/#clean-up-configuration

Read more comments on GitHub >

github_iconTop Results From Across the Web

HashedModuleIdsPlugin - webpack
HashedModuleIdsPlugin. This plugin will cause hashes to be based on the relative path of the module, generating a four character string as the...
Read more >
webpack is not a constructor | The AI Search Engine You Control
It is not working because it is missing libraryTarget and library properties. Favicon for github.com. [5.0.0] TypeError: ...
Read more >
TypeError: webpack.CopyWebpackPlugin is not a constructor
Please try it with: const CopyWebpackPlugin = require('copy-webpack-plugin');. I think there is no named export named "CopyWebpackPlugin".
Read more >
webpack4项目升级webpack5实践 - 夜听城嚣
h5\build\webpack.prod.conf.js:136 new webpack.HashedModuleIdsPlugin(), ^ TypeError: webpack.HashedModuleIdsPlugin is not a constructor.
Read more >
azu on Twitter: "ids.HashedModuleIdsPluginに移動してるんだ ...
リリースノートには入ってない気もする "[5.0.0] TypeError: webpack. ... HashedModuleIdsPlugin is not a constructor · Issue #11631 · webpack/we ...
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