From df2a783f3950e7da6aa9ce166404c85bb2b27dde Mon Sep 17 00:00:00 2001 From: Jeramy Hing Date: Tue, 2 Apr 2024 10:31:15 -0400 Subject: [PATCH] Fix ESM import path for Windows compatibility in resolveTailwindConfig (#123) * Used `pathToFileURL` to convert `CONFIGPATH` to a valid `file://` URL before importing. * This modification ensures the dynamic import function works as expected on Windows by conforming to the required URL scheme. * Resolves https://github.com/area17/blast/issues/122 --- src/resolveTailwindConfig.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/resolveTailwindConfig.js b/src/resolveTailwindConfig.js index 71a0cbd..5d80f66 100644 --- a/src/resolveTailwindConfig.js +++ b/src/resolveTailwindConfig.js @@ -21,7 +21,10 @@ function parseConfig(data) { async function resolveTailwindConfig() { const fs = await import('fs'); const { default: resolveConfig } = await import('tailwindcss/resolveConfig.js') - const { default: config } = await import(process.env.CONFIGPATH) + + const { pathToFileURL } = await import('url'); + const configPath = pathToFileURL(process.env.CONFIGPATH).href; + const { default: config } = await import(configPath) const fullConfig = resolveConfig(config);