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

Redundant require('@vue/devtools-api') in the CJS prod build #1524

Closed
haoqunjiang opened this issue Aug 18, 2022 · 1 comment
Closed

Redundant require('@vue/devtools-api') in the CJS prod build #1524

haoqunjiang opened this issue Aug 18, 2022 · 1 comment

Comments

@haoqunjiang
Copy link
Member

Version

4.1.3

Reproduction link

unpkg.com

Steps to reproduce

Cmd + F, search for require('@vue/devtools-api') on the page

What is expected?

The require statement should be tree-shaken away from the bundle, because non of its exports are used in the prod bundle of vue-router, and the package is of sideEffects: false:
https://github.com/vuejs/devtools/blob/ba54bb770a829429226a630dd5dbedcf596f27ef/packages/api/package.json#L9

What is actually happening?

It remains in the CJS prod bundle


Originally reported at vuejs/devtools-v6#1932
As my comment on the issue, it's not a big issue as most users would use the esm-bundler version, which could be correctly tree-shaken.
But this issue still indicates that something might be wrong in vue-router's rollup config.

@posva
Copy link
Member

posva commented Aug 18, 2022

It's funny, we were just talking about this with the Nuxt team yesterday for pinia: vuejs/pinia#1561

It does seem like a bug in rollup (or maybe intentional for perf reasons) but we did find a way to remove it so I will just apply the same change

@posva posva closed this as completed in 5b8983d Aug 18, 2022
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

No branches or pull requests

2 participants