美文网首页Vue
Module parse failed: Unexpected

Module parse failed: Unexpected

作者: 蜗牛_Cy | 来源:发表于2018-11-19 16:38 被阅读0次

    vue项目运行出现该错误提示

    ERROR in ./src/App.vue?vue&type=style&index=0&lang=css
    Module parse failed: Unexpected character '#' (26:0)
    You may need an appropriate loader to handle this file type.


    图片.png

    解决

    vue-loader@15.*之后必须带有VueLoaderPlugin 并单独配置css-loader。

    const VueLoaderPlugin = require('vue-loader/lib/plugin')
    
    const VueLoaderPlugin = require('vue-loader/lib/plugin')
    
    module.exports = {
      // ...
      module: {
        rules: [
          {
            test: /\.vue$/,
            loader: 'vue-loader'
          },
          {
            test: /\.css$/,
            use: ['style-loader','css-loader']
          }
        ]
      }
      plugins: [
        new VueLoaderPlugin()
      ]
    }
    

    相关文章

      网友评论

        本文标题:Module parse failed: Unexpected

        本文链接:https://www.haomeiwen.com/subject/lijafqtx.html