-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add the possibility for a plugin to modify the loaded source before processing (T7222) #4187
Copy link
Copy link
Closed
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Issue originally made by Alpha Page (alphapage)
Description
Hello,
Babylon is locked and don't provide any plugin system to interact like acorn for example. So, if you implement a new syntax, the parser throws an error because it doesn't know about the new syntax.
It would be very usefull to be able to preprocess the source via a plugin before babylon parser.
Something like this:
export function load(source) {
// optionally also set the sourceMap
source.sourceMap = generatedSourceMap;
// the modified code
source.code = generatedCode;
return source;
}
I think this feature could improve Babel and hope this could help others.
Thanks in advance for your feedback.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue