改造create-react-app配置


改造create-react-app 为webpack

https://segmentfault.com/a/1190000017842689

https://ymbo.github.io/2017/09/06/create-react-app%E9%85%8D%E7%BD%AEwebpack/

扩展create-react-app的webpack配置

https://blog.csdn.net/qq_37860930/article/details/85162024

https://www.lmonkey.com/t/oZBdal0Ep

https://segmentfault.com/q/1010000017794269

https://blog.csdn.net/weixin_39836173/article/details/86110011

webpack4+react-app-rewired2.x实战

https://blog.csdn.net/u014744118/article/details/88783119

react:customize-cra修改webpack配置

https://blog.csdn.net/w440149517/article/details/113849376

https://www.cnblogs.com/Andy1982/p/13922716.html

https://www.jianshu.com/p/f63069aa74d4

从零搭建项目(7) --- 前端: 打包与环境变量设置

https://www.jianshu.com/p/ae9b23cf02d9

process.env前端环境变量配置教程

https://blog.csdn.net/snsHL9db69ccu1aIKl9r/article/details/110507586

config-overrides.js配置

const { override, addBabelPlugins, fixBabelImports, addWebpackAlias,addPostcssPlugins  } = require('customize-cra');

// 修改打包文件夹名
const path = require('path')
const paths = require('react-scripts/config/paths')
paths.appBuild = path.join(path.dirname(paths.appBuild), 'dist')
// 关闭map文件
process.env.GENERATE_SOURCEMAP = "false";

module.exports = override(
  // plugins配置方法
  ...addBabelPlugins(
    [
      "styled-jsx/babel",
      { "plugins": ["styled-jsx-plugin-sass"] }
    ]
  ),
    // 配置支持@根路径
    addWebpackAlias({
      "@":path.resolve('./src')
    }),
    // 配置px转rem
  addPostcssPlugins([require("postcss-px2rem")({ remUnit: 37.5 })]),
  fixBabelImports('import', {
    libraryName: 'antd-mobile', libraryDirectory: "es", style: 'css'
  })
)