鍍金池/ 問答/HTML5  HTML/ Module parse failed: Unexpected characte

Module parse failed: Unexpected character '#'

項(xiàng)目運(yùn)行出現(xiàn)該錯誤提示。
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.
圖片描述

圖片描述

回答
編輯回答
骨殘心

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()
  ]
}
2018年5月26日 21:33
編輯回答
遺莣

vue-loader@15.*之后除了必須帶有VueLoaderPlugin 之外,還需另外單獨(dú)配置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()
  ]
}
2017年9月14日 11:03