From 33bebac0f9625a5a59badab1be833d74b77fd20b Mon Sep 17 00:00:00 2001 From: qiang Date: Thu, 21 Mar 2019 17:47:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=99=AE=E9=80=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20uni=E3=80=81plus=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generator.js | 13 +++++++++++-- template/common-ts/tsconfig.json | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/generator.js b/generator.js index 2ab49a6..09fd84b 100644 --- a/generator.js +++ b/generator.js @@ -32,6 +32,16 @@ async function generate (dir, files, base = '', rootOptions = {}) { } module.exports = (api, options, rootOptions) => { + if (options.template !== 'default-ts') { + api.extendPackage(pkg => { + return { + devDependencies: { + '@types/uni-app': '*', + '@types/html5plus': '*' + } + } + }) + } if (options.template === 'default-ts') { // 启用 typescript api.extendPackage(pkg => { return { @@ -41,8 +51,7 @@ module.exports = (api, options, rootOptions) => { }, devDependencies: { '@babel/plugin-syntax-typescript': '^7.2.0', - '@types/uni-app': '*', - '@types/html5plus': '*', + '@dcloudio/types': '*', '@vue/cli-plugin-typescript': '^3.3.0', 'typescript': api.hasPlugin('eslint') ? '~3.1.1' : '^3.0.0' } diff --git a/template/common-ts/tsconfig.json b/template/common-ts/tsconfig.json index ece882f..21e6cf5 100644 --- a/template/common-ts/tsconfig.json +++ b/template/common-ts/tsconfig.json @@ -12,7 +12,8 @@ "sourceMap": true, "baseUrl": ".", "types": [ - "webpack-env" + "webpack-env", + "@dcloudio/types/uni-app" ], "paths": { "@/*": [