Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix attempt: enable export mangling for modules used only as export objects #19219

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
Loading
from

Conversation

scameron
Copy link
Contributor

This is a first attempt at a fix for issue #19153. I'm almost certain that this is wrong, but it seems to work in my case. The hope is that running this through the automated tests will show more info about specifically what is wrong with this.

I tried this in my full production build and it succeeds there as well. The chunk size is reduced by nearly 3MB overall after this change (in an enormous 484MB build, but still).

What kind of change does this PR introduce?

In cases where a depency has no specific used exports, but instead is used as an "export object" via an export of import *, we no longer mark the usage as "unknown" but instead mark it as used.

Did you add tests for your changes?

No new tests. This is an experiment to see what existing tests break.

Does this PR introduce a breaking change?

Not sure yet...

What needs to be documented once your changes are merged?

No documentation

@TheLarkInn TheLarkInn requested a review from Copilot February 12, 2025 20:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

lib/ExportsInfo.js:402

  • The new method setUsedAsExportObject should be covered by tests to ensure it behaves as expected.
setUsedAsExportObject(runtime) {

lib/FlagDependencyUsagePlugin.js:93

  • The new behavior introduced by setUsedAsExportObject should be covered by tests to ensure correctness and prevent regressions.
if (exportsInfo.setUsedAsExportObject(runtime)) {

lib/optimize/MangleExportsPlugin.js:25

  • The removal of this check might change the intended behavior of the canMangle function. Please ensure this change is intentional and doesn't introduce any bugs.
if (exportsInfo.otherExportsInfo.getUsed(undefined) !== UsageState.Unused)

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests cases?

@alexander-akait
Copy link
Member

Looks like a problem with default in our tests

@Vansh5632
Copy link
Contributor

@scameron from failing test cases i can think there is some error in the code style in which you have written try to fix that and re run the yarn test --basic to see further outputs

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

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.