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

Rollup incorrectly merging ESM and CJS modules resulting in missing exports #5409

Open
n8sabes opened this issue Mar 1, 2024 · 0 comments
Open

Comments

@n8sabes
Copy link

n8sabes commented Mar 1, 2024

Rollup Version

4.12.0

Operating System (or Browser)

macOS 14.3.1 23D60 arm64

Node Version (if applicable)

v20.11.1

Link To Reproduction

https://github.com/n8sabes/rollup-bug

Expected Behaviour

Correctly exporting both ESM and CJS modules.

Actual Behaviour

The symbol s_ITZElfFEBMI isn't exported correctly as it is wrapped inside of an ESM module proxy, and that proxy is exported instead. The correct export would look like, export {WebPlugin, s_ITZElfFEBMI}.

This happens only when those two modules end up together in the same chunk.

https://github.com/n8sabes/rollup-bug/blob/dd50ea990de6491592a2dead4f6694304aedeaa3/dist/assets/s_itzelffebmi-BBbRbRI_.js#L506C1-L511C19

const s_ITZElfFEBMI = async () => {
  const coordinates = await Geolocation.getCurrentPosition();
  console.log("Current position:", coordinates);
};
const s_itzelffebmi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  s_ITZElfFEBMI
}, Symbol.toStringTag, { value: "Module" }));
export {
  WebPlugin as W,
  s_itzelffebmi as s
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant