From b5eae794d3d4c6a68e52dd41607bef1b81a3f297 Mon Sep 17 00:00:00 2001 From: Misha Kaletsky Date: Tue, 27 Aug 2024 10:09:23 -0400 Subject: [PATCH] fileURLToPath --- examples/0.5-vanilla-esm/migrate.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/0.5-vanilla-esm/migrate.mjs b/examples/0.5-vanilla-esm/migrate.mjs index bbecb417..21a007f1 100644 --- a/examples/0.5-vanilla-esm/migrate.mjs +++ b/examples/0.5-vanilla-esm/migrate.mjs @@ -1,8 +1,7 @@ import { Umzug, JSONStorage } from 'umzug'; +import { fileURLToPath } from 'url' -const __dirname = new URL('.', import.meta.url).pathname.replace(/\/$/, ''); - -if (Math.random()) throw new Error(`__dirname: ${__dirname}`) +const __dirname = fileURLToPath(new URL('.', import.meta.url)) export const migrator = new Umzug({ migrations: {