Is there a way to prevent injecting vike-react integration CSS? #2340
-
I'm using Vike with vike-react for SSG. I noticed that builds include this in the head: <link rel="stylesheet" type="text/css" href="/assets/static/vike-react-b64a028b.BcWtY8Ol.css"> But I don't use that CSS for anything. I couldn't find a configuration in the docs to turn this off. Is it possible? Here's my import type { Config } from 'vike/types';
function getConfig() {
if (process.env.npm_lifecycle_event === 'build') {
return {
meta: {
Page: {
env: { server: true, client: false }, // HTML-only for all pages
},
},
} satisfies Config;
}
return {};
}
export default getConfig(); (I'm using client mode for dev to benefit from HMR.) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
What's the content of |
Beta Was this translation helpful? Give feedback.
-
In the end, I decided to simply strip out the "build": "vike build && find dist/client -name '*.html' -exec sed -i.bak '/<link[^>]*\\/vike-react-[^>]*>/d' {} \\; -exec rm {}.bak \\;" |
Beta Was this translation helpful? Give feedback.
-
Couldn't you do this though?
|
Beta Was this translation helpful? Give feedback.
The issue is that it's required for a component that is loaded with dependency injection; I can't think of a way to have that CSS to be loaded only when it's used.