Skip to content

fix(vite): update worker configuration in generator to follow Vite's …#30465

Merged
Coly010 merged 2 commits into
nrwl:masterfrom
guiseek:master
Dec 11, 2025
Merged

fix(vite): update worker configuration in generator to follow Vite's …#30465
Coly010 merged 2 commits into
nrwl:masterfrom
guiseek:master

Conversation

@guiseek

@guiseek guiseek commented Mar 23, 2025

Copy link
Copy Markdown
Contributor

…new convention

Current Behavior

Currently, the @nx/vite plugin generates a vite.config.ts file where the worker configuration is commented out, but uses the old format:

// worker: {
//  plugins: [ nxViteTsPaths() ],
// }

If uncomment, this format triggers a warning from Vite, as the worker configuration should now be a function that returns an array of plugins. While Vite automatically converts the old format for compatibility, it is not ideal to rely on this behavior.

Expected Behavior

With the changes in this PR, the @nx/vite plugin will generate a Vite configuration where the worker configuration follows the new convention, avoiding warnings and ensuring compatibility with future versions of Vite. The updated configuration will look like this:

// worker: {
//  plugins: () => [ nxViteTsPaths() ],
// }

This change ensures that the generated configuration aligns with Vite's recommended practices and eliminates unnecessary warnings.

@guiseek guiseek requested a review from a team as a code owner March 23, 2025 02:42
@guiseek guiseek requested a review from leosvelperez March 23, 2025 02:42
@vercel

vercel Bot commented Mar 23, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Dec 11, 2025 1:54pm

@nx-cloud

nx-cloud Bot commented Mar 23, 2025

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit cd9af1e

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 5m 2s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 24s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 18s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-11 13:58:51 UTC

@FrozenPandaz FrozenPandaz added the priority: low Low Priority (does not affect many people or not severely or has an easy workaround) label May 14, 2025
@github-actions github-actions Bot added stale and removed stale labels Nov 11, 2025
@Coly010 Coly010 requested review from a team and Coly010 as code owners December 11, 2025 10:05
@netlify

netlify Bot commented Dec 11, 2025

Copy link
Copy Markdown

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cd9af1e

nx-cloud[bot]

This comment was marked as outdated.

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A new CI pipeline execution was requested that may update the conclusion below...

Nx Cloud is proposing a fix for your failed CI:

We updated the Angular test snapshot to align with the new Vite worker configuration format introduced in this PR. The snapshot now expects plugins: () => [...] instead of plugins: [...], matching Vite's recommended convention for worker plugins. This change ensures the test passes with the updated generator output.

We verified this fix by re-running angular:test.

diff --git a/packages/angular/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/angular/src/generators/application/__snapshots__/application.spec.ts.snap
index 9a9210e3d1..91586b4df4 100644
--- a/packages/angular/src/generators/application/__snapshots__/application.spec.ts.snap
+++ b/packages/angular/src/generators/application/__snapshots__/application.spec.ts.snap
@@ -699,7 +699,7 @@ export default defineConfig(() => ({
   plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
   // Uncomment this if you are using workers.
   // worker: {
-  //  plugins: [ nxViteTsPaths() ],
+  //   plugins: () => [ nxViteTsPaths() ],
   // },
   test: {
     name: 'my-app',

Because this branch comes from a fork, it is not possible for us to apply fixes directly, but you can apply the changes locally using the available options below.

Apply changes locally with:

npx nx-cloud apply-locally yV5I-wXYQ

Apply fix locally with your editor ↗   View interactive diff ↗


🎓 Learn more about Self-Healing CI on nx.dev

@Coly010 Coly010 enabled auto-merge (squash) December 11, 2025 14:16
@Coly010 Coly010 merged commit 2917b3e into nrwl:master Dec 11, 2025
17 of 18 checks passed
@github-actions

Copy link
Copy Markdown
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.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

priority: low Low Priority (does not affect many people or not severely or has an easy workaround)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants