Skip to content

Commit

Permalink
feat(cli-service): provide jsconfig.json in no-ts template (#6285)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 authored Apr 9, 2021
1 parent ae967f7 commit 0dc604c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/@vue/cli-service/generator/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = (api, options) => {
api.render('./template', {
doesCompile: api.hasPlugin('babel') || api.hasPlugin('typescript')
doesCompile: api.hasPlugin('babel') || api.hasPlugin('typescript'),
useBabel: api.hasPlugin('babel')
})

if (options.vueVersion === '3') {
Expand Down Expand Up @@ -74,4 +75,9 @@ module.exports = (api, options) => {
if (options.configs) {
api.extendPackage(options.configs)
}

// Delete jsconfig.json when typescript
if (api.hasPlugin('typescript')) {
api.render((files) => delete files['jsconfig.json'])
}
}
19 changes: 19 additions & 0 deletions packages/@vue/cli-service/generator/template/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "<%- options.useBabel ? 'esnext' : 'es5' %>",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

0 comments on commit 0dc604c

Please sign in to comment.