SFC <script setup> not tree-shakable

This issue has been created 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-09-27
Star Count 199644
Watcher Count 6098
Fork Count 32848
Issue Count 587

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
test(jans-auth-server): migration for few server side tests are not finished 0 2022-08-10 2022-08-17
Correct naming of Michalewicz functions 0 2022-01-01 2022-08-17
ModuleNotFoundError: No module named 'NiaPy' 0 2021-07-27 2022-08-18
Previewing Lip Tracker Freezes Parameters 4 2021-06-10 2022-05-14
Confidence scores possible? 1 2021-03-26 2022-04-07
Add support for SASI INQUIRY and READ CAPACITY 0 2022-03-06 2022-08-17
SASI FORMAT command has wrong opcode (0x06 instead of 0x04) 2 2022-03-05 2022-08-03
SCSI spec misunderstanding: LUNs do *not* have to be consecutive 2 2022-03-01 2022-07-19
nodal force distribution 5 2021-07-26 2022-06-29
Info - powertoys enables svg preview 3 2020-05-30 2022-09-13
[iOS] Screen flashes on page transitions 6 2022-04-13 2022-09-21
Departments should be hidden when all roles are disasbled - set preferences 0 2022-09-09 2022-09-03
App Keystore Not Working in Solar SDK 1 2021-07-28 2022-09-19
Add documentation for the new transition.loop method 0 2021-07-13 2022-09-19
Cant install newer version of Haxe (I also can't uninstall Haxe) 0 2022-03-04 2022-08-27
Captcha is required or PDF is not ready yet for 1 2021-08-27 2022-09-25
How to implement dynamic linq for Query.OrderBy and Query.Where 8 2021-09-15 2022-09-13
Add example in Quick Start guide on how to register service? 0 2021-09-15 2022-09-04
Synthesis failed for python-redis 8 2020-02-13 2022-09-19
Clock conflict when using both Stretch and Cross 0 2022-04-14 2022-06-16
Question regarding proxying vmauth/victoriametrics with TLS and basic auth 7 2021-03-28 2022-09-18
Block editor now progressively loads CSS almost like wprig! but CSS conflicts 2 2021-04-22 2022-09-21
Question: Adding Prometheus to existing Server 1 2022-07-13 2022-09-11
Including Any.h causes Compiler error on Visual Studio 3 2022-07-13 2022-09-11
[Suggestion] netcat support 13 2016-11-29 2022-09-17
Don't validate readOnly properties when writing, and writeOnly when reading 4 2022-02-22 2022-09-24
Upload multiple chunks of single file with aws-s3-multipart 4 2021-09-10 2022-07-10
API documentation review for MySQL 0 2021-10-28 2022-08-13
Episode idea: Robusta 0 2022-01-20 2022-09-21
Deprecated constructor and methods in `QuickOrderService` 0 2021-10-18 2022-09-04
Tracking changes made to RawDataElements during `DataElement_from_raw` 0 2021-12-10 2022-09-15
Error: No such mapping 1 2022-01-19 2022-09-25
Abyssal Lantern not included as light source for clue steps 1 2022-05-06 2022-09-02
Generate text 1 2020-01-23 2022-01-16
windowsExecutableCodeSignatureVerifier fails in PowerShell Constrained Language Mode 6 2022-06-03 2022-09-15
PickleDataset is not deepcopiable for kedro>=0.17.6 9 2021-12-29 2022-09-17
[tesla] TeslaSSOHandler returns 403 Forbidden . Username/Password works on tesla home page. App works also fine. 2 2022-02-17 2022-02-23
[BUG] Color contrast needs to be detected and measured automatically 5 2021-11-12 2022-09-03
How to calculate the render speed after using cache digest? 1 2013-04-26 2022-08-14
default instructions for monobeast in Pong 1 2022-03-17 2022-09-16
Can't install polybeast in WSL2 0 2022-04-13 2022-09-16
OSError: image not found when installing from source 1 2021-04-01 2022-09-16
Support for Huawei Mobile Services 1 2022-01-27 2022-09-25
New design for rsocket-broker's error code. 5 2020-12-20 2022-09-18
DISCO_L072CZ_LRWAN1 LOW POWER 3 2021-04-22 2022-09-19
WebSocketChannelException: WebSocketChannelException: HandshakeException: Handshake error in client CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:354)) 4 2020-01-07 2022-09-17
Check for accessibility issues in the new UI (for WW 2.17) 7 2022-01-31 2022-09-08
megathread: Buffer exporting and logging 0 2021-04-03 2022-09-15
Add ability to override precision for merge processor 3 2022-09-14 2022-09-26
[Translation] use intl domain when adding a new key if intl domain exists 5 2021-09-03 2022-08-18