Open shameleo opened 3 years ago
https://www.typescriptlang.org/tsconfig#include
If a glob pattern doesn’t include a file extension, then only files with supported extensions are included (e.g. .ts, .tsx, and .d.ts by default, with .js and .jsx if allowJs is set to true).
@LinusBorg, I didn't get it. Page.vue
is missing in tsconfig include? Shouldn't appendTsSuffixTo: [/\.vue$/]
line in ts-loader options fix it? Anyway, I tried my best to include this file. Like:
"include": ["src/**/*.ts", "src/**/*.vue"]
"include": ["src/**/*.+(ts,vue)"]
"include": ["src/**/*.{ts,vue}"]
"files": ["src/index.ts", "src/Page.vue", "src/shims-vue.d.ts"]
None of this works
And it worked with previous versions of vue-loader
, after all.
Looks similar to https://github.com/vuejs/vue-loader/issues/1882
I could not get this to work with a tsconfig that worked well in other contexts. There might be an order problem, as any changes during Webpack watch (e.g. changing some text in the .vue file) make Webpack work after it initially reported an error.
Updating ts-loader to 9.2.6 properly resolved this for me. In fact any of the 9.x versions seems to work.
我也遇到了相关问题,但是webpack运行没有问题,打包就会失败,偶尔成功。TS2345: Argument of type '{ new (): { $props: VNodeProps; }; __isFragment: true; }' is not assignable to parameter of type 'string'. 求解
~Updating ts-loader
to 9.x.x indeed solves the issue with sample project, but now I have error in original project same as HelloHxz mentioned. (only if I'm updating vue-loader
as well). This blocks me from updating vue-loader
and using script setup feature. We still need fix.~
My bad, of course I should have tried update @vue/compiler-sfc
and vue
as well. Seems to work fine now.
Version
16.6.0 and later
Reproduction link
github.com
Steps to reproduce
What is expected?
No errors
What is actually happening?
Module '"...Page.vue"' has no default export
Maybe it has something to do with
shims-vue.d.ts
file content. To be honest I don't quite understand things like this yet.