Closed TwoTau closed 1 year ago
Windows absolute file paths strike again :(
Before this PR, adding a transform in a project's package.json like this:
package.json
"transforms": [ { "name": "my-transform", "file": "src/my-transform.js" } ]
would cause this error (my drive is named Q:):
Q:
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 'q:'
because of https://github.com/nodejs/node/issues/31710.
This PR just uses the standard solution of pathToFileURL to load custom transforms correctly.
pathToFileURL
I think this is the only place we import an absolute path from path.resolve since everything else works for me
import
path.resolve
Windows absolute file paths strike again :(
Before this PR, adding a transform in a project's
package.json
like this:would cause this error (my drive is named
Q:
):because of https://github.com/nodejs/node/issues/31710.
This PR just uses the standard solution of
pathToFileURL
to load custom transforms correctly.