![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
chain-css-loader
Advanced tools
简化在 umi 和 create-react-app 中使用 stylus, 也支持
less
和sass
.(目前支持 css-loader@2)
npm install chain-css-loader --save-dev
instance
UmiRule
UmiRule
UmiRule
UmiRule
UmiRule
static
instance
RewiredRule
RewiredRule
RewiredRule
RewiredRule
RewiredRule
static
new UmiRule
cssPublicPath
默认 '/', css在浏览器中被访问的跟路径cwd
默认 process.cwd()
modulesWithAffix
默认 true, 对 *.module.[ext] 结尾的文件启用 CSS Modulesmodules
默认 false, 只对 *.module.[ext] 结尾的文件启用 CSS Modules; 如果设置为 true, 对所有 *.(css|scss|sass|less|styl(us)?) 启用 CSS ModulessourceMap
默认 true, 是否生成 .map 文件, 只在非开发环境生效compress
默认 true, 是否压缩css, 只在非开发环境生效usePoststylus
默认 false, 是否自行使用 poststylus 插件替换内置 postcss-loaderautoprefixer
browsers
浏览器兼容版本, 建议配置在 .browserslistrc
文件中flexbox
默认 no-2009
compress
压缩css配置
mergeRules
默认 false,normalizeUrl
默认 false,mergeLonghand
默认 false,cssDeclarationSorter
默认 falsestylus
stylus-loader 配置
test
默认 /.styl(us)?$/modules
默认 /.module.styl(us)?$/loader
默认 'stylus-loader'options
stylus 配置参数ssr
跟 umijs 保持一致npm install stylus stylus-loader --save-dev
.umirc.js
import { UmiRule } from 'chain-css-loader';
export default {
urlLoaderExcludes: [
/\.styl$/,
],
chainWebpack(config) {
const rule = new UmiRule(config, {
modules: true // start up CSS modules
});
rule.useStylus();
return config;
}
}
npm install poststylus postcss-flexbugs-fixes autoprefixer rucksack-css --save-dev
.umirc.js
import poststylus from 'poststylus';
import { UmiRule } from 'chain-css-loader';
export default {
urlLoaderExcludes: [
/\.styl$/,
],
chainWebpack(config) {
const rule = new UmiRule(config, {
modules: true,
usePoststylus: true,
stylus: {
options: {
use: [
poststylus([
require('postcss-flexbugs-fixes'),
require('autoprefixer')({
flexbox: 'no-2009'
}),
'rucksack-css'
])
]
}
}
});
rule.useStylus();
return config;
}
}
umijs
时可能报 browserslist 相关警告,需要添加以下代码至 .browserslistrc
>1%
last 4 versions
Firefox ESR
not ie < 9
npm install stylus stylus-loader --save-dev
config-overrides.js
, 前提是使用了react-app-rewired
模块, 而不是导出webpack配置const { RewiredRule } = require('chain-css-loader');
module.exports = {
webpack(config, env) {
const rule = new RewiredRule(config, {
modules: true
});
rule.useStylus();
return config;
}
};
npm install poststylus postcss-flexbugs-fixes autoprefixer rucksack-css --save-dev
config-overrides.js
const poststylus = require('poststylus');
const { RewiredRule } = require('chain-css-loader');
module.exports = {
webpack(config, env) {
const rule = new RewiredRule(config, {
modules: true,
usePoststylus: true,
stylus: {
options: {
use: [
poststylus([
require('postcss-flexbugs-fixes'),
require('autoprefixer')({
flexbox: 'no-2009'
}),
'rucksack-css'
])
]
}
}
});
rule.useStylus();
return config;
}
};
1.1.3
lodash
1.1.2
css-loader
传参问题1.1.1
1.1.0
create-react-app
脚手架中使用stylus
、less
、sass
等1.0.0
umi
项目中使用stylus
等FAQs
Easy to use stylus less or sass in umi or create-react-app.
The npm package chain-css-loader receives a total of 5 weekly downloads. As such, chain-css-loader popularity was classified as not popular.
We found that chain-css-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.