pull/12374/head
Rich Harris 2 years ago
parent 434a6fe021
commit 0a6a54d661

@ -332,7 +332,7 @@ export function client_component(source, analysis, options) {
}
}
if (analysis.css.ast !== null && options.css === 'injected') {
if (analysis.css.ast !== null && analysis.inject_styles) {
const hash = b.literal(analysis.css.hash);
const code = b.literal(render_stylesheet(analysis.source, analysis, options).code);

@ -1,19 +1,10 @@
import { DEV } from 'esm-env';
import { queue_micro_task } from './task.js';
var seen = new Set();
/**
* @param {Node} anchor
* @param {{ hash: string, code: string }} css
*/
export function append_styles(anchor, css) {
// in dev, always check the DOM, so that styles can be replaced with HMR
if (!DEV) {
if (seen.has(css.hash)) return;
seen.add(css.hash);
}
// Use `queue_micro_task` to ensure `anchor` is in the DOM, otherwise getRootNode() will yield wrong results
queue_micro_task(() => {
var root = anchor.getRootNode();

Loading…
Cancel
Save