File tree Expand file tree Collapse file tree 4 files changed +456
-13
lines changed Expand file tree Collapse file tree 4 files changed +456
-13
lines changed Original file line number Diff line number Diff line change 4
4
"repository" : " nuxt-contrib/nuxt-swc" ,
5
5
"license" : " MIT" ,
6
6
"main" : " ./dist/index.js" ,
7
+ "types" : " ./dist/index.d.ts" ,
7
8
"files" : [
8
9
" dist"
9
10
],
21
22
"swc-loader" : " ^0.1.14"
22
23
},
23
24
"devDependencies" : {
25
+ "@nuxt/types" : " ^2.15.8" ,
24
26
"@nuxtjs/eslint-config-typescript" : " ^6.0.0" ,
25
27
"eslint" : " ^7.22.0" ,
26
28
"nuxt" : " ^2.15.3" ,
Original file line number Diff line number Diff line change 1
1
import defu from 'defu'
2
2
import { name , version } from '../package.json'
3
+ import type { Options } from '@swc/core'
4
+ import type { NuxtOptionsBuild } from '@nuxt/types/config/build'
3
5
4
6
function swcModule ( ) {
5
7
const { nuxt } = this
6
8
7
- const swcOptions = defu ( nuxt . options . build . swc , {
9
+ const swcOptions : Options = defu ( nuxt . options . build . swc , {
8
10
// sync: true,
9
11
sourceMaps : false ,
10
12
jsc : {
11
13
parser : {
12
14
dynamicImport : true
13
15
}
14
16
}
15
- } )
17
+ } as Options )
16
18
17
19
const swcTSOptions = defu ( swcOptions , {
18
20
jsc : {
19
21
parser : {
20
22
syntax : 'typescript'
21
23
}
22
24
}
23
- } )
25
+ } as Options )
24
26
25
27
nuxt . options . extensions . push ( 'ts' )
26
28
nuxt . options . build . additionalExtensions = [ 'ts' , 'tsx' ]
@@ -56,3 +58,15 @@ swcModule.meta = {
56
58
}
57
59
58
60
export default swcModule
61
+
62
+ declare module '@nuxt/types/config/build' {
63
+ interface NuxtOptionsBuild {
64
+ swc ?: Options
65
+ }
66
+ }
67
+
68
+ declare module '@nuxt/types' {
69
+ interface NuxtOptions {
70
+ build : NuxtOptionsBuild
71
+ }
72
+ }
Original file line number Diff line number Diff line change 7
7
"allowSyntheticDefaultImports" : true ,
8
8
"strict" : false ,
9
9
"types" : [
10
- " node"
10
+ " node" ,
11
+ " @nuxt/types"
11
12
]
12
13
}
13
14
}
You can’t perform that action at this time.
0 commit comments