diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index 59fb8844a..eea63b850 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -73,7 +73,7 @@ "css-loader": "^3.5.3", "eslint": "^7.0.0", "fast-glob": "^3.2.2", - "fork-ts-checker-webpack-plugin": "^4.1.6", + "fork-ts-checker-webpack-plugin": "^5.0.0", "gh-pages": "^2.2.0", "hash-sum": "^2.0.0", "html-webpack-plugin": "4.3.0", diff --git a/packages/vant-cli/src/config/webpack.base.ts b/packages/vant-cli/src/config/webpack.base.ts index 7bae1d3ee..d7b4adc27 100644 --- a/packages/vant-cli/src/config/webpack.base.ts +++ b/packages/vant-cli/src/config/webpack.base.ts @@ -4,7 +4,6 @@ import FriendlyErrorsPlugin from '@nuxt/friendly-errors-webpack-plugin'; import { VueLoaderPlugin } from 'vue-loader'; import { join } from 'path'; import { existsSync } from 'fs'; -import { consola } from '../common/logger'; import { WebpackConfig } from '../common/types'; import { CWD, @@ -37,7 +36,7 @@ const CSS_LOADERS = [ const plugins = [ new webpack.DefinePlugin({ __VUE_OPTIONS_API__: 'true', - __VUE_PROD_DEVTOOLS__: 'false' + __VUE_PROD_DEVTOOLS__: 'false', }), new VueLoaderPlugin(), new FriendlyErrorsPlugin({ @@ -46,26 +45,22 @@ const plugins = [ }), ]; -// const tsconfigPath = join(CWD, 'tsconfig.json'); -// if (existsSync(tsconfigPath)) { -// const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin'); -// plugins.push( -// new ForkTsCheckerPlugin({ -// formatter: 'codeframe', -// vue: { enabled: true }, -// logger: { -// // skip info message -// info() {}, -// warn(message: string) { -// consola.warn(message); -// }, -// error(message: string) { -// consola.error(message); -// }, -// }, -// }) -// ); -// } +const tsconfigPath = join(CWD, 'tsconfig.json'); +if (existsSync(tsconfigPath)) { + const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin'); + plugins.push( + new ForkTsCheckerPlugin({ + typescript: { + extensions: { + vue: { + enabled: true, + compiler: '@vue/compiler-sfc', + }, + }, + }, + }) + ); +} export const baseConfig: WebpackConfig = { mode: 'development', diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index 20e6974cc..c74f62e1c 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== @@ -1820,6 +1820,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== +"@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5": + version "7.0.6" + resolved "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.6.tgz?cache=0&sync_timestamp=1598910652146&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fjson-schema%2Fdownload%2F%40types%2Fjson-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" + integrity sha1-9MfsQ+gbMZqYFRFQMXCfJph4kfA= + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -2424,6 +2429,16 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.0, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.12.2: + version "6.12.5" + resolved "https://registry.npm.taobao.org/ajv/download/ajv-6.12.5.tgz?cache=0&sync_timestamp=1600261962070&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.5.tgz#19b0e8bae8f476e5ba666300387775fb1a00a4da" + integrity sha1-GbDouuj0duW6ZmMAOHd1+xoApNo= + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-align@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" @@ -3372,6 +3387,14 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.1.0: + version "4.1.0" + resolved "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1592843133653&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha1-ThSHCmGNni7dl92DRf2dncMVZGo= + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + changelog-filename-regex@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/changelog-filename-regex/-/changelog-filename-regex-1.1.2.tgz#19e98e38248cff0c1cf3ae3bf51bfb22c48592d6" @@ -5479,18 +5502,22 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= -fork-ts-checker-webpack-plugin@^4.1.6: - version "4.1.6" - resolved "https://registry.npm.taobao.org/fork-ts-checker-webpack-plugin/download/fork-ts-checker-webpack-plugin-4.1.6.tgz#5055c703febcf37fa06405d400c122b905167fc5" - integrity sha1-UFXHA/6883+gZAXUAMEiuQUWf8U= +fork-ts-checker-webpack-plugin@^5.0.0: + version "5.2.0" + resolved "https://registry.npm.taobao.org/fork-ts-checker-webpack-plugin/download/fork-ts-checker-webpack-plugin-5.2.0.tgz?cache=0&sync_timestamp=1599929910598&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffork-ts-checker-webpack-plugin%2Fdownload%2Ffork-ts-checker-webpack-plugin-5.2.0.tgz#780a14fb0da02a892baedd7aa0d089a1eda7b3e5" + integrity sha1-eAoU+w2gKokrrt16oNCJoe2ns+U= dependencies: - "@babel/code-frame" "^7.5.5" - chalk "^2.4.1" - micromatch "^3.1.10" + "@babel/code-frame" "^7.8.3" + "@types/json-schema" "^7.0.5" + chalk "^4.1.0" + cosmiconfig "^6.0.0" + deepmerge "^4.2.2" + fs-extra "^9.0.0" + memfs "^3.1.2" minimatch "^3.0.4" - semver "^5.6.0" + schema-utils "2.7.0" + semver "^7.3.2" tapable "^1.0.0" - worker-rpc "^0.1.0" form-data@3.0.0: version "3.0.0" @@ -5561,6 +5588,11 @@ fs-extra@^9.0.0: jsonfile "^6.0.1" universalify "^1.0.0" +fs-monkey@1.0.1: + version "1.0.1" + resolved "https://registry.npm.taobao.org/fs-monkey/download/fs-monkey-1.0.1.tgz#4a82f36944365e619f4454d9fff106553067b781" + integrity sha1-SoLzaUQ2XmGfRFTZ//EGVTBnt4E= + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -8067,6 +8099,13 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= +memfs@^3.1.2: + version "3.2.0" + resolved "https://registry.npm.taobao.org/memfs/download/memfs-3.2.0.tgz#f9438e622b5acd1daa8a4ae160c496fdd1325b26" + integrity sha1-+UOOYitazR2qikrhYMSW/dEyWyY= + dependencies: + fs-monkey "1.0.1" + memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -8175,11 +8214,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -microevent.ts@~0.1.1: - version "0.1.1" - resolved "https://registry.npm.taobao.org/microevent.ts/download/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" - integrity sha1-cLCbg/Q99RctAgWmMCW84Pc1f6A= - micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -10424,6 +10458,15 @@ saxes@^3.1.9: dependencies: xmlchars "^2.1.1" +schema-utils@2.7.0: + version "2.7.0" + resolved "https://registry.npm.taobao.org/schema-utils/download/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7" + integrity sha1-FxUfdtjq5n+793lgwzxnatn078c= + dependencies: + "@types/json-schema" "^7.0.4" + ajv "^6.12.2" + ajv-keywords "^3.4.1" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" @@ -12514,13 +12557,6 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" -worker-rpc@^0.1.0: - version "0.1.1" - resolved "https://registry.npm.taobao.org/worker-rpc/download/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5" - integrity sha1-y1Zb1tcHGo8WZgaGBR6WmtMvVNU= - dependencies: - microevent.ts "~0.1.1" - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"