Looks like src attribute on <script> block in Vue SFC is not handled by fork-ts-checker-webpack-plugin. For example, if we process the following .vue file:
<template>
<h1>hi</h1>
</template>
<script lang="ts" src="./App.ts"></script>
It produces like the following error:
ERROR in **/src/main.ts
(2,17): File '**/src/App.vue' is not a module.
The complete reproduction is here.
FYI, if I only use ts-loader with type checking, it successfully compiled without errors.
original issue: https://github.com/vuejs/vue-cli/issues/1104
@ktsn could you expand on your work around with ts-loader?
I would really like to use the latest vue-cli with minimal modifications to make it easy to manage moving forward.
@rodhoward I just removed ForkTsCheckerWebpackPlugin from webpack config and transpileOnly option of ts-loader. If you would like to work around with vue-cli plugin, you can modify webpack config on vue.config.js https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md#basic-configuration
I imagine it doesn't work with the fork-ts-checker-webpack-plugin is down to ts-loader not having appendTsSuffixTo functionality.
I imagine it could be ported across if someone was up for it.
Got the same issue myself, any progress on this?
Webpack modifications worked for me too as suitable workaround for now. For vue-cli 3, I added the following to vue.config.js:
module.exports = {
// ...
chainWebpack: config => {
config.plugins.delete('fork-ts-checker');
config.module
.rule('ts')
.use('ts-loader')
.tap(options => { return {...options, 'transpileOnly': false }});
}
}
cc @prograhammer - our resident Vue expert 馃槃 (he added vue support to this plugin)
I just made a PR to fix this issue #130
Most helpful comment
Webpack modifications worked for me too as suitable workaround for now. For vue-cli 3, I added the following to
vue.config.js: