Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态加载外部文件 #373

Closed
zhanghj-jacky opened this issue Jun 26, 2017 · 4 comments
Closed

动态加载外部文件 #373

zhanghj-jacky opened this issue Jun 26, 2017 · 4 comments

Comments

@zhanghj-jacky
Copy link

通过npm run build 对项目进行了打包,部署到nginx 代理服务上。

我需要把 项目中访问后端服务器的配置config.js 文件中的 提取出来,进行动态加载?
image

能通过什么好的方式来实现吗?望楼主指点!!!

@zuiidea
Copy link
Owner

zuiidea commented Jun 26, 2017

什么场景下需要这样做

@zhanghj-jacky
Copy link
Author

我们的代码都是放在docker 里面的,這样就方便移动。

這样,我的后端程序,移动了,需要部署在其他的服务器上,那么我的前端程序就需要修改config 文件,然后重新打包,放到docker 里面去。

想问问楼主,如果我的前端可以动态加载文件、参数或者环境变量任何一种方式,我就可以通过把后端服务器的信息,通过文件、参数、或者环境变量的方式 给我的前端,這样就不需要重新打包了?

@zuiidea
Copy link
Owner

zuiidea commented Jun 26, 2017

参考这个 #348

@superlbr
Copy link
Collaborator

superlbr commented Mar 9, 2018

docker玩法多了

  1. docker 构建的时候,可以构建git不同分支
  2. docker run的时候可以注入参数
  3. jenkins pipeline 各种config,拉去后端接口,或修改config,或覆盖

@superlbr superlbr closed this as completed Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants