-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Bug report
What is the current behavior?
I have a Vue icons library (npm package), which is using rollup to build the code in various formats (including ES modules) which should be tree-shakable. When I add it to my project, which is built with webpack, and use only one icon from the library, I still see whole library in the production bundle.
If the current behavior is a bug, please provide the steps to reproduce.
I've made super simple vue cli app https://github.com/dandel10n/vue-app-sample - which uses https://github.com/dandel10n/vue-library-sample for easier illustration.
There are 3 components in the library. In the app I use only one (LibComponentOne). But in the vendors.bundle.js I still see all three components being imported.
If I build the app in dev mode with passing optimization: { usedExports: true }
then in the bundled js file I see the unused components marked as /* unused harmony export LibComponentThree */\n/* unused harmony export LibComponentTwo */
as expected. But in production build I still see the unused components being included.
What is the expected behavior?
As I understand in app's vendors bundle I should see only one component, not all 3.
Other relevant information:
webpack version: v4.28.4
Node.js version: v10.15.0
Operating System: macOS
Additional tools: Vue CLI, Rollup