Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(@babel/parser): Document allowUndeclaredExports option. #2047

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/parser.md
Expand Up @@ -46,6 +46,14 @@ mind. When in doubt, use `.parse()`.
outside of class and object methods. Set this to `true` to accept such
code.

- **allowUndeclaredExports**: By default, exporting an identifier that was
not declared in the current module scope will raise an error. While this
behavior is required by the ECMAScript modules specification, Babel's
parser cannot anticipate transforms later in the plugin pipeline that
might insert the appropriate declarations, so it is sometimes important
to set this option to `true` to prevent the parser from prematurely
complaining about undeclared exports that will be added later.

- **sourceType**: Indicate the mode the code should be parsed in. Can be
one of `"script"`, `"module"`, or `"unambiguous"`. Defaults to `"script"`. `"unambiguous"` will make @babel/parser attempt to _guess_, based on the presence of ES6 `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`.

Expand Down