fix(generate-palette): fix ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows - #2
Merged
Merged
Conversation
craftzdog
requested changes
Aug 8, 2026
|
|
||
| async function extractPalette(outputPath: string) { | ||
| const themePackageJson = ( | ||
| await import(path.join(process.cwd(), 'package.json'), { with: { type: 'json' } }) |
Contributor
There was a problem hiding this comment.
pathToFileURL return a URL object. So I think it needs .href like:
await import(pathToFileURL(path.join(process.cwd(), 'package.json')).href, {
with: { type: 'json' }
})
Contributor
Author
There was a problem hiding this comment.
I've updated the fix, it will convert the URL to string, thanks.
Contributor
|
Thanks, @khouwdevin ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Takuya-san,
I found an issue when I migrate theme plugin on Windows, it's error on generate palette, the error was:
Error extracting palette: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'and I'm able to fix it with add pathToFileURL on the import. I'm not able to test on macOS, so it would be great if someone could verify it there too.