Skip to content

Commit

Permalink
fix(utils) always initialize scripts array
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgroenen committed Jan 8, 2020
1 parent 4bea3a4 commit fde2d49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions builders/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export function prepareBrowserConfig(
optionsStarter.deleteOutputPath = false;
}

// Initialize an empty script array to make sure assets are pushed even when
// scripts is not configured in angular.json
if (!optionsStarter.scripts) {
optionsStarter.scripts = [];
}

if (options.consolelogs) {
// Write the config to a file, and then include that in the bundle so it loads on window
const configPath = getSystemPath(
Expand All @@ -61,9 +67,6 @@ export function prepareBrowserConfig(
options.consolelogsPort
} }`
);
if (!optionsStarter.scripts) {
optionsStarter.scripts = [];
}
optionsStarter.scripts.push({
input: configPath,
bundleName: 'consolelogs',
Expand Down

0 comments on commit fde2d49

Please sign in to comment.