When using relativeCSSInjection, cssCodeSplit needs to be enabled. This is not documented and unfortunately I didn't know that until I opened the source code of this plugin.
I was using build.lib option, so in my configuration build.cssCodeSplit was undefined, and Vite by default sets it to false after resolving configs.
This plugin only checks if (config.build.cssCodeSplit == false) before sending out a warning.
My suggestions:
Can configResolved(_config) be used for this check? It doesn't have env.command but it will have the resolved false value for cssCodeSplit after Vite decides on the defaults.
We could also change the condition to if (config.build.cssCodeSplit == false || (!config.build.cssCodeSplit && config.build.lib)) but I don't really like that. Vite could change their defaults at any time.
Add the information about cssCodeSplit to the readme. I'll send a PR for that shortly.
Hi, thank you for the issue.
I think it's a good starting point the PR you proposed.
I will merge it asap, thank you for the contribution.
I will valuate others solutions you proposed, but for know I think it's enough
When using
relativeCSSInjection
,cssCodeSplit
needs to be enabled. This is not documented and unfortunately I didn't know that until I opened the source code of this plugin.I was using
build.lib
option, so in my configurationbuild.cssCodeSplit
wasundefined
, and Vite by default sets it tofalse
after resolving configs.This plugin only checks
if (config.build.cssCodeSplit == false)
before sending out a warning.My suggestions:
configResolved(_config)
be used for this check? It doesn't haveenv.command
but it will have the resolvedfalse
value forcssCodeSplit
after Vite decides on the defaults.if (config.build.cssCodeSplit == false || (!config.build.cssCodeSplit && config.build.lib))
but I don't really like that. Vite could change their defaults at any time.cssCodeSplit
to the readme. I'll send a PR for that shortly.