diff --git a/packages/typescript-build/package.json b/packages/typescript-build/package.json index 26c23232..c5260b62 100644 --- a/packages/typescript-build/package.json +++ b/packages/typescript-build/package.json @@ -17,7 +17,7 @@ "dependencies": { "@nuxt/types": "0.7.9", "consola": "^2.14.0", - "fork-ts-checker-webpack-plugin": "^4.1.6", + "fork-ts-checker-webpack-plugin": "^5.0.6", "ts-loader": "^7.0.5", "typescript": "~3.9" }, diff --git a/packages/typescript-build/src/index.ts b/packages/typescript-build/src/index.ts index 9965f9ed..0c298957 100644 --- a/packages/typescript-build/src/index.ts +++ b/packages/typescript-build/src/index.ts @@ -2,7 +2,7 @@ import path from 'path' import consola from 'consola' import { Module } from '@nuxt/types' import { Options as TsLoaderOptions } from 'ts-loader' -import { Options as TsCheckerOptions } from 'fork-ts-checker-webpack-plugin' +import { ForkTsCheckerWebpackPluginOptions as TsCheckerOptions } from 'fork-ts-checker-webpack-plugin/lib/ForkTsCheckerWebpackPluginOptions' import { RuleSetUseItem } from 'webpack' declare module '@nuxt/types' { @@ -17,7 +17,7 @@ export interface Options { ts?: Partial tsx?: Partial } - typeCheck?: Partial | boolean + typeCheck?: TsCheckerOptions | boolean } const defaults: Options = { @@ -75,11 +75,14 @@ const tsModule: Module = function (moduleOptions) { if (options.typeCheck && isClient && !isModern) { const ForkTsCheckerWebpackPlugin = require(this.nuxt.resolver.resolveModule('fork-ts-checker-webpack-plugin')) config.plugins!.push(new ForkTsCheckerWebpackPlugin(Object.assign({ - vue: true, - tsconfig: path.resolve(this.options.rootDir!, 'tsconfig.json'), - formatter: 'codeframe', + typescript: { + configFile: path.resolve(this.options.rootDir!, 'tsconfig.json'), + extensions: { + vue: true + } + }, logger: consola.withScope('nuxt:typescript') - }, options.typeCheck))) + } as TsCheckerOptions, options.typeCheck))) } }) } diff --git a/packages/typescript-build/test/fixture/@types/vue.d.ts b/packages/typescript-build/test/fixture/@types/vue.d.ts new file mode 100644 index 00000000..d9f24faa --- /dev/null +++ b/packages/typescript-build/test/fixture/@types/vue.d.ts @@ -0,0 +1,4 @@ +declare module '*.vue' { + import Vue from 'vue' + export default Vue +} diff --git a/packages/typescript-build/test/fixture/tsconfig.json b/packages/typescript-build/test/fixture/tsconfig.json index caa0cba5..d6c7723d 100644 --- a/packages/typescript-build/test/fixture/tsconfig.json +++ b/packages/typescript-build/test/fixture/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { - "target": "es2018", - "module": "esnext", - "moduleResolution": "node", + "target": "ES2018", + "module": "ESNext", + "moduleResolution": "Node", "lib": [ - "esnext", - "esnext.asynciterable", - "dom" + "ESNext", + "ESNext.AsyncIterable", + "DOM" ], "esModuleInterop": true, "allowJs": true, diff --git a/yarn.lock b/yarn.lock index 4e9a2f58..adde9ac9 100644 --- a/yarn.lock +++ b/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== @@ -6241,18 +6241,21 @@ 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.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-4.1.6.tgz#5055c703febcf37fa06405d400c122b905167fc5" - integrity sha512-DUxuQaKoqfNne8iikd14SAkh5uw4+8vNifp6gmA73yYNS6ywLIWSLD/n/mBzHQRpW3J7rbATEakmiA8JvkTyZw== +fork-ts-checker-webpack-plugin@^5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-5.0.6.tgz#02af713af02e47b338a3992279209bc65d34c773" + integrity sha512-8h4S7WANr69Resw+tMd5U23xdbVPsT+VOeMKQhUaKhkGeMm0fNf7ObJPP81WG+tsmy4LK4ayIf0JXBY+hy6vMw== dependencies: - "@babel/code-frame" "^7.5.5" + "@babel/code-frame" "^7.8.3" chalk "^2.4.1" - micromatch "^3.1.10" + cosmiconfig "^6.0.0" + deepmerge "^4.2.2" + fs-extra "^9.0.0" + memfs "^3.1.2" minimatch "^3.0.4" + schema-utils "1.0.0" semver "^5.6.0" tapable "^1.0.0" - worker-rpc "^0.1.0" form-data@~2.3.2: version "2.3.3" @@ -6321,6 +6324,11 @@ fs-minipass@^2.0.0: dependencies: minipass "^3.0.0" +fs-monkey@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.1.tgz#4a82f36944365e619f4454d9fff106553067b781" + integrity sha512-fcSa+wyTqZa46iWweI7/ZiUfegOZl0SG8+dltIwFXo7+zYU9J9kpS3NB6pZcSlJdhvIwp81Adx2XhZorncxiaA== + 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" @@ -8563,6 +8571,13 @@ mem@^6.0.1: map-age-cleaner "^0.1.3" mimic-fn "^3.0.0" +memfs@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.2.0.tgz#f9438e622b5acd1daa8a4ae160c496fdd1325b26" + integrity sha512-f/xxz2TpdKv6uDn6GtHee8ivFyxwxmPuXatBb1FBwxYNuVpbM3k/Y1Z+vC0mH/dIXXrukYfe3qe5J32Dfjg93A== + 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" @@ -8671,11 +8686,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.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" - integrity sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g== - micromatch@4.x, micromatch@^4.0.0, micromatch@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" @@ -11385,7 +11395,7 @@ saxes@^5.0.0: dependencies: xmlchars "^2.2.0" -schema-utils@^1.0.0: +schema-utils@1.0.0, schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" integrity sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g== @@ -13287,13 +13297,6 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" -worker-rpc@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5" - integrity sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg== - dependencies: - microevent.ts "~0.1.1" - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"