There seems to be something wrong with tree shaking
See original GitHub issueWhen I import {useFocusTrap} from "@vueuse/integrations"
, all the lib is bundled (qrcode, buffer & co … ).
repro npm install
, npm run dev
See stats.html in dist after build.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Tree-Shaking Problems with Component Libraries - Medium
Tree -shaking isn't magic, and much like the garbage collector, you need to understand a little of what it's doing to get the...
Read more >Webpack5 does not seem to tree-shake unused exports
I tried changing all files to .js and removing the whole ts-loader thing. Tree-shaking now work as intented. The updated question now is...
Read more >Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >Tree-Shaking: A Reference Guide - Smashing Magazine
Tree -shaking” is a must-have performance optimization when bundling JavaScript. In this article, we dive deeper on how exactly it works and ...
Read more >Component Library: Tree Shaking CSS solution - YouTube
A few days ago I presented a problem I was having with " Tree Shaking CSS" (watch it here: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, that’s a good point and I didn’t notice that as I thought rollup will tree-shake unused modules. But looks like there is also no way to explicitly mark an import statement pure (https://github.com/rollup/rollup/issues/2874). The solution of this that comes up my mind is to separate functions into several sub-modules, e.g.
What do you think?
If we go that way, it will be a breaking change and I would like to do that in v5.
When using the
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component'
in a Nuxt 3 project with@vueuse/integrations: 7.3.0
I’m getting the error:It appears that two things may be going on:
useQRCode
composable is being loadeduseQRCode
composable is possibly incorrectly importingqrcode
However this also may be an issue in Nuxt 3 and how it performs imports? Any help would be much appreciated!