-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css] Removing empty css causes invalid code to be generated #14515
Labels
Comments
BTW the comma separated Meaning I see two possible ways of fixing this:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:/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: