vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.44k stars 4.78k forks source link

Build failed after updating webpack from 4.44.1 to 5.11.1 #2753

Closed imaegoo closed 3 years ago

imaegoo commented 3 years ago

Bug report

Steps to reproduce

Repo: https://github.com/imaegoo/twikoo

  1. git clone https://github.com/imaegoo/twikoo.git twikoo
  2. cd twikoo
  3. yarn install
  4. yarn docs:build

What is expected?

Build successfully (it was successfully before updating Webpack).

What is actually happening?

Get an exception: Error: Rule can only have one resource source (provided resource and test + include + exclude) in {...

Detail logs: https://github.com/imaegoo/twikoo/runs/1644442505?check_suite_focus=true

Other relevant information

"devDependencies": {
  "webpack": "^4.44.1",
  "webpack-cli": "^3.3.12",
  "webpack-dev-server": "^3.11.0"
}
"devDependencies": {
  "webpack": "^5.11.1",
  "webpack-cli": "^4.2.0",
  "webpack-dev-server": "^4.0.0-beta.0"
}
Environment Info:

  System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
  Binaries:
    Node: 14.15.3 - D:\Java\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.9 - D:\Java\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.423.0), Chromium (87.0.664.66)
  npmPackages:
    @vuepress/core:  1.7.1
    @vuepress/theme-default:  1.7.1
    vuepress: ^1.7.1 => 1.7.1
  npmGlobalPackages:
    vuepress: Not Found
imaegoo commented 3 years ago

Workaround

https://github.com/imaegoo/twikoo/pull/91/files

Change build command from

yarn && yarn docs:build

to

yarn global add vuepress@1.8.0 && vuepress build docs
meteorlxy commented 3 years ago

Try vuepress 2 if you want to use webpack 5 for now

imaegoo commented 3 years ago

@meteorlxy OK, thanks!

nth-chile commented 1 year ago

What if my company won't let me use a beta version? I don't understand why my other packages should affect vuepress. Shouldn't vuepress use its own version of webpack?