Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-sfc): use correct importer with useCssVars #1658

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default __define__({
exports[`SFC compile <script setup> CSS vars injection <script> w/ default export 1`] = `
"const __default__ = { setup() {} }
import { useCSSVars as __useCSSVars__ } from 'vue'
import { useCssVars as __useCssVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
Expand All @@ -123,7 +123,7 @@ exports[`SFC compile <script setup> CSS vars injection <script> w/ default expor
// export default {}
const __default__ = {}
import { useCSSVars as __useCSSVars__ } from 'vue'
import { useCssVars as __useCssVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
Expand All @@ -137,7 +137,7 @@ export default __default__"
exports[`SFC compile <script setup> CSS vars injection <script> w/ no default export 1`] = `
"const a = 1
const __default__ = {}
import { useCSSVars as __useCSSVars__ } from 'vue'
import { useCssVars as __useCssVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ export function compileScript(
returned = `Object.assign(\n ${returned}\n)`
}

// inject `useCSSVars` calls
// inject `useCssVars` calls
if (hasCssVars) {
s.prepend(`import { useCssVars as __useCssVars__ } from 'vue'\n`)
for (const style of styles) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/genCssVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function injectCssVarsCalls(

return (
script +
`\nimport { useCSSVars as __useCSSVars__ } from 'vue'\n` +
`\nimport { useCssVars as __useCssVars__ } from 'vue'\n` +
`const __injectCSSVars__ = () => {\n${calls}}\n` +
`const __setup__ = __default__.setup\n` +
`__default__.setup = __setup__\n` +
Expand Down