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

incorrect tree shaking with import * as foo + export default foo #4751

Closed
sapphi-red opened this issue Dec 13, 2022 · 4 comments · Fixed by #4758
Closed

incorrect tree shaking with import * as foo + export default foo #4751

sapphi-red opened this issue Dec 13, 2022 · 4 comments · Fixed by #4758

Comments

@sapphi-red
Copy link
Contributor

Rollup Version

3.7.4

Operating System (or Browser)

stackblitz

Node Version (if applicable)

No response

Link To Reproduction

https://stackblitz.com/edit/rollup-template-vg2pmh?file=src%2Fmain.js

Expected Behaviour

Running the bundled file output

hello from greetings
hi from greetings

as before bundled.

Actual Behaviour

Running the bundled file output

hi from greetings

.

api.greetings.hello(); is removed even if it has a side effect.

It works when src/api/index.js is changed like below

export default {
-  greetings,
+  greetings: {
+    hello: greetings.hello,
+  },
};

Original issue: vitejs/vite#11356

@sapphi-red
Copy link
Contributor Author

This doesn't happen with 2.79.1 and happens with 3.0.0.

@lukastaegert
Copy link
Member

As it turns out, the case where a namespace is itself nested inside an object was not yet handled correctly. Fix for this and similar issues at #4758.

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4758 as part of rollup@3.7.5. You can test it via npm install rollup.

@sapphi-red
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants