Skip to content

refactor(@angular-devkit/build-angular): remove legacy server bundle guess logic #19173

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

Merged
merged 1 commit into from
Oct 22, 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
27 changes: 13 additions & 14 deletions packages/angular_devkit/build_angular/src/app-shell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,23 @@ async function _getServerModuleBundlePath(
) {
if (options.appModuleBundle) {
return path.join(context.workspaceRoot, options.appModuleBundle);
} else {
const { baseOutputPath = '' } = serverResult;
const outputPath = path.join(baseOutputPath, browserLocaleDirectory);
}

if (!fs.existsSync(outputPath)) {
throw new Error(`Could not find server output directory: ${outputPath}.`);
}
const { baseOutputPath = '' } = serverResult;
const outputPath = path.join(baseOutputPath, browserLocaleDirectory);

const files = fs.readdirSync(outputPath, 'utf8');
const re = /^main\.(?:[a-zA-Z0-9]{20}\.)?(?:bundle\.)?js$/;
const maybeMain = files.filter(x => re.test(x))[0];
if (!fs.existsSync(outputPath)) {
throw new Error(`Could not find server output directory: ${outputPath}.`);
}

if (!maybeMain) {
throw new Error('Could not find the main bundle.');
} else {
return path.join(outputPath, maybeMain);
}
const re = /^main\.(?:[a-zA-Z0-9]{20}\.)?js$/;
const maybeMain = fs.readdirSync(outputPath).find(x => re.test(x));

if (!maybeMain) {
throw new Error('Could not find the main bundle.');
}

return path.join(outputPath, maybeMain);
}

async function _appShellBuilder(
Expand Down