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
ReferenceError: Cannot access uninitialized variable #2927
Comments
sad i thought we fixed these in the meantime, can you try |
@Jarred-Sumner Thanks for the fast response. That does seem to help but this leads to another bug (perhaps related to #1511 #1811). The bundle contains these lines:
Which throws the following:
edit: Swapping those brotli functions with empty functions gets the server running but of course without brotliCompress/Decompress so its technically broken still. |
This is bizarre. Happens to me on Tried |
I'm also running into this. Some findings:
I'm guessing this might be related to something changing in the WebKit fork or when upgrading Safari on the Mac(?). How are the dependencies resolved here @Jarred-Sumner? I think it would be best if WebKit is bundled (or at least deterministically resolved) together with the bun version. Frustrating to have working code one day and the next it's broken, with seemingly the same environment (exactly same code and bun version). Update: Another possibility: Could it possibly be related to some kind of caching behaviour on the TypeScript config side? My computer might have restarted between it working, not working and working again 🤔 |
Same for me: bun v1.0.20
|
any update? |
Somehow we've gotten past this. Not quite sure what changed though, a restart of my laptop was involved I believe. |
i hope that will fix soon. But i am using unknown as type @ManyToOne(() => Role, (role) => role.translations)
@JoinColumn({ name: "role_id" })
role: unknown; |
Got a similar issue running a test suite using Bun version for both CI and local environments: Aside from the Local test runs seem to respect import dependency patterns (test files with dependencies run after their imports), whereas CI test runs do not seem to respect that pattern. |
Wow, just found the root issue. We had a run-away @ts-expect-error ignoring a variable that didn't exist. The really weird part here is that it sometimes passed - sometimes not. |
Still not fixed? I have this issue with TypeORM. This error appears from nowhere. |
I've been hitting this as well trying to port a larger project from nodejs to bun. Along with frequently hitting the nebulous segmentation fault errors as well (although re-arranging code in seemingly random ways seems to resolve these). But in regard to
Then somewhere below this code you will see Is there some way to control this aspect of the bundler? Perhaps force it to make another sweep to reorder some of the bundled code to ensure the classes are declared before being referenced? |
FYI - I used madge to look for any circular dependencies in my typegoose models and correcting those resolved the problem for me. |
same error for me |
I keep getting this when using decorators in MikroORM, like so: @Entity()
export default class Category extends BaseEntity {
@ManyToOne(() => CategoryGroup, { deleteRule: "cascade" })
categoryGroup!: CategoryGroup; // ReferenceError: Cannot access uninitialized variable.
} My workaround is to use a type alias in the annotation: type CategoryGroupEntity = CategoryGroup;
@Entity()
export default class Category extends BaseEntity {
@ManyToOne(() => CategoryGroup, { deleteRule: "cascade" })
categoryGroup!: CategoryGroupEntity; // works fine
} |
I'm getting this when using a for loop in Bun version 1.1.4
|
What version of Bun is running?
0.6.1
What platform is your computer?
Darwin 21.6.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
The server should start and output the following.
Example by running
npm start
(without bun)What do you see instead?
bun run server.ts
Additional information
No response
The text was updated successfully, but these errors were encountered: