"babel": {
    "presets": [
      "react-app"
    ]
  }

  

主要问题是 依赖项的版本问题 以及 配置问题

antd-mobile的按需加载

 

新添加的config-overrides.js(根目录下)

const { injectBabelPlugin } = require('react-app-rewired');
  
module.exports = function override(config, env) {   
    config = injectBabelPlugin(['import', { libraryName: 'antd-mobile', style: 'css' }], config);
    return config;
};

 

package.json

 

injectBabelPlugin 这个方法在 react-app-rewired  2.0 以上的版本里没有

 

 

相关文章:

  • 2021-05-13
  • 2022-12-23
  • 2021-07-08
  • 2021-04-30
  • 2021-07-29
  • 2022-12-23
  • 2020-07-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-08
  • 2021-08-05
  • 2021-11-14
  • 2022-12-23
相关资源
相似解决方案