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 44 "repository" : " nuxt-contrib/nuxt-swc" ,
55 "license" : " MIT" ,
66 "main" : " ./dist/index.js" ,
7+ "types" : " ./dist/index.d.ts" ,
78 "files" : [
89 " dist"
910 ],
2122 "swc-loader" : " ^0.1.14"
2223 },
2324 "devDependencies" : {
25+ "@nuxt/types" : " ^2.15.8" ,
2426 "@nuxtjs/eslint-config-typescript" : " ^6.0.0" ,
2527 "eslint" : " ^7.22.0" ,
2628 "nuxt" : " ^2.15.3" ,
Original file line number Diff line number Diff line change 11import defu from 'defu'
22import { name , version } from '../package.json'
3+ import type { Options } from '@swc/core'
4+ import type { NuxtOptionsBuild } from '@nuxt/types/config/build'
35
46function swcModule ( ) {
57 const { nuxt } = this
68
7- const swcOptions = defu ( nuxt . options . build . swc , {
9+ const swcOptions : Options = defu ( nuxt . options . build . swc , {
810 // sync: true,
911 sourceMaps : false ,
1012 jsc : {
1113 parser : {
1214 dynamicImport : true
1315 }
1416 }
15- } )
17+ } as Options )
1618
1719 const swcTSOptions = defu ( swcOptions , {
1820 jsc : {
1921 parser : {
2022 syntax : 'typescript'
2123 }
2224 }
23- } )
25+ } as Options )
2426
2527 nuxt . options . extensions . push ( 'ts' )
2628 nuxt . options . build . additionalExtensions = [ 'ts' , 'tsx' ]
@@ -56,3 +58,15 @@ swcModule.meta = {
5658}
5759
5860export 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 77 "allowSyntheticDefaultImports" : true ,
88 "strict" : false ,
99 "types" : [
10- " node"
10+ " node" ,
11+ " @nuxt/types"
1112 ]
1213 }
1314}
You can’t perform that action at this time.
0 commit comments