File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ <script >
2+ type Foo = 'bar';
3+ console.log("stuff");
4+ </script >
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ <h2>Reused variable names</h2>
119119
120120 import { parse } from 'node:url'
121121 text ( '.url' , parse ( 'https://vitejs.dev' ) . hostname )
122+
123+ import './index.astro'
122124</ script >
123125
124126< script type ="module ">
Original file line number Diff line number Diff line change @@ -50,6 +50,15 @@ module.exports = {
5050 res . end ( 'pong' )
5151 } )
5252 }
53+ } ,
54+ {
55+ name : 'test-astro' ,
56+ transform ( code , id ) {
57+ if ( id . endsWith ( '.astro' ) ) {
58+ code = `export default {}`
59+ return { code }
60+ }
61+ }
5362 }
5463 ]
5564}
Original file line number Diff line number Diff line change @@ -281,6 +281,8 @@ function esbuildScanPlugin(
281281 let loader : Loader = 'js'
282282 if ( lang === 'ts' || lang === 'tsx' || lang === 'jsx' ) {
283283 loader = lang
284+ } else if ( path . endsWith ( '.astro' ) ) {
285+ loader = 'ts'
284286 }
285287 const srcMatch = openTag . match ( srcRE )
286288 if ( srcMatch ) {
You can’t perform that action at this time.
0 commit comments