File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -17,30 +17,34 @@ function swcModule () {
17
17
const swcTSOptions = defu ( swcOptions , {
18
18
jsc : {
19
19
parser : {
20
- syntax : 'typescript' ,
21
- dynamicImport : true
20
+ syntax : 'typescript'
22
21
}
23
22
}
24
23
} )
25
24
25
+ nuxt . options . extensions . push ( 'ts' )
26
+ nuxt . options . build . additionalExtensions = [ 'ts' , 'tsx' ]
27
+
26
28
nuxt . hook ( 'webpack:config' , ( configs ) => {
27
29
for ( const config of configs ) {
30
+ config . resolve ! . extensions ! . push ( '.ts' , '.tsx' )
28
31
config . module . rules = [
32
+ ...config . module . rules . filter ( r => '.vue' . match ( r . test ) ) ,
29
33
{
30
- test : / \. m ? [ j t ] s x ? $ / i,
34
+ test : / \. m ? j s x ? $ / i,
31
35
use : {
32
36
loader : require . resolve ( 'swc-loader' ) ,
33
37
options : swcOptions
34
38
}
35
39
} ,
36
40
{
37
- test : / \. m ? [ j t ] s x ? $ / i,
41
+ test : / \. t s x ? $ / i,
38
42
use : {
39
43
loader : require . resolve ( 'swc-loader' ) ,
40
44
options : swcTSOptions
41
45
}
42
46
} ,
43
- ...config . module . rules . filter ( r => ! '.js' . match ( r . test ) )
47
+ ...config . module . rules . filter ( r => ! ( '.js' . match ( r . test ) || '.vue' . match ( r . test ) ) )
44
48
]
45
49
}
46
50
} )
You can’t perform that action at this time.
0 commit comments