-
Notifications
You must be signed in to change notification settings - Fork 29
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
Problem with split CSS chunks with multiple outputs #85
Comments
Perhaps the manifest file should be checked recursively for css files. In the event the imported javascript files also has imports with css dependencies. For example if Edit: Imports are now registered in correct order, so you can properly override css dependencies.
|
Hey @netlas I noticed this issue only on entrypoints and didn't know if there is the same issue on imported components. |
Indeed what a coincidence :) |
Just tested it and your solution is working for my project 😉 |
Updated the WP filter above so the imported css will enqueue a head of the output css. That way you can properly override the css of your dependancies. Also made a pull request for a permanent fix for this. |
Fixed via #86 |
I ran into some problems with multiple outputs that depended on same internal imports. Not sure if it's Vite itself or the @vitejs/plugin-vue that splits up the js/css of vue components that is being reused in multiple output files. The js file are getting imported asynchronically in runtime. But the split css for the component is never imported. This is only a problem in production, the vite dev server handles it just fine.
I manage to fix this with a wp filter. (Thanks for adding these filters in the source code btw). But this should perhaps be added in a future update? Unless this is vue specific, but I dont think it is.
To clarify a bit more. The two input files in vite.config.js is "admin.ts" and "admin_menu.ts". Both uses the Vue component Menu.vue.
The manifest.js file looks like this:
_runtime-dom.esm-bundler-17b5f22b.js
(Vue.js framework) and_Menu.vue_vue_type_script_setup_true_lang-91a54a7b.js
(Menu.vue) are being imported async inadmin_menu-5fa266d6.js
oradmin-45447c50.js
which vite for wp is already registering. With my filter aboveassets/Menu-c4e73a0f.css
is now also being registered.The text was updated successfully, but these errors were encountered: