为了账号安全,请及时绑定邮箱和手机立即绑定

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';

|


正在回答

2 回答

我找到了答案,分享给大家。

只要修改webpack.config.js就可以打包了。

const path = require('path');   

const {VueLoaderPlugin}=require('vue-loader');  


    module.exports = {

        entry: path.resolve(__dirname, "src/index.js"),   //webpack4官方绝对路径

    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()

]

};


1 回复 有任何疑惑可以回复我~

https://img1.sycdn.imooc.com//5b977efa0001ba6604750118.jpg

谁能帮忙看下啊

0 回复 有任何疑惑可以回复我~
#1

切克闹_

我和你是一样的问题。。咋整的?
2018-11-26 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

ERROR in ./src/index.js 1:16 Module parse failed: Unexpected token (1:16)

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信