Skip to content

🐛 Fixed hot reloading in Bun#1834

Open
iMrDJAi wants to merge 3 commits intosamchon:masterfrom
iMrDJAi:master
Open

🐛 Fixed hot reloading in Bun#1834
iMrDJAi wants to merge 3 commits intosamchon:masterfrom
iMrDJAi:master

Conversation

@iMrDJAi
Copy link
Copy Markdown

@iMrDJAi iMrDJAi commented May 3, 2026

In this PR I have implemented the suggested workaround (oven-sh/bun#4689 (comment)) to restore HMR and file watching functionalities. Currently --watch/--hot flags don't work for Bun setups that use plugins. I have tested and I confirm that this workaround does indeed fix the issue.

I also rectified the ITransformOptions import path in @typia/unplugin and restored type intellisense in plugin options.

@iMrDJAi
Copy link
Copy Markdown
Author

iMrDJAi commented May 3, 2026

@samchon Since you're actively working on the project right now, could you please take a look?

Comment thread packages/unplugin/src/core/options.ts Outdated
@@ -1,5 +1,5 @@
import type { FilterPattern } from "@rollup/pluginutils";
import type { ITransformOptions } from "@typia/core";
import type { ITransformOptions } from "../../../core/lib/context/ITransformOptions.js";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rolback please

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But this needs to be solved in one way or another. That line is completely missing from options.d.ts since @typia/core package cannot be solved at built time.

image

const id = wrap<ID>(args.path);

const source = wrap<Source>(await Bun.file(id).text());
const source = wrap<Source>((await import(`${args.path}?`, { with: { type: 'text' } })).default);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make a test function about this one?

@ryoppippi How do you think about this edition?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samchon How would you like to make it? Do you want a function to compare the output of both Bun.file() and import()?

Copy link
Copy Markdown
Owner

@samchon samchon May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I am not using, I don't know which way is proper.

But as you are saying it worked properly, it seems no problem. I will publish 12.1.1 tomorrow if the unplugin test passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants