简体   繁体   English

CSS无法使用Vue Webpack-Simple解析

[英]Css fails to parse using vue webpack-simple

I have created a webpack-simple project as explained here: https://github.com/vuejs-templates/webpack-simple . 我已经创建了一个webpack-simple项目,如下所述: https : //github.com/vuejs-templates/webpack-simple

Next, I installed vue-codemirror ( link ) with npm install vue-codemirror --save . 接下来,我使用npm install vue-codemirror --save安装了vue-codemirror( link )。 In main.js , vue-codemirror is imported and used. main.js ,导入并使用了vue-codemirror。

import CodeMirror from 'vue-codemirror';
Vue.use(CodeMirror);

But, running npm run dev yields errors with all of the codemirrror css. 但是,运行npm run dev在所有codemirrror css中产生错误。 The errors all look like this: 错误都看起来像这样:

ERROR in ./~/codemirror/addon/dialog/dialog.css
Module parse failed: C:\Users\aidan\Code\ludum-dare-37\node_modules\codemirror\addon\dialog\dialog.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .CodeMirror-dialog {
|   position: absolute;
|   left: 0; right: 0;
 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-codemirror/codemirror.vue 99:6-51
 @ ./~/vue-codemirror/codemirror.vue
 @ ./~/vue-codemirror/index.js
 @ ./src/main.js
 @ multi main

I needed to install style-loader 我需要安装样式加载器

npm install style-loader --save-dev

And then add it to webpack.config.js . 然后将其添加到webpack.config.js Specifically, I added the following module rule: 具体来说,我添加了以下模块规则:

{
    test: /\.css$/,
    loader: "style-loader!css-loader"
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM