【发布时间】:2016-10-05 02:43:14
【问题描述】:
这是我原来的 webpack 设置
{ test: /(\.css|\.scss)$/, loaders: ['style', 'css', 'sass']},
如果我想使用 css 模块,我需要将我的设置编辑为
{
test: /\.css$/,
loaders: [
'style?sourceMap',
'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
]
}
但是我遇到了第 3 方包的问题
一个是import 'rc-collapse/assets/index.css';不行
另一个是我有一些类似的css
.Popover-body {
display: inline-flex;
flex-direction: column;
/*padding: 2rem 4rem;*/
/*background: hsl(0, 0%, 27%);*/
background: #B1C5D0;
color: black;
border-radius: 0.3rem;
/*border: 1px;*/
}
在 react-popover 包里,我覆盖了它的 css,但是 css 模块无法读取它
我想是因为我没有写className={styles[Popover-body]}之类的东西
不过是第3方包,不知道在哪加className={styles[Popover-body]}
css 如何同时读取普通 css(loaders: ['style', 'css', 'sass']}) 和 css 模块 (loaders: [
'style?sourceMap',
'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5])??
【问题讨论】: