-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(bundling): webpack and rspack builds respect output.clean config option #30573
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
View your CI Pipeline Execution ↗ for commit 61d0cda.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we deprecate this?
fca7975
to
95947e9
Compare
80eebbc
to
e461e37
Compare
e461e37
to
682a26e
Compare
682a26e
to
61d0cda
Compare
…option (#30573) This PR fixes and issue where the standard `output.clean` option is ignored and replaced by the Nx-specific `deleteOutputPath` option on the `NxAppWebpackPlugin` and `NxAppRspackPlugin` plugins. We want to allow users to use standards over our own features, so if we see that `output.clean` is set in webpack/rspack config, then we use that value. For example, an Rspack config could be: ```js const { NxAppRspackPlugin } = require("@nx/rspack/app-plugin"); const { join } = require("path"); module.exports = { output: { path: join(__dirname, "dist/demo"), clean: false, // <-- THIS DOES NOT WORK! }, plugins: [ new NxAppRspackPlugin({ // ... }), ], }; ``` But even though `output.clean` is `false`, each build will still delete `dist`. The only way to disable that behavior is to use the Nx-specific option like this: ```js const { NxAppRspackPlugin } = require("@nx/rspack/app-plugin"); const { join } = require("path"); module.exports = { output: { path: join(__dirname, "dist/demo"), }, plugins: [ new NxAppRspackPlugin({ deleteOutputPath: false, // ... }), ], }; ``` ## Current Behavior Setting `output.clean` in Webpack/Rspack config does nothing, and we always default our own `deleteOutputPath` to `true`. ## Expected Behavior Setting `output.clean` standard option is respected. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This PR fixes and issue where the standard
output.clean
option is ignored and replaced by the Nx-specificdeleteOutputPath
option on theNxAppWebpackPlugin
andNxAppRspackPlugin
plugins.We want to allow users to use standards over our own features, so if we see that
output.clean
is set in webpack/rspack config, then we use that value.For example, an Rspack config could be:
But even though
output.clean
isfalse
, each build will still deletedist
. The only way to disable that behavior is to use the Nx-specific option like this:Current Behavior
Setting
output.clean
in Webpack/Rspack config does nothing, and we always default our owndeleteOutputPath
totrue
.Expected Behavior
Setting
output.clean
standard option is respected.Related Issue(s)
Fixes #