mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
fix(release): harden desktop recovery workflows
This commit is contained in:
20
scripts/metro-config-windows-loader-patch.cjs
Normal file
20
scripts/metro-config-windows-loader-patch.cjs
Normal file
@@ -0,0 +1,20 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const Module = require("module");
|
||||
|
||||
const metroPackageRoot = path.dirname(require.resolve("metro-config/package.json"));
|
||||
const metroLoadConfigPath = path.join(metroPackageRoot, "src", "loadConfig.js");
|
||||
const originalJsLoader = Module._extensions[".js"];
|
||||
|
||||
Module._extensions[".js"] = function patchedMetroConfigLoader(module, filename) {
|
||||
if (filename === metroLoadConfigPath) {
|
||||
let source = fs.readFileSync(filename, "utf8");
|
||||
source = source.replace(
|
||||
"const configModule = await import(absolutePath);",
|
||||
"const { pathToFileURL } = require('node:url');\n const configModule = await import(pathToFileURL(absolutePath).href);",
|
||||
);
|
||||
return module._compile(source, filename);
|
||||
}
|
||||
|
||||
return originalJsLoader(module, filename);
|
||||
};
|
||||
Reference in New Issue
Block a user