ERROR in ./src/index.js 1:16 Module parse failed: Unexpected token (1:16)
ERROR in ./src/index.js 1:16
Module parse failed: Unexpected token (1:16)
You may need an appropriate loader to handle this file type.
> import Vue from vue;
| import App from './app.vue';
|
2018-09-14
我找到了答案,分享給大家。
只要修改webpack.config.js就可以打包了。
const path = require('path');? ?
const {VueLoaderPlugin}=require('vue-loader');??
????module.exports = {
????????entry: path.resolve(__dirname, "src/index.js"),? ?//webpack4官方絕對(duì)路徑
????devServer: {
????????contentBase: './dist'
????},
????output: {
????filename: 'bundle.js',
????????path: path.resolve(__dirname, 'dist')
????},
????module: {
????rules: [
????????{
test: /\.vue$/,
use: [
'vue-loader'????????
]
},
{
test: /\.css$/,
use: [
'vue-style-loader',????????????????//可以不要
'style-loader',????????????????????????
'css-loader'
]
},
]
},
plugins:[
new VueLoaderPlugin()
]
};
2018-09-11
誰能幫忙看下啊