fix(vite): update worker configuration in generator to follow Vite's …#30465
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
View your CI Pipeline Execution ↗ for commit cd9af1e
☁️ Nx Cloud last updated this comment at |
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
There was a problem hiding this comment.
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
|
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. |
…new convention
Current Behavior
Currently, the @nx/vite plugin generates a
vite.config.tsfile where the worker configuration is commented out, but uses the old format: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:
This change ensures that the generated configuration aligns with Vite's recommended practices and eliminates unnecessary warnings.