- 需要安装[email protected]
- 需要babel-plugin-import
- 扩展react里面的webpack配置,新建config-overrides.js
const {injectBabelPlugin} = require('react-app-rewired'); module.exports = function override(config, env){ config = injectBabelPlugin([ 'import', {libraryName: 'antd', libraryDirectory: 'es', style: 'css'} ], config); return config }
// 以React按需加载antd-design为例
// 这样即可在其他JS直接import { Button } from 'antd'
React 不暴露webpack配置的情况下,修改webpack配置
猜你喜欢
转载自www.cnblogs.com/Xmforever/p/10322149.html
今日推荐
周排行