Use Environment variables without Angular CLI

313 views Asked by At

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.

1

There are 1 answers

1
Aj1 On

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