fix(bundling): webpack and rspack builds respect output.clean config option#30573
Merged
fix(bundling): webpack and rspack builds respect output.clean config option#30573
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
|
View your CI Pipeline Execution ↗ for commit 61d0cda.
☁️ Nx Cloud last updated this comment at |
ndcunningham
reviewed
Apr 1, 2025
Contributor
ndcunningham
left a comment
There was a problem hiding this comment.
should we deprecate this?
ndcunningham
approved these changes
Apr 1, 2025
fca7975 to
95947e9
Compare
80eebbc to
e461e37
Compare
e461e37 to
682a26e
Compare
682a26e to
61d0cda
Compare
jaysoo
added a commit
that referenced
this pull request
Apr 2, 2025
…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 #
Contributor
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes and issue where the standard
output.cleanoption is ignored and replaced by the Nx-specificdeleteOutputPathoption on theNxAppWebpackPluginandNxAppRspackPluginplugins.We want to allow users to use standards over our own features, so if we see that
output.cleanis set in webpack/rspack config, then we use that value.For example, an Rspack config could be:
But even though
output.cleanisfalse, 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.cleanin Webpack/Rspack config does nothing, and we always default our owndeleteOutputPathtotrue.Expected Behavior
Setting
output.cleanstandard option is respected.Related Issue(s)
Fixes #