From 29f16483c764662252573b38475eacb6440546c9 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Wed, 4 Jan 2023 21:46:25 +0200 Subject: [PATCH] fix(vite): correct worker plugin (#14147) --- .../__snapshots__/configuration.spec.ts.snap | 40 ++++++++++++------- .../vitest/__snapshots__/vitest.spec.ts.snap | 24 ++++++----- packages/vite/src/utils/generator-utils.ts | 8 ++-- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/packages/vite/src/generators/configuration/__snapshots__/configuration.spec.ts.snap b/packages/vite/src/generators/configuration/__snapshots__/configuration.spec.ts.snap index 2fc3473f405b2..18c710e4820ff 100644 --- a/packages/vite/src/generators/configuration/__snapshots__/configuration.spec.ts.snap +++ b/packages/vite/src/generators/configuration/__snapshots__/configuration.spec.ts.snap @@ -26,9 +26,11 @@ import { join } from 'path'; // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../', + // }), + // ], // }, // Configuration for building your library. @@ -79,9 +81,11 @@ import { join } from 'path'; // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, // Configuration for building your library. @@ -375,9 +379,11 @@ exports[`@nrwl/vite:configuration transform React app to use Vite should create // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, @@ -516,9 +522,11 @@ exports[`@nrwl/vite:configuration transform Web app to use Vite should create vi // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, @@ -646,9 +654,11 @@ exports[`@nrwl/vite:configuration vitest should create a vitest configuration if // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, diff --git a/packages/vite/src/generators/vitest/__snapshots__/vitest.spec.ts.snap b/packages/vite/src/generators/vitest/__snapshots__/vitest.spec.ts.snap index ad7b61f01f742..abb6e600f3331 100644 --- a/packages/vite/src/generators/vitest/__snapshots__/vitest.spec.ts.snap +++ b/packages/vite/src/generators/vitest/__snapshots__/vitest.spec.ts.snap @@ -21,9 +21,11 @@ exports[`vitest generator insourceTests should add the insourceSource option in // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, define: { @@ -62,9 +64,11 @@ exports[`vitest generator vite.config should create correct vite.config.ts file // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, @@ -101,9 +105,11 @@ exports[`vitest generator vite.config should create correct vite.config.ts file // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '../../', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '../../', + // }), + // ], // }, diff --git a/packages/vite/src/utils/generator-utils.ts b/packages/vite/src/utils/generator-utils.ts index 5de59e3b80fe9..b831bd3b0243f 100644 --- a/packages/vite/src/utils/generator-utils.ts +++ b/packages/vite/src/utils/generator-utils.ts @@ -565,9 +565,11 @@ export function createOrEditViteConfig( const workerOption = ` // Uncomment this if you are using workers. // worker: { - // viteTsConfigPaths({ - // root: '${offsetFromRoot(projectConfig.root)}', - // }), + // plugins: [ + // viteTsConfigPaths({ + // root: '${offsetFromRoot(projectConfig.root)}', + // }), + // ], // },`; if (tree.exists(viteConfigPath)) {