unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
MIT License
3.09k stars 192 forks source link

Cannot access 'xxx' before initialization #481

Open baixiaoyu2997 opened 3 months ago

baixiaoyu2997 commented 3 months ago

Describe the bug

can'n start dev server, according to my tests, this problem is related to the composables/useContract function. It should be caused by the fact that useContract has the same name as the parameter in sdk/util/common.ts. When I try to delete default in useContract After that, this error will not occur.

error in console :

Uncaught ReferenceError: Cannot access 'commonOwner' before initialization
    at optionFactoryContract.ts:3:22
client.ts:103 [vite] server connection lost. polling for restart...

Reproduction

https://stackblitz.com/edit/vitejs-vite-ep9btn?file=src%2Fcomposables%2FuseContract.ts

test step:

  1. npm run dev
  2. check console

System Info

stackblitz

Used Package Manager

npm

Validations

stackblitz[bot] commented 3 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.