RollWhisTler
RollWhisTler

Reputation: 341

Use NPM to create a production build of an Angular2 project

I created a project using the Angular2 quickstart https://angular.io/docs/js/latest/quickstart.html

I changed it completely to do my things, some usage of webcams, indexedDB and things like that :-).

The thing right now is that I've been using npm as the site recommends and it feels wrong now just changing to Gulp to create a build, instead of creating a build script on npm.

The next issue is that I've never done such a thing and I'm completely lost... do you know of any build script I could use/adapt? Or should I switch to Gulp?

Thank you

Upvotes: 6

Views: 5952

Answers (2)

lastmjs
lastmjs

Reputation: 1014

Might I suggest my project Zwitterion. Zwitterion is a server that allows you to include TypeScript files directly in the browser, and will automatically transpile all imported modules in your application. To do a production build, you run Zwitterion with the --build-static command. It's extremely simple, and if you'd like to learn more check out the article or the GitHub repo.

Upvotes: 0

Gab
Gab

Reputation: 1017

I see, now I think I understand where the misunderstanding is. The link you provided is for Angular2 using Javascript. The best way to create a production Angular2 build is to use Typescript (and I believe it's the only officially supported way at this point as well). Here is a link to the tutorial using Typescript. If you don't know what that is, here's a SO question on it.

Once you learn how to use Angular2 with Typescript, I recommend reading this article on Angular2 in production.

Also, they are currently working on a command-line interface that will automatically build your app for production. They've released it but it's buggy at this point.

Upvotes: 3

Related Questions