vue
vue copied to clipboard
Vue 2.7+ no longer fails on and report type errors in build and serve commands
Version
2.7.8
Reproduction link
Steps to reproduce
Based from the vuejs-type-bug-demo
root folder:
-
cd ./hello-world-2.6 && npm install && npm run build
-
cd ./hello-world-2.7 && npm install && npm run build
What is expected?
In 2.7 I expect the errors in typing to fail the build as it does in 2.6
What is actually happening?
Succeeding the build without any errors thrown
I noticed this as well after upgrading a project from 2.6.14 to 2.7.8. Type errors seem to be silently ignored by both npm run serve
and npm run build
.
This seems to be a compiler-sfc
issue that causes the ForkTsCheckerWebpackPlugin
to not get the correct script. This pr may solve the issue.
This relies on ts-loader
to fix its compatibility with Vue 2.7.
The latest recommendation, however, is to avoid doing type check as part of the webpack build, and instead using vue-tsc, which also works with Vue 2.7+. You can start it in a separate process in watch mode.
Thanks for your reply. We will try that, but it would be nice if this got mentioned in the upgrade to vue 2.7+, so users can determine if they can spare the extra time invested to setup vue-tsc and disable type checking in webpack during serve and build commands.
I can confirm that this particular problem is fixed in 2.7.11