Closed mdoesburg closed 3 years ago
Could it have something to do with the normalizeComponent
function? Similar to this issue: https://github.com/vuejs/rollup-plugin-vue/issues/344
I opened a PR with a fix: https://github.com/underfin/vite-plugin-vue2/pull/105
@underfin First of all, thank you for your great work on this plugin and other open source projects!
I am attempting to create a component library with Vite (library mode) & Vue 2, but whenever I check the build output of a test app that consumes the library, all components get included in the final build even unused ones.
Here's a snippet of the build in development mode:
Exports correctly get marked as unused, but don't get removed in the final production build.
I am fairly certain that it has something to do with this plugin. Whenever I use the default Vite setup with Vue 3, everything gets tree shaken properly. If I use
rollup-plugin-vue
instead ofvite-plugin-vue2
, everything gets tree shaken properly. Only when I use this plugin all components always get included in the final build of the consuming test app.Hopefully I am missing some basic configuration or there's an easy fix for this, because I would love to use this plugin to create a library with Vite & Vue 2.
package.json
vite.config.js
index.js
Vite1.vue
Vite2.vue