Open eirikur-nc opened 2 weeks ago
Latest commit: c4a1bf95d132192dd693f49d52e901c1464d80d4
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Description
Use a dynamic
import
when loading custom loaders in order to support loaders in ESM format. Retain the original implementation, which relies oncreateRequire
, for the synchronous versionuseCustomLoaderSync
Related #6656
Type of change
How Has This Been Tested?
I could not reproduce the issue using Jest, as it transpiles esm to commonjs.
To keep transpilation to a minimum, I added a test that can be run using the Node.js test runner with type-stripping enabled (requires version 22.6 or later). I also added a convenience script to the root package.json file so that the test can be run using
yarn test:node
I realize that having to use two test runners is not ideal. I'm open to suggestions if there's a simpler way to demonstrate the effectiveness of this fix.
Checklist: