Skip to content

Commit

Permalink
Fix ESM import path for Windows compatibility in resolveTailwindConfig (
Browse files Browse the repository at this point in the history
#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 #122
  • Loading branch information
jeramyhing authored Apr 2, 2024
1 parent 13a6e20 commit df2a783
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/resolveTailwindConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit df2a783

Please sign in to comment.