Skip to content

Commit 60f619e

Browse files
committed
fix: withDefaults alias
1 parent 05f17b9 commit 60f619e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/compiler-sfc/src/script/context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { SFCDescriptor } from '../parse'
33
import { generateCodeFrame, isArray } from '@vue/shared'
44
import { type ParserPlugin, parse as babelParse } from '@babel/parser'
55
import type { ImportBinding, SFCScriptCompileOptions } from '../compileScript'
6-
import { DEFINE_PROPS, type PropsDestructureBindings } from './defineProps'
6+
import { DEFINE_PROPS, type PropsDestructureBindings, WITH_DEFAULTS } from './defineProps'
77
import { DEFINE_MODEL, type ModelDecl } from './defineModel'
88
import type { BindingMetadata } from '../../../compiler-core/src'
99
import MagicString from 'magic-string'
@@ -33,6 +33,7 @@ export class ScriptCompileContext {
3333
userImports: Record<string, ImportBinding> = Object.create(null)
3434
macrosAliases: Record<string, string | undefined> = {
3535
[DEFINE_PROPS]: DEFINE_PROPS,
36+
[WITH_DEFAULTS]: WITH_DEFAULTS,
3637
[DEFINE_EMITS]: DEFINE_EMITS,
3738
[DEFINE_EXPOSE]: DEFINE_EXPOSE,
3839
[DEFINE_OPTIONS]: DEFINE_OPTIONS,

packages/compiler-sfc/src/script/defineProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function processWithDefaults(
9696
node: Node,
9797
declId?: LVal,
9898
): boolean {
99-
if (!isCallOf(node, WITH_DEFAULTS)) {
99+
if (!isCallOf(node, ctx.macrosAliases[WITH_DEFAULTS])) {
100100
return false
101101
}
102102
if (!processDefineProps(ctx, node.arguments[0], declId)) {

0 commit comments

Comments
 (0)