diff --git a/packages/compiler-core/__tests__/transforms/vOn.spec.ts b/packages/compiler-core/__tests__/transforms/vOn.spec.ts
index 218281ba7..746cfc2a0 100644
--- a/packages/compiler-core/__tests__/transforms/vOn.spec.ts
+++ b/packages/compiler-core/__tests__/transforms/vOn.spec.ts
@@ -437,22 +437,22 @@ describe('compiler: transform v-on', () => {
})
})
- // TODO remove in 3.4
- test('case conversion for vnode hooks', () => {
- const { node } = parseWithVOn(`
`)
- expect((node.codegenNode as VNodeCall).props).toMatchObject({
- properties: [
- {
- key: {
- content: `onVnodeMounted`
- },
- value: {
- content: `onMount`
- }
+ test('error for vnode hooks', () => {
+ const onError = vi.fn()
+ parseWithVOn(``, { onError })
+ expect(onError.mock.calls[0][0]).toMatchObject({
+ code: ErrorCodes.X_VNODE_HOOKS,
+ loc: {
+ start: {
+ line: 1,
+ column: 11
+ },
+ end: {
+ line: 1,
+ column: 24
}
- ]
+ }
})
- expect('@vnode-* hooks in templates are deprecated').toHaveBeenWarned()
})
test('vue: prefixed events', () => {
diff --git a/packages/compiler-core/src/errors.ts b/packages/compiler-core/src/errors.ts
index ac11b7e3d..7090a5a26 100644
--- a/packages/compiler-core/src/errors.ts
+++ b/packages/compiler-core/src/errors.ts
@@ -90,6 +90,7 @@ export enum ErrorCodes {
X_V_MODEL_ON_PROPS,
X_INVALID_EXPRESSION,
X_KEEP_ALIVE_INVALID_CHILDREN,
+ X_VNODE_HOOKS,
// generic errors
X_PREFIX_ID_NOT_SUPPORTED,
@@ -98,7 +99,6 @@ export enum ErrorCodes {
X_SCOPE_ID_NOT_SUPPORTED,
// deprecations
- DEPRECATION_VNODE_HOOKS,
DEPRECATION_V_IS,
// Special value for higher-order compilers to pick up the last code
@@ -176,6 +176,7 @@ export const errorMessages: Record = {
[ErrorCodes.X_V_MODEL_ON_PROPS]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
[ErrorCodes.X_INVALID_EXPRESSION]: `Error parsing JavaScript expression: `,
[ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN]: ` expects exactly one child component.`,
+ [ErrorCodes.X_VNODE_HOOKS]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
// generic errors
[ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
@@ -184,7 +185,6 @@ export const errorMessages: Record = {
[ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED]: `"scopeId" option is only supported in module mode.`,
// deprecations
- [ErrorCodes.DEPRECATION_VNODE_HOOKS]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
[ErrorCodes.DEPRECATION_V_IS]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
// just to fulfill types
diff --git a/packages/compiler-core/src/transforms/vOn.ts b/packages/compiler-core/src/transforms/vOn.ts
index 3deee2024..1c15675ce 100644
--- a/packages/compiler-core/src/transforms/vOn.ts
+++ b/packages/compiler-core/src/transforms/vOn.ts
@@ -44,9 +44,7 @@ export const transformOn: DirectiveTransform = (
if (arg.isStatic) {
let rawName = arg.content
if (__DEV__ && rawName.startsWith('vnode')) {
- context.onWarn(
- createCompilerError(ErrorCodes.DEPRECATION_VNODE_HOOKS, arg.loc)
- )
+ context.onError(createCompilerError(ErrorCodes.X_VNODE_HOOKS, arg.loc))
}
if (rawName.startsWith('vue:')) {
rawName = `vnode-${rawName.slice(4)}`