I want to add babel-plugin-import and babel-plugin-transform-decorators-legacy in the config-overrides.js.
config = injectBabelPlugin(
['transform-decorators-legacy',
'import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }
], config)
config = injectBabelPlugin([
['import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }],
'transform-decorators-legacy',
], config)
These two does not work. Could you please add document?
config = injectBabelPlugin('transform-decorators-legacy',config)
config = injectBabelPlugin(['import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }], config)
This works.
config = injectBabelPlugin(['import', [
{
libraryName: "antd-mobile",
style: true
},
{
libraryName: 'antd',
style: true
}
]], config);
The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins
I have the same error. how can I fix this
The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins
my code is
const {injectBabelPlugin} = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
module.exports = function override(config, env) {
config = injectBabelPlugin(['import', {libraryName: 'antd', style: true}], config);
config = rewireLess.withLoaderOptions({
modifyVars: {
"@layout-body-background": "#FFFFFF",
"@layout-header-background": "#FFFFFF",
"@layout-footer-background": "#FFFFFF"
},
javascriptEnabled: true
})(config, env);
return config;
};
config = injectBabelPlugin(['import', {libraryName: 'antd-mobile', style: 'css'}, 'antd-mobile'], config)
config = injectBabelPlugin(['import', {libraryName: 'antd', style: 'css'}, 'antd'], config)
Most helpful comment
This works.