1

项目运行出现该错误提示。
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.
图片描述

图片描述

bigzs 47
2018-05-08 提问

查看全部 2 个回答

3

已采纳

Vue Loader v15 now requires an accompanying webpack plugin to function properly:

// webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
  // ...
  plugins: [
    new VueLoaderPlugin()
  ]
}

推荐答案

4

vue-loader@15.*之后除了必须带有VueLoaderPlugin 之外,还需另外单独配置css-loader。

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

推广链接