mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 18:43:44 +00:00
Embrace the defaults! --------- Co-authored-by: Yuji Sugiura <y.sugiura.0316@gmail.com>
21 lines
470 B
JavaScript
21 lines
470 B
JavaScript
import fs from "node:fs";
|
|
import { join as pathJoin } from "node:path";
|
|
|
|
const path = pathJoin(import.meta.dirname, "../index.js");
|
|
|
|
let data = fs.readFileSync(path, "utf-8");
|
|
data = data.replace(
|
|
"\nif (!nativeBinding) {",
|
|
(s) =>
|
|
`
|
|
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
|
|
try {
|
|
nativeBinding = require('./webcontainer-fallback.cjs');
|
|
} catch (err) {
|
|
loadErrors.push(err)
|
|
}
|
|
}
|
|
` + s,
|
|
);
|
|
fs.writeFileSync(path, data);
|