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

Tree-shaking is not effect in lib mode by using vue-jsx #10194

Closed
7 tasks done
fanhaoyuan opened this issue Sep 22, 2022 · 1 comment
Closed
7 tasks done

Tree-shaking is not effect in lib mode by using vue-jsx #10194

fanhaoyuan opened this issue Sep 22, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@fanhaoyuan
Copy link
Contributor

Describe the bug

When I using *.vue sfc file to make a bundle. I can get a function with /* @__PURE__ */ flag

const z = /* @__PURE__ */ p({
  props: {
    a: String
  },
  setup(n) {
    const t = n, o = c("apple");
    return (r, l) => (b(), h("div", null, "I'm " + s(o.value) + " " + s(t.a), 1));
  }
});

But when I using vue-jsx, it without /* @__PURE__ */ flag

const C = p({
  name: "MyComponent",
  setup() {
    return () => f("div", null, [i("I'm apple")]);
  }
});

How can I get /* @__PURE__ */ flag with vue-jsx, and tree-shaking supports in other project when using this lib.

Reproduction

none

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 72.70 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.9.0 - ~/Library/pnpm/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 8.19.1 - ~/Library/pnpm/npm
  Browsers:
    Chrome: 105.0.5195.125
    Safari: 15.4
  npmPackages:
    @vitejs/plugin-vue: ^3.1.0 => 3.1.0 
    @vitejs/plugin-vue-jsx: ^2.0.1 => 2.0.1 
    vite: ^3.1.3 => 3.1.3

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red
Copy link
Member

Duplicate of #7020

@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Sep 22, 2022
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants