【发布时间】:2016-05-13 21:27:09
【问题描述】:
我使用 webpack 从节点模块 onsenui 加载一个 css 文件:
require('onsenui/css/onsenui.css');
require('onsenui/css/onsen-css-components.css');
文件 onsenui/css/onsenui.css 确实导入了相关的 css 文件:
@import url("font_awesome/css/font-awesome.min.css");
@import url("ionicons/css/ionicons.min.css");
@import url("material-design-iconic-font/css/material-design-iconic-font.min.css");
使用 webpack 配置如下:
module: {
loaders: [
{
test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
include: __dirname
},
{
test: /\.css?$/,
loaders: [ 'style', 'css'],
include: __dirname
}
]
}
但我的浏览器出现以下错误:
http://localhost:9001/font_awesome/css/font-awesome.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9001/material-design-iconic-font/css/material-design-iconic-font.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9001/ionicons/css/ionicons.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
css-loader 不处理@import 语句吗?我应该如何解决@import url(...) stagements 的加载问题?我可以从 node_modules 重写 css 文件...
【问题讨论】:
标签: webpack