-
Notifications
You must be signed in to change notification settings - Fork 510
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
[Bug]: duplicated default import #3199
Comments
I made a minimal-ish repro https://stackblitz.com/edit/github-ugpzvon2?file=src%2Fentry.js Esbuild also doesn't dedupe same external imports (though in a different way) esbuild try and there's an issue about it evanw/esbuild#475 |
Other external imports don't exhibit this behavior in my build, that's odd. 🤔 import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
import { flushSync } from "react-dom";
import clsx, { default as clsx$1, default as clsx$2, default as clsx$3, default as clsx$4, default as clsx$5, default as clsx$6, default as clsx$7 } from "clsx";
import { Fragment, jsx, jsxs } from "react/jsx-runtime"; Maybe it's only an issue with default imports? |
Indeed, this seems to only happen for default import. I updated the repro above now output looks like this: import externalDefault, { externalNamed, default as externalDefault$1 } from "external";
//#region src/dep.js
var dep_default = "dep";
console.log({
externalDefault: externalDefault$1,
externalNamed
});
//#endregion
//#region src/entry.js
console.log({
externalDefault,
externalNamed,
dep: dep_default
});
//#endregion |
Seems rolldown/crates/rolldown/src/stages/link_stage/bind_imports_and_exports.rs Lines 392 to 400 in 80d522f
|
<!-- Thank you for contributing! --> ### Description 1. part of #3199 2. will try to merge two `external` default import if they are in same chunk <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
<!-- Thank you for contributing! --> ### Description 1. naming style just follow rollup https://rollupjs.org/repl/?version=4.29.1&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMGNsc3glMjQxJTJDJTIwJTdCJTIwJ2RlZmF1bHQlMjB0ZXN0JyUyMGFzJTIwY2xzeCUyQyUyMCdkZWZhdWx0JTIwdGVzdCclMjBhcyUyMGNsc3gyJTJDJTIwJTdEJTIwZnJvbSUyMCU1QyUyMmNsc3glNUMlMjIlM0IlNUNuY2xzeCgpJTNCJTVDbmNsc3glMjQxKCklM0IlNUNuY2xzeDIoKSUzQiU1Q24lNUNuJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlMkMlMjJuYW1lJTIyJTNBJTIybWFpbi5qcyUyMiU3RCUyQyU3QiUyMmNvZGUlMjIlM0ElMjJpbXBvcnQlMjBjbHN4JTI0MSUyQyUyMCU3QiUyMCdkZWZhdWx0JTIwdGVzdCclMjBhcyUyMGNsc3glMkMlMjBkZWZhdWx0JTIwYXMlMjBjbHN4JTI0MiUyQyUyMGRlZmF1bHQlMjBhcyUyMGNsc3glMjQzJTJDJTIwZGVmYXVsdCUyMGFzJTIwY2xzeCUyNDQlMkMlMjBkZWZhdWx0JTIwYXMlMjBjbHN4JTI0NSUyQyUyMGRlZmF1bHQlMjBhcyUyMGNsc3glMjQ2JTJDJTIwZGVmYXVsdCUyMGFzJTIwY2xzeCUyNDclMjAlN0QlMjBmcm9tJTIwJTVDJTIyY2xzeCU1QyUyMiUzQiU1Q25jbHN4KCklM0IlNUNuY2xzeCUyNDEoKSUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0FmYWxzZSUyQyUyMm5hbWUlMjIlM0ElMjJxdXguanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTdEJTdE 2. Closed #3199 ## Credits #3205 @hyf0 <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
Reproduction link or steps
Repo branch: adazzle/react-data-grid#3578
git clone https://github.com/adazzle/react-data-grid.git
git checkout rolldown
npm i
npm run build
lib/bundle.js
clsx
is imported multiple times with different identifiersWhat is expected?
I'd expect the following import to not result in multiple imports.
What is actually happening?
The
clsx
default export is imported under multiple identifiers.System Info
Any additional comments?
The CJS output (
lib/bundle.cjs
) does not have this issue.Rollup does not have this issue either.
The text was updated successfully, but these errors were encountered: