I set up the project according to the above steps,npm run build时报错,I change the ts-loader ,the erros still have ,but different
errors:
ERROR in ./src/components/Hello.vue?vue&type=script&lang=ts
Module parse failed: Unexpected token (28:26)
You may need an appropriate loader to handle this file type.
| },
| computed: {
| exclamationMarks(): string {
| return Array(this.enthusiasm + 1).join('!');
| }
@ ./src/components/Hello.vue 2:0-56 3:0-51 3:0-51 10:2-8
@ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=template&id=5de655f2
Module parse failed: Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
|
|
ERROR in ./src/components/Hello.vue?vue&type=style&index=0&lang=css
Module parse failed: Unexpected token (36:0)
You may need an appropriate loader to handle this file type.
ERROR in ./src/components/Hello.vue
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/index.ts 2:0-52 8:24-38
ERROR in ./src/components/Hello.vue?vue&type=template&id=5de655f2
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/components/Hello.vue 1:0-83 11:2-8 12:2-17
@ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=script&lang=ts
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/components/Hello.vue 2:0-56 3:0-51 3:0-51 10:2-8
@ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=style&index=0&lang=css
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/components/Hello.vue 4:0-64
@ ./src/index.ts
ERROR in ./src/components/Hello.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/index.ts 2:0-52 10:24-38
i also met this problem, i solved this problem like this:
// webpack.config.js
I set up the project according to the above steps,npm run build时报错,I change the ts-loader ,the erros still have ,but different errors: ERROR in ./src/components/Hello.vue?vue&type=script&lang=ts Module parse failed: Unexpected token (28:26) You may need an appropriate loader to handle this file type. | }, | computed: { | exclamationMarks(): string { | return Array(this.enthusiasm + 1).join('!'); | } @ ./src/components/Hello.vue 2:0-56 3:0-51 3:0-51 10:2-8 @ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=template&id=5de655f2 Module parse failed: Unexpected token (2:0) You may need an appropriate loader to handle this file type. | |
@ ./src/components/Hello.vue 4:0-64 @ ./src/index.ts
ERROR in ./src/components/Hello.vue vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/index.ts 2:0-52 8:24-38
ERROR in ./src/components/Hello.vue?vue&type=template&id=5de655f2 vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/components/Hello.vue 1:0-83 11:2-8 12:2-17 @ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=script&lang=ts vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/components/Hello.vue 2:0-56 3:0-51 3:0-51 10:2-8 @ ./src/index.ts
ERROR in ./src/components/Hello.vue?vue&type=style&index=0&lang=css vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/components/Hello.vue 4:0-64 @ ./src/index.ts
Reverting vue-loader to ^14.2.2 fixes the issue
@okaxuan so it's the vue-loader version problem? I ran into the same error according to the README guide.
vue-loader version has been updated. Accordding to PR #47 could solve the problem.
@BoleLee - thank you for the heads up. That resolved the problem for me, using https://github.com/runxc1/TypeScript-Vue-Starter/blob/392263c54dfab629c69722a3e808fb5267851076/README.md instead of https://github.com/Microsoft/TypeScript-Vue-Starter#adding-webpack
ERROR in ./src/components/Hello.vue Module Error (from ./node_modules/vue-loader/lib/index.js): vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/index.ts 2:0-52 10:24-38
i also met this problem, i solved this problem like this: // webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin'); module.exports = { // ... plugins: [ new VueLoaderPlugin() ] }
vue-loader
@thomthom @stone-lyl thanks