johnsoncodehk / tsslint

🔋⚡️ The fastest and lightest TypeScript semantic linting solution
MIT License
290 stars 2 forks source link

[Bug] Error ERR_UNSUPPORTED_ESM_URL_SCHEME #22

Closed joris-fonck-loreal closed 3 weeks ago

joris-fonck-loreal commented 2 months ago

Description

First of all, thank you for your amazing work for this tool, volar and other projects!

I'm trying to use tsslint on Windows and I got the following error when using the CLI:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'.

The error appear in watch.ts file line 23. The given imported file at line 21 is not using file:// protocol. But when I tried to put file protocol at the beginning of the path, I still have the same issue. So maybe it's because of the created hashed file in node_modules/.tsslint/<hash>.mjs. There are using c:// protocol to import files but I don't know how this file is generated so I didn't tested it.

johnsoncodehk commented 1 month ago

node_modules/.tsslint/<hash>.mjs will be rebuilt every time you execute tsslint command. When you added file:// and execute tsslint command again, node_modules/.tsslint/<hash>.mjs should be updated.

I'll try to test this issue on windows, and it would be helpful if you could provide a reproduction.

joris-fonck-loreal commented 1 month ago

Of course. Here is a repro: https://github.com/joris-fonck-loreal/tsslint-vscode-ext-repro

johnsoncodehk commented 3 weeks ago

Sorry for the delay, the problem should have been fixed in v1.0.20 by https://github.com/johnsoncodehk/tsslint/pull/23!