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

Esbuild causing bundle breakage when applied twice to the same bundle #3723

Open
alan-agius4 opened this issue Apr 9, 2024 · 0 comments
Open

Comments

@alan-agius4
Copy link

In certain peculiar cases, running esbuild on a bundle that has already been processed by esbuild can lead to the bundle breaking. This issue is a simplified illustration of the problem described in detail at cloudflare/workers-sdk#5263.

Notice the I function invocation in handleNavigationRequest which in the output is actually changed to reference the local class t.

entry.js

import { b as I } from "./file.mjs";

var classSomething = (() => {
  let t2 = class t {
    handleNavigationRequest(r) {
      return I()
    }
  };

  return t2;
})();

export { classSomething };

file.mjs

var t = function() {};

export { t as b };

output

// file.mjs
var t = function() {
};

// entry.js
var classSomething = /* @__PURE__ */ (() => {
  let t2 = class t {
    handleNavigationRequest(r) {
      return t();
    }
  };
  return t2;
})();
export {
  classSomething
};

Reproduction: here

Esbuild version: 0.20.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant