博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ant design样式不生效,在使用了css modules
阅读量:5137 次
发布时间:2019-06-13

本文共 1379 字,大约阅读时间需要 4 分钟。

还是在create-react-app的情况下配置的webpack

{
test: /\.css$/,
use: [
require.resolve("style-loader"),
{
loader: require.resolve("css-loader"),
options: {
importLoaders: 1
}
},
{
loader: require.resolve("postcss-loader"),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: "postcss",
plugins: () => [
require("postcss-flexbugs-fixes"),
autoprefixer({
browsers: [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 9" // React doesn't support IE8 anyway
],
flexbox: "no-2009"
})
]
}
}
]
},
{
test: /\.css$/,
exclude: path.resolve(__dirname, "./node_modules"),
use: [
require.resolve("style-loader"),
{
loader: require.resolve("css-loader"),
options: {
importLoaders: 1,
modules: true,
localIdentName: "[path][name]__[local]--[hash:base64:5]",
getLocalIndet: (
context,
localIdentName,
localName,
options
) => {
return "whatever_random_class_name";
}
}
},
{
loader: require.resolve("postcss-loader"),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: "postcss",
plugins: () => [
require("postcss-flexbugs-fixes"),
autoprefixer({
browsers: [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 9" // React doesn't support IE8 anyway
],
flexbox: "no-2009"
})
]
}
}
]
}
 
顺序不能颠倒

转载于:https://www.cnblogs.com/drizzle-wen/p/8385911.html

你可能感兴趣的文章
kubernetes_book
查看>>
Linux下串口通信工具minicom的用法
查看>>
使用SWIG轻松编写Python扩展
查看>>
Redis 常用数据结构命令
查看>>
Tomcat之session解决方案
查看>>
缓冲区溢出漏洞实验
查看>>
Linux命令之bc - 浮点计算器、进制转换
查看>>
查看Linux系统信息命令
查看>>
CentOS查看主板型号、CPU、显卡、硬盘等信息
查看>>
Jenkins的Publish Over FTP Plugin插件参数使用
查看>>
Zend Guard Run-time support missing问题的解决
查看>>
Python 相对导入attempted relative import beyond top-level package
查看>>
【scala】IO
查看>>
Altium 快捷键
查看>>
【oracle】oracle的ed命令
查看>>
软件工程课堂作业
查看>>
OpenFire 的安装和配置
查看>>
web.config详解
查看>>
ZJOI2018游记Round1
查看>>
侧边栏广告和回到顶部
查看>>