From 3df992120a6acad795e4533d1ba89ca12da686d8 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 15 Apr 2024 15:23:24 -0400 Subject: [PATCH] Fix detection of v4 projects on Windows (#265) * Use file url for dynamic imports * Update changelog --- CHANGELOG.md | 4 +++- src/config.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a1a5e..149fd55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Fix detection of v4 projects on Windows ([#265](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/265)) ## [0.5.13] - 2024-03-27 diff --git a/src/config.js b/src/config.js index d8c0fc2..81ae3f2 100644 --- a/src/config.js +++ b/src/config.js @@ -2,6 +2,7 @@ import * as fs from 'fs/promises' import { createRequire } from 'module' import * as path from 'path' +import { pathToFileURL } from 'url' import clearModule from 'clear-module' import escalade from 'escalade/sync' import postcss from 'postcss' @@ -181,8 +182,7 @@ async function loadV4(baseDir, pkgDir, entryPoint) { let pkgPath = localRequire.resolve('tailwindcss', { paths: [baseDir], }) - - let tw = await import(pkgPath) + let tw = await import(pathToFileURL(pkgPath).toString()) // This is not Tailwind v4 if (!tw.__unstable__loadDesignSystem) {