From dd259c2f9dddcee2666fc8abca3626b10a709b73 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Sun, 9 Feb 2020 20:10:33 +0100 Subject: [PATCH] fix: do not use fork-ts-checker-webpack-plugin for vue-next As the `fork-ts-checker-webpack-plugin` tries to load the compiler, it does not play well at the moment with the vue-next compiler `@vue/compiler-sfc`. This disables the plugin if we are building a vue-next project. --- packages/@vue/cli-plugin-typescript/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/@vue/cli-plugin-typescript/index.js b/packages/@vue/cli-plugin-typescript/index.js index be65dff5b7..015af62d3b 100644 --- a/packages/@vue/cli-plugin-typescript/index.js +++ b/packages/@vue/cli-plugin-typescript/index.js @@ -76,9 +76,17 @@ module.exports = (api, projectOptions) => { return options }) - if (!process.env.VUE_CLI_TEST) { + let isUsingNextCompiler = true + try { + require('@vue/compiler-sfc') + } catch (e) { + isUsingNextCompiler = false + } + if (!process.env.VUE_CLI_TEST && !isUsingNextCompiler) { // this plugin does not play well with jest + cypress setup (tsPluginE2e.spec.js) somehow // so temporarily disabled for vue-cli tests + // it also does not play well with `@vue/compiler-sfc` + // so we also disable it if the project is built with Vue 3 config .plugin('fork-ts-checker') .use(require('fork-ts-checker-webpack-plugin'), [{