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 () {
1717 const swcTSOptions = defu ( swcOptions , {
1818 jsc : {
1919 parser : {
20- syntax : 'typescript' ,
21- dynamicImport : true
20+ syntax : 'typescript'
2221 }
2322 }
2423 } )
2524
25+ nuxt . options . extensions . push ( 'ts' )
26+ nuxt . options . build . additionalExtensions = [ 'ts' , 'tsx' ]
27+
2628 nuxt . hook ( 'webpack:config' , ( configs ) => {
2729 for ( const config of configs ) {
30+ config . resolve ! . extensions ! . push ( '.ts' , '.tsx' )
2831 config . module . rules = [
32+ ...config . module . rules . filter ( r => '.vue' . match ( r . test ) ) ,
2933 {
30- test : / \. m ? [ j t ] s x ? $ / i,
34+ test : / \. m ? j s x ? $ / i,
3135 use : {
3236 loader : require . resolve ( 'swc-loader' ) ,
3337 options : swcOptions
3438 }
3539 } ,
3640 {
37- test : / \. m ? [ j t ] s x ? $ / i,
41+ test : / \. t s x ? $ / i,
3842 use : {
3943 loader : require . resolve ( 'swc-loader' ) ,
4044 options : swcTSOptions
4145 }
4246 } ,
43- ...config . module . rules . filter ( r => ! '.js' . match ( r . test ) )
47+ ...config . module . rules . filter ( r => ! ( '.js' . match ( r . test ) || '.vue' . match ( r . test ) ) )
4448 ]
4549 }
4650 } )
You can’t perform that action at this time.
0 commit comments