You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
import default from 'xxx.vue'
// is converted to
import default from 'xxx-vue-options'
import 'set-render-on-options' // which has side effects
// I think the behavior is wired and may have some unexpected effects when tree-shaking
When I use the built library (if it is set to sideEffects: false)
import { Button } from 'my-library'
// use Button
Only the options of the Button will be bundled.
Is there any possibility to create only one file for a .vue sfc in preserveModules = true mode? That will not create unexpected side effects.
For example
export { default as Button } from './button/index'
export { default as Text } from './text/index'
export { default as Space } from './switch/index'
Is build as
export { default as Text } from './text/Text.vue_vue&type=script&lang.js';
import './text/Text.vue.js';
export { default as Button } from './button/Button.vue_vue&type=script&lang.js';
import './button/Button.vue.js';
export { default as Space } from './switch/Switch.vue_vue&type=script&lang.js';
import './switch/Switch.vue.js';
Which is not friendly for tree-shaking. For a component library, the codebase may be huge. If you don't set sideEffects: false, you will find it very hard to find out which part breaks tree-shaking. However if you set sideEffects: false, every xxx.vue.js will be pruned since it is not directly imported and viewed as tree-shakable.
The text was updated successfully, but these errors were encountered:
It's unfortunate that there's no concrete example on how to deal with this anywhere, so far I've only found work-arounds that either exclude sfc's entirely or depend on a two step build through scripting.
Nearly a year without a commit in this repository now...
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
5.0.0
Reproduction link
https://repl.it/join/czprwdpz-07akioni
Steps to reproduce
run main.sh
What is expected?
The app output should contains render function
What is actually happening?
Only the options is preserved
preserveModules = true
is important for library development. However every singlevue
file is split into 3 files in that mode.When I use the built library (if it is set to
sideEffects: false
)Only the options of the Button will be bundled.
Is there any possibility to create only one file for a
.vue
sfc inpreserveModules = true
mode? That will not create unexpected side effects.For example
Is build as
Which is not friendly for tree-shaking. For a component library, the codebase may be huge. If you don't set
sideEffects: false
, you will find it very hard to find out which part breaks tree-shaking. However if you setsideEffects: false
, everyxxx.vue.js
will be pruned since it is not directly imported and viewed as tree-shakable.The text was updated successfully, but these errors were encountered: