研究了好久好久..為什么呀
ERROR in ./src/app.vue
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <template>
|? ? ?<div id="text">{{text}}</div>
|
?@ ./src/index.js 2:0-27
ERROR in ./src/app.vue
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <template>
|? ? ?<div id="text">{{text}}</div>
|
?@ ./src/index.js 2:0-27
2018-05-29
舉報
2019-02-01
你的test寫的不太對
2018-11-28
2018-06-08
需要貼一下package.json里面webpack版本和vue-loader版本。
2018-06-07
vue-loader版本過高了,語法結構不一樣的,建議換低版本,或者如下面寫法,親測可用
const?path?=?require("path") const?{VueLoaderPlugin?}?=?require("vue-loader") module.exports?=?{ ????entry:?path.join(__dirname,"src/index.js"), ????output:?{ ????????filename:?"bundle.js", ????????path:?path.join(__dirname,"dist") ????}, ????module:?{ ????????rules:?[ ????????????{ ????????????????test:?/.vue$/, ????????????????loader:?'vue-loader' ????????????}, ????????????{ ????????????????test:?/.css$/, ????????????????loader:?'css-loader' ????????????} ????????] ????}, ????plugins:?[ ????????new?VueLoaderPlugin() ????] }2018-05-30
請問這個問題解決了么??怎么解決的??
2018-05-30
提示的意思是解析不了vue文件,需要在webpack.config.js中添加vue-loader來解析vue文件,然后,最新的vue-loader v15版本,必須加上面說的vue-loader的一個插件,去官網看。從官網上搬下來的,針對最新v15版本的vue-loader如下,然后運行,如果還報錯,說識別不了#,可能是不能解析css,需要將css解析部分添上,我這樣做,就可以正常build了
const?VueLoaderPlugin?=?require('vue-loader/lib/plugin') module.exports?=?{ ??module:?{ ????rules:?[ ??????//?...?other?rules ??????{ ????????test:?/\.vue$/, ????????loader:?'vue-loader' ??????} ????] ??}, ??plugins:?[ ????//?make?sure?to?include?the?plugin! ????new?VueLoaderPlugin() ??] } {???????? ????test:?/\.css$/,???????? ????use:[?????????? ????????'style-loader',?????????? ????????'css-loader',???????? ????]????? ?},2018-05-29
你在webpack.config.js里加上?
const?{?VueLoaderPlugin?}?=?require('vue-loader'); 然后在 plugins:?[ ????new?VueLoaderPlugin(), ?? ] 然后再跑跑看