-
-
Notifications
You must be signed in to change notification settings - Fork 433
Vue single file , after add lang="ts",Module build failed: Error: Could not find file: '*.vue'. #505
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
Comments
ts-loader anyway generate error message and sequence ts-loader(target es6) -> babel-loader don't work. Please fix it asap. |
I'm afraid i don't use vue and so can't comment. Perhaps @HerringtonDarkholme can help |
The entry file must be ts, too. That will make building pass.
I just remembered. ts-loader will build all scripts in component by resolving the entry file. So that when vue-loader asks ts-loader for script, ts-loader can find out the matching script and answer vue-loader. However, if entry file is not ts, ts-loader does not have the chance to build script. So webpack cannot find the script. You might ask why not just build the requested component script instead of building all scripts. The answer is TypeScript needs resolve all dependency before emitting and checking. So you have to make the entry file into TypeScript. |
Thanks @HerringtonDarkholme! |
So how to solve this problem? I have similar errors and the entry file is a typescript file. |
If someone would like to contribute a Vue example setup I'll happily add it to our collection of examples. It may help all those struggling folk. Though this may help: vuejs/vue-cli#263 |
Adding {
test: /\.tsx?$/,
include: paths.appSrc,
use: [
{
loader: require.resolve('babel-loader'),
options: {
compact: true,
},
},
{
loader: require.resolve('ts-loader'),
options: {
appendTsSuffixTo: [/\.vue$/],
}
}
],
}, |
Adding appendTsSuffixTo to vue-loader options for ts files fixed my problem: {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
ts: [
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
}
}]
},
options: {
esModule: true
}
}
} |
"vue-loader": "^14.2.1", |
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction,
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
} I set your config in loaders config it's also error, I must to rewrite the loaders will ok but I dont know why should I to cover the default loader option, all config file generate by [email protected] @Lemenxzy 我不清楚为什么,要覆盖vue默认的loader配置呢?(还是中文言简意赅呀!) |
i have a same problem..... |
|
it works, thanks! |
在utils.cssLoaders这个方法的返回里添加也是可以的。3Q |
This is reproduce demo https://github.com/178220709/ts-loader-error
I have a exist vue project(vue2 webpack2 babel), and I want writer TypeScript in new vue file.
So I add some lib ,and use ts-loader .
In one sense, I successe, I can writer ts in *.ts file like this
<script lang="ts" src="./app3.ts"></script>
But if I add lang="ts"
<script type="ts" lang="ts"></script>
Even this is a empty script tag,will show this error:
D:\code\demo\vue\mut-ts-demo\src\pages\ums\test\app.vue is the right path.
this is my webpack config
anyone can help me ?
Thanks!
The text was updated successfully, but these errors were encountered: