标签:加载 legacy get inf col localhost 按需加载 write ESS
将.webpackrc 改成.webpackrc.js然后具体配置
const config = {}; config.proxy = { "/api": { "target": "http://localhost:7001", "changeOrigin": true, "pathRewrite": { "^/api": "" } } } config.extraBabelPlugins = [ //antd按需加载引入 ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }], //装饰器语法配置 [ "@babel/plugin-proposal-decorators", { "legacy": true } ] ] export default config;
建个.babelrc
1 { 2 "presets": [ 3 "react-app" 4 ], 5 "plugins": [ 6 [ 7 "import", 8 { 9 "libraryName": "antd", 10 "libraryDirectory": "es", 11 "style": "css" // `style: true` 会加载 less 文件 12 } 13 ], 14 [ 15 "@babel/plugin-proposal-decorators", 16 { 17 "legacy": true 18 } 19 ] 20 ] 21 }
装饰器 语法使用之前 拿antd的包为例子
在dva框架和create-react-app创建出来的框架中修饰器语法与按需加载引入antd分别配置
标签:加载 legacy get inf col localhost 按需加载 write ESS
原文地址:https://www.cnblogs.com/cq1715584439/p/11373000.html