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

feat(build): integrate tree-shaker for improved bundle optimization #4994

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

johnsoncodehk
Copy link
Member

Copy link

pkg-pr-new bot commented Nov 7, 2024

Open in Stackblitz

vue-component-meta

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4994

vue-component-type-helpers

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4994

@vue/language-core

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4994

@vue/language-plugin-pug

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4994

@vue/language-server

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4994

vue-tsc

npm i https://pkg.pr.new/vuejs/language-tools/vue-tsc@4994

@vue/language-service

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4994

@vue/typescript-plugin

npm i https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4994

commit: 0c285d9

@johnsoncodehk
Copy link
Member Author

@KermanX I think this PR is almost successful, but tree-shaker seems to have some template string/regex conversion problems, can you take a look?

@KermanX
Copy link
Collaborator

KermanX commented Dec 18, 2024

@KermanX I think this PR is almost successful, but tree-shaker seems to have some template string/regex conversion problems, can you take a look?

Yes, I've noticed that bug, but I can't immediately solve it because I need to investigate how to escape the template literal in oxc 🥲.

@KermanX
Copy link
Collaborator

KermanX commented Dec 19, 2024

I've used a workaround to solve the template literal escaping issue.

Currently, this PR is tree-shaking thousands of input files, which may lose many import chances compared to tree-shaking the bundled js.

I found that the server.cjs produced by esbuild will make the tree shaker stuck for a long time. However, tree-shaking works well on the Rollup output in #4998. As a rough estimation, Tree-shaking can finish in about 30s on the Rollup output in #4998, and make the js size about 5% smaller.

@johnsoncodehk
Copy link
Member Author

Unfortunately the output file is currently corrupt and still needs to be investigated.

#4998 changes the project dependencies too much, so it's relatively difficult to merge (and I haven't finished reviewing all the changes yet), and if we can successfully merge this PR first, and move on to #4998 in the future, I think there is no harm.

@KermanX
Copy link
Collaborator

KermanX commented Dec 20, 2024

Unfortunately the output file is currently corrupt and still needs to be investigated.

I've fixed another bug. And I can't find more problems myself now.

@johnsoncodehk johnsoncodehk marked this pull request as ready for review December 20, 2024 10:34
@johnsoncodehk johnsoncodehk force-pushed the master branch 2 times, most recently from c3e80dc to 209717c Compare December 20, 2024 21:05
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.

3 participants