運行npm run build報錯
ERROR in ./src/app.vue?vue&type=style&index=0&lang=css
Module parse failed: Unexpected character '#' (16:0)
You may need an appropriate loader to handle this file type.
|
|
| #test{
| ? ? color: red;
| }
?@ ./src/app.vue 4:0-62
?@ ./src/index.js
ERROR in ./src/app.vue?vue&type=template&id=bced26ea
Module parse failed: Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
|
| <div id="test">{{test}}</div>
|
?@ ./src/app.vue 1:0-81 11:2-8 12:2-17
?@ ./src/index.js
ERROR in ./src/app.vue
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/index.js 2:0-28 8:19-22
ERROR in ./src/app.vue?vue&type=template&id=bced26ea
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/app.vue 1:0-81 11:2-8 12:2-17
?@ ./src/index.js
ERROR in ./src/app.vue?vue&type=script&lang=js
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/app.vue 2:0-54 3:0-49 3:0-49 10:2-8
?@ ./src/index.js
ERROR in ./src/app.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/app.vue 4:0-62
?@ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --config webpack.config.js --mode production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! ? ? C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-05-14T08_01_24_420Z-debug.log
D:\wxq\myPro\elm\webtest>
2018-05-14
補充一下,我剛看了一下vue-loader的文檔
應該是vue-loader的版本從14.x開始就需要這樣做了,與webpack版本沒什么關系
```
```
文檔地址:https://vue-loader.vuejs.org/guide/
2018-05-14
有這個錯誤,想來你的webpack版本應該是4.x,看時間應該是4.8的版本
解決辦法
在webpack的baseconfig里面
先引入vue-loader的plugin
const VueLoaderPlugin = require('vue-loader/lib/plugin')
然后在
plugins: [
????new VueLoaderPlugin()
]