addLessLoader 生产模式 打包出的css 未压缩
Jarryxin opened this issue · comments
addLessLoader({
javascriptEnabled: true,
modifyVars: { '@brand-primary': 'hotpink', "@brand-primary-tap": 'pink' }, // 修改主题
}),
{
"react-scripts": "3.4.1",
"style-loader": "^1.2.1",
"react-app-rewired": "^2.1.6",
"px2rem-loader": "^0.1.9",
"less-loader": "^5.0.0",
"less": "^3.12.2",
"customize-cra": "^0.9.1",
"css-loader": "^3.6.0",
}
I have compile errors with lessLoader as well when trying use Antd design css works fine but less just breaks build.
"less": "^3.12.2",
"less-loader": "^6.2.0",
"react-app-rewired": "2.1.6",
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
lessOptions: {
javascriptEnabled: true,
modifyVars: { '@primary-color': '#A80000' },
},
})
Failed to compile.
./node_modules/antd/es/style/index.less
TypeError: this[MODULE_TYPE] is not a function
I have compile errors with lessLoader as well when trying use Antd design css works fine but less just breaks build.
"less": "^3.12.2", "less-loader": "^6.2.0", "react-app-rewired": "2.1.6",
fixBabelImports('import', { libraryName: 'antd', libraryDirectory: 'es', style: true, }), addLessLoader({ lessOptions: { javascriptEnabled: true, modifyVars: { '@primary-color': '#A80000' }, }, })
Failed to compile.
./node_modules/antd/es/style/index.less
TypeError: this[MODULE_TYPE] is not a function
hi~
down package version
install "customize-cra": "^0.9.1",
use
addLessLoader({ javascriptEnabled: true, modifyVars: { '@brand-primary': 'hotpink', "@brand-primary-tap": 'pink' }, // 修改主题 }),