webpack / webpack

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
https://webpack.js.org
MIT License
64.26k stars 8.73k forks source link

Failed build succeeds on rerun using cache #18368

Open dnillovna opened 1 month ago

dnillovna commented 1 month ago

Bug report

What is the current behavior?

My build runs: npm run build On the first run, it fails. A file in dependency has a typescript error, causing the build to fail. When I try to rerun it, it succeeds. When I turn off the cache, it fails every time.

Example package to reproduce: https://github.com/dnillovna/webpack-cache-fail.git

What is the expected behavior?

Failed builds should not create a cache that can be used for future builds. When cache is enabled, the build with errors should fail every time instead of only on the first attempt.

Other relevant information:

webpack version:

webpack: latest => 5.91.0 webpack-cli: latest => 5.1.4

Node.js version:

Node: 21.6.1 - /opt/homebrew/opt/node/bin/node npm: 10.2.4 - /opt/homebrew/opt/node/bin/npm

Operating System:

OS: macOS 13.6.2 CPU: (8) arm64 Apple M1 Pro Memory: 100.47 MB / 32.00 GB

Additional tools: None

I got the information using npm run version-info, which executes webpack --version.

I found a similar issue for the other webpack cache plugin: https://github.com/mzgoddard/hard-source-webpack-plugin/issues/507