Embed React Fast Refresh in Bun

Fixes https://github.com/Jarred-Sumner/bun/issues/62

If the project has it's own copy of react fast refresh and is bundling, it will use that instead.
This commit is contained in:
Jarred Sumner
2022-01-29 23:48:39 -08:00
parent 711e0cef78
commit 857e9bee00
14 changed files with 327 additions and 80 deletions

View File

@@ -152,8 +152,8 @@ pub const NodeModuleBundle = struct {
}
pub fn getPackage(this: *const NodeModuleBundle, name: string) ?*const Api.JavascriptBundledPackage {
const package_id = this.getPackageID(name) orelse return null;
return &this.bundle.packages[@intCast(usize, package_id)];
const package_id = this.getPackageIDByName(name) orelse return null;
return &this.bundle.packages[@intCast(usize, package_id[0])];
}
pub fn hasModule(this: *const NodeModuleBundle, name: string) ?*const Api.JavascriptBundledPackage {