Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2-5 opened this issue Oct 10, 2020 · 5 comments
Closed

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

2-5 opened this issue Oct 10, 2020 · 5 comments

Comments

@2-5
Copy link

2-5 commented Oct 10, 2020

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

@blephy
Copy link

blephy commented Oct 10, 2020

I'm getting an other error for me :

Property 'HashedModuleIdsPlugin' does not exist on type 'typeof import("/Users/blephy/Sites/strict-optimized-react-starter/node_modules/webpack/types.d.ts")'

@jouni-kantola
Copy link

jouni-kantola commented 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

@alexander-akait
Copy link
Member

Answer above, it is breaking change, I think you don’t need this plugin anymore, long term cache is working out of box, anyway if you use this plugin under ids property

ids: {

@dvopalecky
Copy link

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

HashedModulesPlugin ↦ optimization.moduleIds: 'hashed'

If the plugin was called "HashedModuleIdsPlugin", can we make the name consistent in the migration guide https://webpack.js.org/migrate/5/#update-outdated-options which currently states "HashedModulesPlugin". Thanks

@chenxsan
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants