前端微服务架构4-生产环境打包部署补充
生产环境使用同一个ip和端口部署父子应用,所以和本地运行有所区别,
区别1:主应用中子应用的注册:
var apps = [ { name: 'cw-wfw1', entry: '/child1/', //入口文件不同,本地为entry: '//localhost:10001',
container: '#wfw1',
activeRule: '/compliancePromotion', props: { // routerBase: "/compliancePromotion" } }, ];
区别2:子应用配置打包路径vue.config.js
publicPath: '/child1/',
3:nginx配置:打包文件的目录结构为在主应用的dist下添加child1文件夹,子应用的打包文件放在这里
location /child1 { root D://test/dist/; index index.html index.htm; try_files $uri $uri/ /child1/index.html; }