SFC <script setup> not tree-shakable

This issue has been tracked since 2022-08-27.

Version

2.7.10

Reproduction link

github.com

Steps to reproduce

1.Pull my project and install the dependency
2.Run the command npm run build
3.Compare the src/app.vue source code with the packaged dist/main.js code
4.I didn't use test2 or test3 in src/app.vue, But it's still inside dist/main.js
5.If I use <script> Rather than <script setup>, dist/main.js will not contain test2 and test3

What is expected?

dist/main.js not contain code for test2 and test3

What is actually happening?

dist/main.js contain code for test2 and test3


There is no problem in vue 3.2.37 + vue-loader 17.0.0
vue 2.7.10 + vue-loader 15.10.0 has some problems

1593292349 wrote this answer on 2022-08-27

1
SFC <script setup> not tree-shakable

1593292349 wrote this answer on 2022-08-27

2
SFC <script> tree-shakable

jens-morten-mikkelsen wrote this answer on 2022-09-16

👀

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-10-03
Star Count 199770
Watcher Count 6094
Fork Count 32877
Issue Count 590

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date