-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect output order in bundle due to order of named exports #1433
Comments
I have further pinpointed the issue:
|
Thanks for the detailed report. I don’t have time to look into this at the moment, sorry (I have an upcoming cross-country move in a few weeks). I hope to be able to look into this after my move is done. |
@evanw Thanks, no worries. I've pushed a fix to Fluent UI to remove the cycle from inside of |
I think this is still an issue. @evanw any chance you could take a look? |
hi @evanw could you please have a look into solving/providing a workaround strategy for this? |
From what I am seeing in our app, modules are being resolved breadth-first instead of depth-first. For example: // index.js
export * from './a/index.js';
export * from './b/index.js';
// a/index.js
export * from './one.js';
export * from './two.js';
// b/index.js
export * from './one.js';
export * from './two.js'; With this example, I am seeing it load in the following order:
while the correct load order should be:
|
I am seeing this too. How is this not an issue for more people? Flatter lib structure? |
Issue is still relevant and reproduceable |
This issue repros with esbuild 0.12.15:
We're trying to bundle Outlook script with esbuild and we're seeing that files from the
Pivot
from the Fluent UI component library are being bundled in the wrong order. ThePivot
importsPivotBase
and exports astyled
version of it.The expected order in the bundle output is that
PivotBase
gets defined, and then it is used to create/export thePivot
component. We are seeing the reverse: Pivot is defined and exported before PivotBase is defined (lower in the output file.) This causes a null reference in the browser.We found this is due to the
SliderBase.ts
file importingSliderItem
from./index
, which exports bothSlider
andSliderBase
. Changing the import to./SliderItem
fixed the cycle and resolved the issue.Expected:
When cyclic dependencies occur (index -> SliderBase -> index), direct import order (Slider -> SliderBase) should control module order in the bundle (first define SliderBase, then define Slider.)
Resulted:
The cyclic dependency caused the definition to be reversed (Slider, then SliderBase.)
Isolated repro here:
git clone https://github.com/dzearing/vite-fluent-bundling-issue cd vite-fluent-bundling-issue yarn yarn dev
You should see an error in the console:
If you modify
src/Pivot.ts
to remove thePivotBase
export, or move it above thePivot
export, the bundle will be correctly ordered.Note: the
PivotItem
import inPivotBase
was fixed in Fluent UI 8.23.0.The text was updated successfully, but these errors were encountered: