From 3a75d5d6942a1743789192dca9161f7c30a71e58 Mon Sep 17 00:00:00 2001 From: edison Date: Mon, 26 Jul 2021 23:19:56 +0800 Subject: [PATCH] fix(sfc/style-vars): should ignore style variable bindings in comments (#4188) fix #4185 --- .../__tests__/__snapshots__/cssVars.spec.ts.snap | 11 +++++++++++ packages/compiler-sfc/__tests__/cssVars.spec.ts | 13 +++++++++++++ packages/compiler-sfc/src/cssVars.ts | 4 +++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap index 0c6a96a0..9616b8fd 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap @@ -49,6 +49,17 @@ __default__.setup = __setup__ export default __default__" `; +exports[`CSS vars injection codegen should ignore comments 1`] = ` +"export default { + setup(__props, { expose }) { + expose() +const color = 'red' +return { color } +} + +}" +`; + exports[`CSS vars injection codegen w/ \n` + + `` + ) + + expect(content).not.toMatch(`_useCssVars`) + assertCode(content) + }) + test('w/