0

I'm pretty new to web development. I'm going through angular2 developer guides and now I would like to deploy my app to s3 as a fully static web site.

angular.io docs only show how to run my project using npm.

Currently I have bunch of .ts files and I probably need some tool that will compile them, move everything needed(html, js, css, etc.) to separate directory or create zip with everything inside. Surely I can do this using bash and raw typescript compiler but it doesn't feel like civilised way.


Here is complete, minimal project configured exactly as I wanted it to be: https://github.com/shivanshuag/angular2-seed

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Krever
  • 1,371
  • 1
  • 13
  • 32
  • You can use one of the JavaScript bundling tools, like webpack, jspm, systemjs-builder... However so far I didn't find any foolproof solutions or guides for 'larger' apps, but if your app is simple enough you can find tutorials how to do it... – Sasxa Jan 25 '16 at 07:29
  • This is my recipe for bundling an ng2 web app with JSPM: http://stackoverflow.com/a/34616199/3532945 – brando May 07 '16 at 18:04
  • You can try https://github.com/angular/angular-cli which used SystemJS Builder for bundling – Antony Budianto Jul 10 '16 at 00:58

1 Answers1

1

The simplest answer is to simply use the "outDir": "dist" or whatever to output the compiled files in a different directory.

If you would like minification and bundling, then there are MANY tools out there to choose from. Any JS bundling tool would work, and TypeScript will even output the files in a format that works well for the bundlers.

Angular2's examples use the SystemJS bundler for example, but you actually have many more options to choose from depending on your needs.

SnareChops
  • 13,175
  • 9
  • 69
  • 91
  • Thanks for answer. I have tried webpack but I didn't find it usefull. 1) It depend on putting – Krever Jan 25 '16 at 07:47
  • @Krever you can still make webpack autogenerate index.html for you with all necessary script tags and links: https://www.npmjs.com/package/html-webpack-plugin – dfsq Jan 25 '16 at 07:58