7

I tried updating my project to the latest vue and webpack but whenever I try to run my app with npm run dev it gives me an error:

[webpack-cli] Failed to load 'E:\repos\project\build\webpack.config.js' config
[webpack-cli] TypeError: webpack.NamedModulesPlugin is not a constructor

I'm using the latest webpack, and webpack-cli:

"webpack": "^5.35.0",
"webpack-cli": "^4.6.0",
"webpack-dev-server": "^3.11.2",

And also my scripts are updated from webpack-dev-serve to webpack serve as shows:

"dev:eih": "npm run generate-assets:test:eih && cross-env TARGET_BRAND=eih cross-env NODE_ENV=development cross-env PROJECT_VERBOSE_LOG=true cross-env PROJECT_MPIN_IN_BROWSER=true webpack serve --config ./build/webpack.config.js",

I could not fin any answer which helped

2 Answers 2

6

config.plugins

plugins: [
  - new webpack.NamedModulesPlugin(),
]

config.optimization

+ optimization: {
   moduleIds: 'named'
}
Sign up to request clarification or add additional context in comments.

Comments

1

It looks like it isn't needed anymore has optimizations are already done out of the box.

Although someone suggested replacing it with

optimization: {
   moduleIds: 'named'
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.