About publishing an Angular 2 application

I developed an Angular 2 application using npm, as more recent, I do not know some ways, as shown below. When I publish, I used npm publishto publish the application to an npm account on the Internet. So, is there a way to publish our application in localhost because I don't want to use an npm account and I just need to avoid the node_modules folder when publishing? If there is any other way that you can use to publish your Angular2 application locally other than npm, let me know. I am trying to do this.

If you cannot publish the application without an npm web account, please let me know. Sorry if any errors. Thanks in adv :)

+2
source share
3 answers

npm publish is to make the library package available to another for free use.

This is not what you use to build your web application. This is called deployment. For deployment, you usually complete the build step, which translates TS into JS and combines them into a single file to reduce the number of requests that the browser needs to make in order to get all the source files for your application. It can also embed an HTML and CSS component. This build step can also minimize and cripple JS code to further reduce the resulting file size.

, - , - -.

.

. Angular 2, Typescript ?

+6

,

js , html, node require(),

, , , , , js

node

npm install -g browserify

, main.js

browserify main.js -o bundle.js

script html

<script src="bundle.js"></script>
+1

, node_modules transpilers typescript . node_modules.

, Plnkr jsFiddle

, cdn node_modules .

.

, .

0

Source: https://habr.com/ru/post/1655641/


All Articles