[英]Run Angular 5 app as static website in browser without any server
I have requirement to run Angular 5 application in browser by opening index.html file in browser manually. 我要求通过在浏览器中手动打开index.html文件在浏览器中运行Angular 5应用程序。 My client does not have any server.
我的客户端没有任何服务器。 He just want me to send him a package(dist folder) and simply double click on index.html file to run the application as a website in the browser.
他只希望我向他发送一个软件包(dist文件夹),然后只需双击index.html文件即可在浏览器中将其作为网站运行。
I am done with ng build --prod --base-href ./
and i have files in my dist folder. 我已经完成了
ng build --prod --base-href ./
并且我的dist文件夹中有文件。 I can't use any server Node/IIS because I can't ask my client to do install these servers as a prerequisite. 我不能使用任何服务器Node / IIS,因为我不能要求客户端安装这些服务器作为先决条件。
There is no way to do that. 没有办法做到这一点。 But you can install http-server packge on client's machine and just run http-server dist/ in your prod build directory.
但是,您可以在客户端计算机上安装http-server packge,然后仅在产品构建目录中运行http-server dist /。
npm install -g http-server
http-server dist/
hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.