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(@angular-devkit/build-angular): bypass Vite prebundling for absolute URL imports #27069

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,13 @@ export async function* serveWithVite(
externalMetadata.implicitBrowser.length = 0;

externalMetadata.explicit.push(...explicit);
externalMetadata.implicitServer.push(...implicitServer);
externalMetadata.implicitBrowser.push(...implicitBrowser);
// Remove any absolute URLs (http://, https://, //) to avoid Vite's prebundling from processing them as files
externalMetadata.implicitServer.push(
...(implicitServer as string[]).filter((value) => !/^(?:https?:)?\/\//.test(value)),
);
externalMetadata.implicitBrowser.push(
...(implicitBrowser as string[]).filter((value) => !/^(?:https?:)?\/\//.test(value)),
);

// The below needs to be sorted as Vite uses these options are part of the hashing invalidation algorithm.
// See: https://github.com/vitejs/vite/blob/0873bae0cfe0f0718ad2f5743dd34a17e4ab563d/packages/vite/src/node/optimizer/index.ts#L1203-L1239
Expand Down