From 864f915d4cba65f3c7352d3c0cef532ac9f820a0 Mon Sep 17 00:00:00 2001 From: Dani Guardiola Date: Fri, 1 Mar 2024 10:52:40 +0100 Subject: [PATCH] Address dirname suggestion in internal codegen script (#1947) --- .../src/generate-tailwind-preset.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts b/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts index 5afb98bb55b7..3dba3d2c6c93 100644 --- a/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts +++ b/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts @@ -2,6 +2,7 @@ // requires Bun installed globally: bun.sh import path from "node:path"; +import { fileURLToPath } from "node:url"; import { readPackageUp } from "read-package-up"; import { introspectTailwindConfig } from "./introspect.js"; import { type SortConfig, sortConfigFromSpec } from "./sort-config.js"; @@ -58,7 +59,7 @@ function generateFile(sortConfig: SortConfig) { } async function findRoot() { - let nextPath = import.meta.dir; + let nextPath = path.dirname(fileURLToPath(import.meta.url)); let rootPath: string | false = false; while (!rootPath) { const pkg = await readPackageUp({ cwd: nextPath });