Firefox is stuck on "migrating database"
Closed this issue · 2 comments
rphlmr commented
rphlmr commented
Ok, this is because Firefox is unable to require
non node_modules imports.
I need to rework a patch on drizzle-kit
rphlmr commented
Fix:
In Drizzle kit, bin:
prepareFromPgImports
diff --git a/node_modules/drizzle-kit/bin.cjs b/node_modules/drizzle-kit/bin.cjs
index 142ed9c..769ae16 100755
--- a/node_modules/drizzle-kit/bin.cjs
+++ b/node_modules/drizzle-kit/bin.cjs
@@ -21211,7 +21211,10 @@ var init_pgImports = __esm({
const { unregister } = await safeRegister();
for (let i2 = 0; i2 < imports.length; i2++) {
const it = imports[i2];
- const i0 = require(`${it}`);
+ const fs = require("fs");
+ const esbuild = require("esbuild");
+ const { code } = await esbuild.transform(fs.readFileSync(it, 'utf8'), {loader: "ts", format:"cjs"});
+ const i0 = eval(code);
const prepared = prepareFromExports2(i0);
tables.push(...prepared.tables);
enums.push(...prepared.enums);