这是我webpack.config.js
文件的相关部分:
module: {
loaders: [
{
test: /\.css$/,
exclude: /node_modules/,
loaders: [
"style-loader?sourceMap",
"css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]"
]
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
}
当我编写自己的 css 并将其与我的React
组件一起使用时,这非常有用。但是,我最近尝试使用React Datepicker,它带有自己的 css 文件,可以导入到使用 React Datepicker 的组件中。
如何修改我webpack.config.js
的文件,以便我导入的 React Datepicker css 文件不会被具有本地类名的 CSS 模块转换?换句话说,是否可以配置 webpack 以便将 3rd 方样式导入全局范围,并将我自己的样式导入本地范围?
另外,如果我想编写自己的自定义样式来覆盖 React Datepicker 样式,我将如何做才能使这些样式也处于全局范围内?