-
-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check TS inside .vue files #55
Comments
Hi! :)
It looks like there is no .vue files in getSourceFiles() result. It may be invalid tsconfig.json file or bug/missing feature in typescript |
vue files are not compiled directly by tsc. ts code extracted from vue by webpack and send to tsc AFAIK. |
Maybe it would help if you shared a repo demonstrating the issue? |
I'd love to, but can't. It's private project. my current webpack.mix.js const mix = require('laravel-mix');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
// docs: https://github.com/JeffreyWay/laravel-mix/tree/master/docs#readme
mix
.ts('resources/assets/js/app.ts', 'public/js')
.extract(['vue', 'vuex', 'jquery', 'axios', 'vue2-dragula', 'element-ui', 'lodash', 'moment', 'vue-class-component'])
.js('resources/assets/js/home.ts', 'public/js')
.less('resources/assets/less/app.less', 'public/css')
.sourceMaps()
;
// run versioning on production only
if (mix.inProduction()) {
mix.version();
}
mix.webpackConfig({
// https://webpack.js.org/configuration/devtool/
// It looks like webpack or vue-loader have a bug :(
// Vue-loader issue opened: https://github.com/vuejs/vue-loader/issues/620
devtool: "cheap-module-source-map",// "cheap-module-eval-source-map", //
module: {
rules: [
{ // TS support: https://sebastiandedeyne.com/posts/2017/typescript-with-laravel-mix
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
// transpileOnly: true
},
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx', '.vue', '.ts', '.tsx'],
}
}); |
I created a repository to reproduce the issue : https://github.com/Toilal/vue-25-typescript git clone, yarn install && yarn dev to run the dev server. It display no error, but it should display a type error because of this line. If I set transpileOnly to false here, the error is properly reported.
|
here's the file list returned by
That's it, |
I've come across slightly related issues with my codebase. The surprising bit is that fork-ts-checker-webpack-plugin appears to gets its list of files purely from the |
@RoystonS - I believe that's intentional. The motivation being getting the fastest performance possible. @piotr-oles can confirm |
Sure, I can see why. It's just surprising. e.g. I spent several hours trying to work out why my files were being compiled correctly, but not type-checked, and it was the difference between the I presume the type checker goes directly back to those source files, for speed? That would mean that it wouldn't be able to access bits of TS extracted from |
As things stand, no.
It's worth saying that this is a general behaviour. I think I'm right in saying that it is specific to |
@RoystonS This behavior is intentional and is described in the readme of the plugin in the "Module resolution" section. I'm sorry that you had to spend a lot of time on this. I will close this issue because it cannot be solved directly in this plugin. |
This actually can be accomplished by overriding default host behavior with Since this issue is closed, I'll we continue conversation in this open issue I see here: #70 |
Is there a way to make it check typescript inside .vue files?
I've tried to use it - and it checks all my .ts files, but don't check TypeScript inside .vue
The text was updated successfully, but these errors were encountered: