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
I have some code that imports code that uses dependencies that can not be treeshaken or have side effects, the code is written in Vue, meaning there are styles injected.
I then try to create a cjs output (library mode), the "generate bundle" part of the css plugin removes the empty css import.
But it replaces too much of the code.
To make it clearer, the code that vite produces and passes to the css plugin:
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I have some code that imports code that uses dependencies that can not be treeshaken or have side effects, the code is written in Vue, meaning there are styles injected.
I then try to create a cjs output (library mode), the "generate bundle" part of the css plugin removes the empty css import.
But it replaces too much of the code.
To make it clearer, the code that vite produces and passes to the css plugin:
Code after the css plugin removes the import:
As you can see it also removes the
;
which results in invalid code, as no it looks like this:which is invalid (the
;
before the const was required but is removed).Reproduction
https://github.com/nextcloud-libraries/nextcloud-vue/tree/2a73983387987702f48814de0243fec0a7a3eeb2
Steps to reproduce
npm ci
npm run build
dist/Components/NcHeaderMenu.cjs
System Info
System: OS: Linux 6.5 openSUSE Tumbleweed 20230926 CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Memory: 3.55 GB / 14.97 GB Container: Yes Shell: 5.9 - /bin/zsh Binaries: Node: 20.7.0 - /usr/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 10.1.0 - /usr/bin/npm Browsers: Chromium: 117.0.5938.92 npmPackages: vite: ^4.3.9 => 4.4.9
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: