Skip to content

Commit

Permalink
Merge pull request #2169 from patricklx/fix-optimize
Browse files Browse the repository at this point in the history
ensure its a file specifier
  • Loading branch information
ef4 authored Dec 10, 2024
2 parents 6caeed4 + 9d9fb55 commit 100d81f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/vite/src/esbuild-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ export class EsBuildRequestAdapter implements RequestAdapter<Resolution<OnResolv
// and non-strict handlebars (which resolves
// components/helpers/modifiers against the app's global pool).
let pkg = this.packageCache.ownerOfFile(result.path);
if (pkg?.root === this.packageCache.appRoot) {
if (
pkg?.root === this.packageCache.appRoot &&
// vite provides node built-in polyfills under a custom namespace and we dont
// want to interrupt that. We'd prefer they get bundled in the dep optimizer normally,
// rather than getting deferred to the app build (which also works, but means they didn't
// get pre-optimized).
(result.namespace === 'file' || result.namespace.startsWith('embroider-'))
) {
let externalizedName = request.specifier;
if (!packageName(externalizedName)) {
// the request was a relative path. This won't remain valid once
Expand Down

0 comments on commit 100d81f

Please sign in to comment.