[@babel/parser] Add "allowUndeclaredExports" option (#9864)
Ref: https://github.com/babel/notes/blob/master/2019/04/09.md#export-changes-in-scope-pr-break-meteor-issue
This commit is contained in:
@@ -45,7 +45,11 @@ export default class StatementParser extends ExpressionParser {
|
||||
|
||||
this.parseBlockBody(program, true, true, tt.eof);
|
||||
|
||||
if (this.inModule && this.scope.undefinedExports.size > 0) {
|
||||
if (
|
||||
this.inModule &&
|
||||
!this.options.allowUndeclaredExports &&
|
||||
this.scope.undefinedExports.size > 0
|
||||
) {
|
||||
for (const [name] of Array.from(this.scope.undefinedExports)) {
|
||||
const pos = this.scope.undefinedExports.get(name);
|
||||
// $FlowIssue
|
||||
|
||||
Reference in New Issue
Block a user