Skip to content

Commit

Permalink
fix(vite-plugin-angular): improve support for Angular Material and te…
Browse files Browse the repository at this point in the history
…sting using harnesses (#1442)
  • Loading branch information
brandonroberts authored Nov 14, 2024
1 parent 8d69254 commit 8338d42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/analog-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"projectType": "application",
"sourceRoot": "apps/analog-app/src",
"prefix": "analogjs",
"implicitDependencies": ["vitest-angular"],
"tags": [],
"targets": {
"build": {
Expand Down
11 changes: 11 additions & 0 deletions packages/vite-plugin-angular/src/lib/angular-vitest-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/],
},
Expand All @@ -15,6 +19,7 @@ export function angularVitestPlugin(): Plugin {
server: {
deps: {
inline: [
'@angular/material',
'@analogjs/router',
'@analogjs/vitest-angular/setup-zone',
],
Expand Down Expand Up @@ -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',
});
Expand Down

0 comments on commit 8338d42

Please sign in to comment.