Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export function checkCommonJSModules(
// using `provideHttpClient(withFetch())`.
allowedRequests.add('xhr2');

// Packages used by @angular/ssr.
// While critters is ESM it has a number of direct and transtive CJS deps.
allowedRequests.add('express');
allowedRequests.add('critters');

// Find all entry points that contain code (JS/TS)
const files: string[] = [];
for (const { entryPoint } of Object.values(metafile.outputs)) {
Expand Down Expand Up @@ -76,8 +81,14 @@ export function checkCommonJSModules(
if (!imported.original || seenFiles.has(imported.path)) {
continue;
}

seenFiles.add(imported.path);

// If the dependency is allowed ignore all other checks
if (allowedRequests.has(imported.original)) {
continue;
}

// Only check actual code files
if (!isPathCode(imported.path)) {
continue;
Expand Down Expand Up @@ -141,11 +152,7 @@ function isPathCode(name: string): boolean {
* @returns True, if specifier is potentially relative; false, otherwise.
*/
function isPotentialRelative(specifier: string): boolean {
if (specifier[0] === '.') {
return true;
}

return false;
return specifier[0] === '.';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface RenderOptions {
const { outputFiles, document, inlineCriticalCss } = workerData as RenderWorkerData;

/** Renders an application based on a provided options. */
async function render(options: RenderOptions): Promise<RenderResult> {
function render(options: RenderOptions): Promise<RenderResult> {
return renderPage({
...options,
outputFiles,
Expand Down