打包过程
- 连接服务器
ssh root@xx.xx.xx.xx(服务器IP) - 定位到当前项目目录
cd /path/projectName - 更新代码到服务器
git pull - 执行打包命令(这里我创建了一个脚本文件build.sh,直接运行脚本文件)
sh build.sh
脚本文件build.sh
yarn build
yarn pro:clean
cp -rf build/ pro
package.json
"script": {
"buid": "craco build",
"pro: clean": "rimraf ./pro",
...
}
craco.config.js
webpack: {
configure: (webpackConfig, {env,paths})=>{
var buildName = 'build';
webpackConfig.output.path = resolveApp(buildName);
paths.appBuild = resolveApp(buildName);
return webpackConfig;
}
}