React应用部署必备:homepage配置在package.json中的5种高阶用法
{ "homepage": "https://example.com/my-app" }
{ "homepage": "https://${REACT_APP_REGION}.examplecdn.com/dashboard" }
"homepage": ".", "scripts": { "start": "PUBLIC_URL=https://localhost:3000/subpath react-scripts start" }
"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build -r [email protected]:username/repo.git" }
// 在构建脚本中动态修改 const homepage = process.env.DEPLOY_ENV === 'prod' ? 'https://example.com' : 'http://test.example.com';
webpack_public_path = window.POWERED_BY_QIANKUN
? ${window.publicPath}sub-app/
: process.env.PUBLIC_URL;