问答详情
源自:2-1 vue-loader+webpack项目配置

老师帮看看谢谢

https://img.mukewang.com/5ae03e2f0001546812250650.jpg

这个是什么错误呢

提问者:慕前端0336099 2018-04-25 16:37

个回答

  • 慕函数1407489
    2018-04-27 01:38:17
    已采纳

    解决了,webpack.config.js文件修改如下(https://vue-loader.vuejs.org/guide/):


    const path = require('path')

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


    module.exports = {

    mode: 'development',


    entry: './src/index.js',


    output: {

    path: path.resolve(__dirname, 'dist'),

    filename: 'bundle.js'

    },


    module: {

    rules: [

    {

    test: /\.vue$/,

    loader: 'vue-loader'

    },

    // this will apply to both plain .js files

    // AND <script> blocks in vue files

    {

    test: /\.js$/,

    loader: 'babel-loader'

    },

    // this will apply to both plain .css files

    // AND <style> blocks in vue files

    {

    test: /\.css$/,

    use: [

    'vue-style-loader',

    'css-loader'

    ]

    }

    ]

    },

    plugins: [

    // make sure to include the plugin for the magic

    new VueLoaderPlugin()

    ]

    }

    如果提示ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in 'C:\Users\hbs\own\project\vuetest',执行下面命令:npm install babel-loader --save

  • 以梦为马zz3687118
    2018-05-23 00:22:34

    VueLoaderPlugin is not a constructor……

  • 慕函数1407489
    2018-04-27 00:14:48

    出现同样的问题,但不知道怎么解决。

  • 一剑光寒十四州
    2018-04-26 16:34:22

    是缺少一些loader吧

  • Alanrah
    2018-04-25 23:48:03

    图片看不大清楚,不过应该是app.vue的中test这个div ID的一些格式问题。