Skip to content
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

Stopped working in version 3.2.0 #108

Closed
tuzz opened this issue Jul 11, 2023 · 5 comments · Fixed by #109
Closed

Stopped working in version 3.2.0 #108

tuzz opened this issue Jul 11, 2023 · 5 comments · Fixed by #109

Comments

@tuzz
Copy link

tuzz commented Jul 11, 2023

Hello, I tried to upgrade to version 3.2.0 but the plugin seems to have stopped work. It is not placing the inlined CSS into the JavaScript umd.js generated as part of my Vite build process. It looks like these two changes were made in this version:

Do you know what could have caused the plugin to stop working?

I am the maintainer of https://github.com/beyondWords-io/player and when I run ./bin/build it produces a dist/umd.js that is around 375KB and when I upgrade the plugin and run ./bin/build it produces a dist/umd.js that is around 185KB.

Thanks

@marco-prontera
Copy link
Owner

Hi @tuzz, I'm sorry that is stopped working for you. Have you tried to exclude one plugin at time to see if something interferes with my plugin? What is changed basically is the removed support for the old vite plugin legacy behavior. Maybe in your case the bug I removed instead is a feature for you. I will check with your project to help you solve this problem and propose a fix or something else. This week I'm busy, you can use the old version in the meanwhile. Of course we will solve this problem asap

marco-prontera added a commit that referenced this issue Jul 17, 2023
* fix: inject css into multiple build process of same entry point

* docs: add info about relativeCSSInjection

* 3.2.1

* refactor: remove unreq comment
@marco-prontera
Copy link
Owner

Hi @tuzz thank you for the issue.
Here the version with the fix v3.2.1.

Essentially the problem was that the code that I deleted had the purpose to support the official legacy plugin. Since the official legacy plugin of Vite now inject the CSS code for other reasons I deleted that code from my plugin.
Now by checking the usage I figured out that one thing was missing from the logic of this plugin.
The support of multiple build process of the same entry point, this because the css will be generated once and not for every time, so for this reason I added a map (that works as a cache memoization-like between executions, since its the same execution context) to be sure that the CSS will be injected for every output of the same entry-point.

See you!

@tuzz
Copy link
Author

tuzz commented Jul 18, 2023

Thanks for the fix! Greatly appreciated. ⭐

@alzuma
Copy link

alzuma commented Jul 19, 2023

@marco-prontera JIT (just in time) in its all glory! 👍 Just in time because today I noticed that UMD entry doesn't contain css injections. #youcool

@wangmerry
Copy link

vite build --watch
the umd.js file still does not include css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants