webpack中引入css报错的原因

来源:互联网 发布:淘宝怎么导出库存excel 编辑:程序博客网 时间:2024/06/08 00:20

webpack中引入css报错的原因

webpack版本号2.4.1

引入css
npm install css-loader style-loader

js引入css部分

require(“!style!css!./style.css”);

cmd报错信息

ERROR in ./style.css
Module parse failed: C:\webpack\app\style.css Unexpected token (1:5)
You may need an appropriate loader to handle this file type.
| body {
| background: yellow;
| }
@ ./runoob1.js 1:0-22

正确引入css

require(“!style-loader!css-loader!./style.css”);

1 0
原创粉丝点击