A Vite plugin that works around a Vue 3 bug where styles are not properly hoisted for custom elements (CE). It injects CSS into the main bundle entry file instead of relying on scoped styles. Version 0.1.3 is the latest and only release. The plugin is experimental, lacks unit tests, and has specific caveats: CSS imports outside SFCs break the build, and it only works with a limited set of configurations. It differs from alternative solutions by being a targeted patch for a specific Vue 3 issue with custom elements.
npm install vite-plugin-vue-hoist-ce-stylesVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin with Vue's custom element mode and specify the host component.
Avoid using global CSS imports; rely on SFC <style> or CSS modules.
Use the indexRe option to match your entry file, or rename entry to 'index'.
Test thoroughly before deploying. Consider alternative solutions for custom element styles.
Set indexRe option to match your entry file name, e.g., { indexRe: /my-entry.js/ }.Remove global CSS imports; only use SFC styles or CSS modules.
No dependency data recorded yet.