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

defineComponent is no longer tree-shakeable without /* @__PURE__ */ with rollup since 3.0.0-rc.3 #8236

Closed
sapphi-red opened this issue May 5, 2023 · 1 comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.

Comments

@sapphi-red
Copy link
Contributor

sapphi-red commented May 5, 2023

Vue version

3.3.0-beta.4

Link to minimal reproduction

Rollup REPL

Steps to reproduce

  1. Open the rollup REPL I linking above.
  2. See the output includes defineComponent code.
  3. Toggle codes in the defineComponent function in utils.js.
  4. "re 3.0.0-rc.3 version" and "my suggestion version" works fine but "pre 3.3.0-alpha.6 version" and "current main branch version" doesn't

What is expected?

The defineComponent function is detected as side-effect free by Rollup as described in the document.

What is actually happening?

The defineComponent function is not detected as side-effect free by Rollup.

It seems the extend call and the property access (options.name) is treated as side-effectful.

related commits: 304830a, d77557c

System Info

No response

Any additional comments?

Original issue: vitejs/vite#13087

@danielroe
Copy link
Member

For a temporary workaround, you might consider this rollup plugin.

@sxzz sxzz added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label May 6, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Projects
None yet
Development

No branches or pull requests

3 participants