5

I cloned universal-starter (webpack version) and have it up and running on my local machine using npm start and npm run watch per the instructions

Now stuck after npm run build and attempting to deploy to Azure (and Google Cloud) via the github integration - can't figure out how to set up either to work.

Anyone have a recipe on how to get the webpack bundled files to fire up on an external host with express.js? Do I need to run commands via a CI integration? The files in /dist don't seem to stand on their own.

4

2 回答 2

0

注意:自 Angular 2 以来,情况发生了巨大变化。虽然我现在转向 SSR、docker 和其他各种东西,但最简单的答案是

1) 生产建设 ng build --prod

2)将文件传输到静态网络主机(即,当它只是一个静态站点时,我使用 awscli 连接到 s3 存储桶......我知道使用 SSR,所以我需要使用像 express 这样的节点服务器)

3)服务文件(对于 index.html 的错误和 404 的重定向要求有一些复杂性......当然将两个重定向的状态设置为 200)

4)在前端放置一些东西以提高性能/ ssl / 等。nginx 或 CDN 是有意义的。

于 2018-06-18T04:00:04.513 回答
0

在 Netlify,您可以连接您的 git 存储库并告诉他们您希望他们使用哪些构建命令。如果您指定“dist”目录,那么他们将部署进入那里的任何内容(在他们编译您的应用程序之后)。

编辑:最低层是免费的。Edit2:我与 Netlify 无关。我刚刚在我最近的部署中使用了它们,发现这个过程非常简单。

于 2017-05-10T10:15:34.973 回答