diff --git a/apps/analog-app/project.json b/apps/analog-app/project.json index 7a92cf07d..7a742342c 100644 --- a/apps/analog-app/project.json +++ b/apps/analog-app/project.json @@ -4,6 +4,7 @@ "projectType": "application", "sourceRoot": "apps/analog-app/src", "prefix": "analogjs", + "implicitDependencies": ["vitest-angular"], "tags": [], "targets": { "build": { diff --git a/packages/vite-plugin-angular/src/lib/angular-vitest-plugin.ts b/packages/vite-plugin-angular/src/lib/angular-vitest-plugin.ts index cf692fd56..4ecde2205 100644 --- a/packages/vite-plugin-angular/src/lib/angular-vitest-plugin.ts +++ b/packages/vite-plugin-angular/src/lib/angular-vitest-plugin.ts @@ -7,6 +7,10 @@ export function angularVitestPlugin(): Plugin { enforce: 'post', config(userConfig) { return { + optimizeDeps: { + include: ['tslib', '@angular/cdk/testing/testbed'], + exclude: ['@angular/cdk/testing'], + }, ssr: { noExternal: [/cdk\/fesm2022/], }, @@ -15,6 +19,7 @@ export function angularVitestPlugin(): Plugin { server: { deps: { inline: [ + '@angular/material', '@analogjs/router', '@analogjs/vitest-angular/setup-zone', ], @@ -74,6 +79,12 @@ export function angularVitestSourcemapPlugin(): Plugin { return { name: '@analogjs/vitest-angular-sourcemap-plugin', async transform(code: string, id: string) { + const [, query] = id.split('?'); + + if (query && query.includes('inline')) { + return; + } + const result = await transformWithEsbuild(code, id, { loader: 'js', });