Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(utils) always initialize scripts array #188

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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