infojolt
infojolt

Reputation: 5408

Correct process for deploying Angular 2 application into production

I have followed a couple of tutorials regarding the development of Angular 2 applications, but none of them discuss what to do once development is complete.

I have created an application with Typescript and SystemJS, but what are the steps to produce a production-ready package?

My current approach is to check out the files to a new location (without the node_modules folders) and run npm install --production then remove the typescript files. I realise this is a horrible way to produce a production-ready package and doesn't contain any minification. I am not familiar with Webpack, SystemJS, gulp, grunt etc... and am looking for pointers in the recommended direction.

Upvotes: 0

Views: 265

Answers (2)

infojolt
infojolt

Reputation: 5408

Time has passed since I asked this question and the Angular CLI now solves this problem:

ng build --prod

Upvotes: 1

Gary
Gary

Reputation: 831

At ng-conf this year, Rob Wormald and Misko presented what looks to be the upcoming official way to deploy applications. There's a new offline compiler that preprocesses your app so the user's browser doesn't need to.

The offline compiler inlines all the ES6/ES2015 modules into one file, and then rollup is used to perform tree-shaking (remove all but what is actually being used). The result can then be pumped into a minifier to get very small application packages that start 'ridiculously quickly' (that's how Rob described it).

See the demo here. https://youtu.be/bSssb9AmiJU?t=25m47s

Upvotes: 0

Related Questions