0

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.

infojolt
  • 5,244
  • 3
  • 40
  • 82
  • Have you looked at Angular's seed project? They provide webpack (master) and SystemJS branches that both show development and production methods. On the webpack/master branch, run "npm build". https://github.com/angular/angular2-seed – hotforfeature Jun 07 '16 at 15:35
  • Here is my recipe for using JSPM to get an angular2 app into production: http://stackoverflow.com/a/34616199/3532945 – brando Jun 07 '16 at 20:52

2 Answers2

1

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

ng build --prod
infojolt
  • 5,244
  • 3
  • 40
  • 82
0

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

Gary
  • 821
  • 8
  • 20