Skip to content

Commit

Permalink
feat(swc): add swc config support
Browse files Browse the repository at this point in the history
  • Loading branch information
wintercounter committed Dec 3, 2021
1 parent a460546 commit 4d051ce
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/configs/swc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { loadConfig } from '@/utils'

const tsConfig = loadConfig('typescript')

const swcConfig = loadConfig('swc', {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
dynamicImport: true,
decorators: true
},
paths: tsConfig.paths,
baseUrl: tsConfig.baseUrl,
transform: null,
target: 'es2016',
loose: false,
externalHelpers: false,
// Requires v1.2.50 or upper and requires target to be es2016 or upper.
keepClassNames: false
}
})

export default swcConfig
9 changes: 9 additions & 0 deletions src/configs/swc/write.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import FileTypes from '@/utils/fileTypes'
import { writeFile } from '@/utils'
import swcConfig from '@/configs/swc'

const writeConfig = (dir = __dirname, format = FileTypes.JSON_NO_EXT, overwrite) => {
return writeFile(dir, '.swcrc', swcConfig, format, overwrite)
}

export default writeConfig

0 comments on commit 4d051ce

Please sign in to comment.