Properly parse export default from when exportDefaultFrom is not enabled (#11676)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -251,6 +251,23 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
return super.parseExport(node);
|
||||
}
|
||||
|
||||
isExportDefaultSpecifier(): boolean {
|
||||
if (this.match(tt._default)) {
|
||||
const next = this.nextTokenStart();
|
||||
if (this.isUnparsedContextual(next, "from")) {
|
||||
if (
|
||||
this.input.startsWith(
|
||||
tt.placeholder.label,
|
||||
this.nextTokenStartSince(next + 4),
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.isExportDefaultSpecifier();
|
||||
}
|
||||
|
||||
maybeParseExportDefaultSpecifier(node: N.Node): boolean {
|
||||
if (node.specifiers && node.specifiers.length > 0) {
|
||||
// "export %%NAME%%" has already been parsed by #parseExport.
|
||||
|
||||
Reference in New Issue
Block a user