VaporLifecycleHooks is undefined
xiaodong2008 opened this issue · comments
XiaoDong commented
packages/runtime-vapor/src/errorHandling.ts
import { VaporLifecycleHooks } from './apiLifecycle'
console.log(VaporLifecycleHooks) // undefined
export const ErrorTypeStrings: Record<ErrorTypes, string> = {
[VaporLifecycleHooks.BEFORE_MOUNT]: 'beforeMount hook',
[VaporLifecycleHooks.MOUNTED]: 'mounted hook',
[VaporLifecycleHooks.BEFORE_UPDATE]: 'beforeUpdate hook',
// ...
Error Output
FAIL packages/runtime-vapor/__tests__/errorHandling.spec.ts [ packages/runtime-vapor/__tests__/errorHandling.spec.ts ]
TypeError: Cannot read properties of undefined (reading 'BEFORE_MOUNT')
❯ packages/runtime-vapor/src/errorHandling.ts:49:24
47| export const ErrorTypeStrings: Record<ErrorTypes, string> = {
48| // [VaporLifecycleHooks.SERVER_PREFETCH]: 'serverPrefetch hook',
49| [VaporLifecycleHooks.BEFORE_MOUNT]: 'beforeMount hook',
| ^
50| [VaporLifecycleHooks.MOUNTED]: 'mounted hook',
51| [VaporLifecycleHooks.BEFORE_UPDATE]: 'beforeUpdate hook',
❯ packages/runtime-vapor/src/warning.ts:4:31
XiaoDong commented
I think this problem is caused by circular dependencies.
Report:
5) src/component.ts > src/apiCreateVaporApp.ts > src/apiInject.ts > src/warning.ts > src/errorHandling.ts > src/apiLifecycle.ts
6) src/errorHandling.ts > src/apiLifecycle.ts
7) src/warning.ts > src/errorHandling.ts > src/apiLifecycle.ts
8) src/component.ts > src/apiCreateVaporApp.ts > src/apiInject.ts > src/warning.ts > src/errorHandling.ts
9) src/warning.ts > src/errorHandling.ts