关于发布Angular 2应用程序 [英] About publishing Angular 2 application

查看:60
本文介绍了关于发布Angular 2应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用npm开发了Angular 2应用程序,作为新生,我不知道下面的某些方式.发布时,我使用了 npm publish ,以便它以网络上的npm帐户发布应用程序.所以在这里,有什么方法可以在本地主机上发布我们的应用程序,因为我不想使用npm帐户,而我只需要避免在发布时使用node_modules文件夹?如果有其他方法可以用于在npm以外的本地发布Angular2应用程序,请告诉我.我尝试过.

I have developed an Angular 2 application using npm, As a fresher,I don't know some ways like below. When I publish I used npm publish so that it publish the application in npm account in the web. So here, is there any way to publish our app in the localhost,because I don't want to use npm account and I just need to avoid node_modules folder on publishing ? If any other way,that can be used to publish the Angular2 Application in local other than npm, let me know.I try that.

如果没有npm网络帐户无法发布该应用程序,请告诉我.如果有的话,请原谅.感谢adv:)

If it is not possible to publish the application without npm web account, Kindly let me know please . Excuse mistakes,If any.Thanks in adv :)

推荐答案

npm publish 是要使其他人可以免费使用的库包.

npm publish is to make a library package available to other for free use.

这不是使Web应用程序可用的方法.这称为部署.对于部署,通常需要执行将TS转换为JS并将其组合到单个文件中的构建步骤,以减少浏览器为获取应用程序的所有源文件而需要进行的请求数量.它还可以内联组件HTML和CSS.此构建步骤还可以缩小并处理JS代码,以进一步减少生成的文件大小.

That's not what you use for making a web application available. This is called deployment. For deployment you usually execute a build step that transpiles TS to JS, and combines them into a single file to reduce the number of requests the browser needs to make in order to get all source files of your application. It may also inline component HTML and CSS. This build step can also minify and mangle to JS code to reduce the resulting file size even more.

生成的输出仅可以复制到任何Web服务器能够在本地计算机上或Web托管提供商的某些计算机上提供给浏览器的任何目录.

The resulting output can just be copied to any directory that any web server is able to serve to a browser either on your local machine or at some machine of a web hosting provider.

根据您的设置,可以使用不同的方式来构建应用程序.

There are different ways to build your application depending on your setup.

例如参见如何部署Angular2个使用Typescript开发的应用程序可以投入生产吗?

这篇关于关于发布Angular 2应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆