-2

I am not using cli in my project. It is using system js builder to bundle stuff and node lite serve to serve contents. I am trying figure out if there is a way I can use environment variables in my project just like a regular cli project.

like

npm build --prod | dev | test

Here are my build steps:

npm build

which runs

node build.js

which contains systemjs build steps.

var Builder = require('systemjs-builder');

// optional constructor options
// sets the baseURL and loads the configuration file
var builder = new Builder('./', './systemjs.config.js',{ });

builder.buildStatic('./src/main.js', './dist/app.js', { minify: true, sourceMaps: true });

It is a bit hard to change project to cli. Really appreciate any help.

Aj1
  • 953
  • 2
  • 15
  • 42
  • I've converted apps from systemjs to the CLI several times and (unless you have a complex bulid process) it isn't too bad. Just use the CLI to build the shell of your project. Then install any additional external libraries. Then copy your code into the app folder. Over time, you'll be really glad you did. – DeborahK Aug 02 '18 at 20:57

1 Answers1

0

Figured it. Using a gulp task to replace the string I want to in the environment file.

Aj1
  • 953
  • 2
  • 15
  • 42