diff --git a/packages/compiler-sfc/src/style/pluginScoped.ts b/packages/compiler-sfc/src/style/pluginScoped.ts index e64b5c4510b..0c7e5e99418 100644 --- a/packages/compiler-sfc/src/style/pluginScoped.ts +++ b/packages/compiler-sfc/src/style/pluginScoped.ts @@ -256,12 +256,7 @@ function rewriteSelector( // global: replace with inner selector and do not inject [id]. // ::v-global(.foo) -> .foo if (value === ':global' || value === '::v-global') { - let last = selector - n.nodes.forEach(_node => { - selectorRoot.insertAfter(last, _node) - last = _node - }) - selectorRoot.removeChild(selector) + selector.replaceWith(...n.nodes) return false } }