mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Introduce bytecode caching, polish "cjs" bundler output format (#14232)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
This commit is contained in:
@@ -715,6 +715,23 @@ static JSValue fetchESMSourceCode(
|
||||
return reject(exception);
|
||||
}
|
||||
|
||||
// This can happen if it's a `bun build --compile`'d CommonJS file
|
||||
if (res->result.value.isCommonJSModule) {
|
||||
auto created = Bun::createCommonJSModule(globalObject, specifierJS, res->result.value);
|
||||
|
||||
if (created.has_value()) {
|
||||
return rejectOrResolve(JSSourceCode::create(vm, WTFMove(created.value())));
|
||||
}
|
||||
|
||||
if constexpr (allowPromise) {
|
||||
auto* exception = scope.exception();
|
||||
scope.clearException();
|
||||
return rejectedInternalPromise(globalObject, exception);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
auto moduleKey = specifier->toWTFString(BunString::ZeroCopy);
|
||||
|
||||
auto tag = res->result.value.tag;
|
||||
|
||||
Reference in New Issue
Block a user