简体   繁体   English

angular-cli build,在单独的服务器上部署块

[英]angular-cli build, deploy chunks on a separate server

I run 'ng build --prod' and i get 3 chunks generated, for 3 lazy loaded modules. 我运行'ng build --prod',我为3个延迟加载的模块生成了3个块。

suppose i want to host those 3 chunks on a different webserver than the rest of the application. 假设我想在不同的网络服务器上托管这3个块而不是应用程序的其余部分。 Is there a way in webpack to configure this ? 在webpack中有没有办法配置它?

You will need to copy the bundled js files in a html page and host the web-page on a webserver, for eg: 您需要在html页面中复制捆绑的js文件,并在Web服务器上托管网页,例如:

<html>
<head></head>
<body>
    <div>
    I'm externally loaded angular project
     </div>

 <script src="~inline.bundle.js"></script>
 <script src="~vendor.bundle.js"></script>
 <script src="~main.bundle.js"></script>

</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM