Webpack你可能需要一个合适的加载器来处理这个文件类型,带有sue

时间:2018-06-12 16:58:49

标签: webpack vue.js css-loader vue-loader

我使用Webpack创建了我的项目并在开发中使用了Vue.js,但我无法在Vue模板中注入Module parse failed: Unexpected token (18:5) You may need an appropriate loader to handle this file type. | | > body { | background-color: red; | }

它让我

webpack.config.js

这是我的 ... module: { rules: [{ test: /\.vue$/, loader: "vue-loader" }, { test: /\.js$/, loader: "babel-loader", exclude: /node_modules/, options: { presets: ["@babel/preset-env"] } }, ] },

App.vue

以及我的<template> <div id="app"> <counter></counter> </div> </template> <script> import Counter from "./app/Counter.vue"; export default { name: "app", components: { counter: Counter } }; </script> <style> body { background-color: red; } </style>

>>> import pandas as pd
>>> df = pd.DataFrame([['a','a','b','b'],[6,7,8,9]]).T
>>> df
   A  B
0  a  6
1  a  7
2  b  8
3  b  9

1 个答案:

答案 0 :(得分:14)

有同样的问题。查看vue-loader css的文档也需要规则。

安装包vue-style-loadercss-loader

将以下内容添加到rules中的webpack.config.js部分:

  {
    test: /\.css$/,
    use: [
      'vue-style-loader',
      'css-loader'
    ]
  },