Search code examples
angularsystemjs

Using systemjs-builder to produce production Angular2 sfx


I'm using systemjs-builder to produce an sfx package for the production build of my Angular2 client app (2.0.0).

I want to include code inside my main.ts file to include a call to Angular2's enableProdMode() within the compiled sfx file, but I don't want to include the call when I'm running in development mode and using the uncompiled source.

I feel like there must be something supported along the lines of

if (environment === 'production') enableProdMode();

I just need a way to tell systemjs-builder, as part of the build process, to set

var environment = 'production'

The project is aspnetcore in vs2015 - the only time i'm using node is to run npm, gulp and systemjs-builder.


Solution

  • Trying to follow up on my old questions. This ended up being a non-issue once I got into AoT... That uses a different entry point (main-aot.ts) which can enableProdMode() vice the development entry point which doesn't. – Kudoz just now edit