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

Fix removedExports to correctly track the exported item #2835

Merged
merged 1 commit into from May 4, 2019

Conversation

Swatinem
Copy link
Contributor

@Swatinem Swatinem commented May 3, 2019

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

closes #2834

Description

The RenderedModule.removedExports/renderedExports now correctly track the item being exported, and not the export declaration itself.

@Swatinem Swatinem self-assigned this May 3, 2019
@Swatinem Swatinem requested a review from lukastaegert May 3, 2019 14:54
Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Awesome, that was really quick. I only have some minor comments.

And there is one edge case that I keep wondering about: If a module exports e.g. a function and this export is not used by another module but the function is used internally, then this export will be reported as "rendered". Not sure if this is what we want but I guess it makes sense in a way—after all the function is included in the bundle and inside the bundle there are no exports. So I guess we can keep it as it is.

Good work!

src/Module.ts Outdated Show resolved Hide resolved
test/misc/bundle-information.js Outdated Show resolved Hide resolved
@Swatinem
Copy link
Contributor Author

Swatinem commented May 3, 2019

If a module exports e.g. a function and this export is not used by another module but the function is used internally, then this export will be reported as "rendered". Not sure if this is what we want

My usecase for this is to build a plugin that errors on dead code. So at least for my usecase, the information if an item is included in the bundle is exactly the info I rely on :-)

Will update according to your comments in a sec, have to finish up another PR :-)

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Awesome, great work!

@lukastaegert lukastaegert merged commit 6238077 into rollup:master May 4, 2019
@Swatinem Swatinem deleted the removedExports branch May 4, 2019 07:56
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.

RenderedModule.removedExports is wrong when using export declarations
2 participants