Skip to content

Commit

Permalink
fix(vite-plugin-angular): skip transforming inline scripts (#98)
Browse files Browse the repository at this point in the history
Closes #96
  • Loading branch information
brandonroberts authored Sep 30, 2022
1 parent af571c7 commit d54258e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/astro-app/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@ const serverSideTitle = 'Angular (server side binding)';
padding: 0;
}
</style>

<script>
console.log('Hello Astro');
</script>
12 changes: 12 additions & 0 deletions packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ export function angular(options?: PluginOptions): Plugin[] {
return;
}

/**
* Check for .ts extenstions for inline script files being
* transformed (Astro).
*
* Example ID:
*
* /src/pages/index.astro?astro&type=script&index=0&lang.ts
*/
if (id.includes('type=script')) {
return;
}

if (/\.[cm]?tsx?$/.test(id)) {
/**
* Re-analyze on each transform
Expand Down

0 comments on commit d54258e

Please sign in to comment.