-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
adding to the buffer in an optimized file is not (always) synchronous #55
Comments
Ok, I removed the code that ensured synchronous injection previously because I thought that it wasn't possible to duplicate, but if you have code running directly after a layer that uses a css require, it seems to be happening in your case. If you can explain more clearly what calls happen when to cause this that would be great to understand it better. For now, I've added a sync injection code to the builder on the master branch. Try that and let me know if it sorts it? |
I'm not doing it in the define because it's trying to accomplish another task - namely to know which css is in the layer script, and then to inject it. In order to properly understand the css for the layer it needs to be a sync operation so the fix above is good. The easier way to do this is simply with a global variable, but I'm trying to be good and avoid that! |
Your fix seems to be working ok, thanks! I have not created a stripped down test case (yet), but it happened in a multi-module build that had css.js (and some less) in the first module, and some other less in other modules. |
This is at least sorted, focusing on #56 now, the other side of this. I have an alternate fix to the merge I am testing right now. |
css-builder writes async requires to the output file to call addBuffer. This causes extra loads for the css files because modules that define the css file as a dependency are loaded before the async require executes.
I fixed it by wrapping the call to addBuffer in a define(), but I'm not sure if that's really the way to go.
The text was updated successfully, but these errors were encountered: