React應(yīng)用部署必備: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" }
// 在構(gòu)建腳本中動態(tài)修改 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;