Skip to content

Commit

Permalink
fix(build): fix issue in build-utils with environment. Environment fi…
Browse files Browse the repository at this point in the history
…le was not replaced as it should.

ISSUES CLOSED: #439
  • Loading branch information
ageorges-nbb committed Jun 15, 2018
1 parent 42d81eb commit d21a837
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/stark-build/config/build-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ function getEnvironmentFile(environment) {
if (typeof environment === "string") {
let fileName = helpers.root("src/environments/environment.ts");
let fileNameAlt;
let angularCliEnvConfig = ANGULAR_APP_CONFIG.config.architect.build.configurations.environment;
let angularCliEnvConfig = ANGULAR_APP_CONFIG.config.architect.build.configurations[environment];

if (angularCliEnvConfig && angularCliEnvConfig.fileReplacements) {
fileName = helpers.root(angularCliEnvConfig.fileReplacements.with);
fileNameAlt = helpers.root(angularCliEnvConfig.fileReplacements.replace);
if (angularCliEnvConfig && angularCliEnvConfig.fileReplacements instanceof Array) {
for (let fileReplacement of angularCliEnvConfig.fileReplacements) {
if (fileReplacement.replace.match(/environment/)) {
fileName = helpers.root(angularCliEnvConfig.fileReplacements[0].with);
fileNameAlt = helpers.root(angularCliEnvConfig.fileReplacements[0].replace);
}
}
}

if (fs.existsSync(fileName)) {
Expand Down

0 comments on commit d21a837

Please sign in to comment.