Pass file instead of path to importToPlatformApi builders#17816
Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom Feb 23, 2026
Merged
Conversation
nicolo-ribaudo
commented
Feb 20, 2026
| throw path.buildCodeFrameError( | ||
| buildFetch = (specifier, file) => { | ||
| throw file.buildCodeFrameError( | ||
| specifier, |
Member
Author
There was a problem hiding this comment.
This now points to the specifier, before it would point to the whole file (since we always passed in the program path).
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60969 |
|
commit: |
This was referenced Feb 20, 2026
JLHwung
reviewed
Feb 20, 2026
Contributor
JLHwung
left a comment
There was a problem hiding this comment.
On the interface change, do you think during the lifetime of Babel 8 we will have to transform JSON module imports within module declaration or module expression? If so we may have to pass file and program path separately.
Member
Author
|
If that happens I think we can add a third |
liuxingbaoyu
approved these changes
Feb 20, 2026
JLHwung
approved these changes
Feb 23, 2026
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.
Fixes #1, Fixes #2I'm working on support for https://github.com/tc39/proposal-import-bytes, and it would be helpful to have the
filepassed to the "Pieces builders" so that I can easily inject helpers in there.This is technically a breaking change, but it's unobservable for users that are not manually using the helper package, given that right now versions are pinned. I'm opening this as its own PR because we need to ship it at latest in 8.0.0, when we'll stop pinning dependencies.