From e3b261700cb096f2cdcb4226fcd8198f6e0c2423 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 18 Jun 2019 17:03:49 -0400 Subject: [PATCH] docs(@babel/parser): Document allowUndeclaredExports option. Documents the changes from https://github.com/babel/babel/pull/9864 implemented by @nicolo-ribaudo. --- docs/parser.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/parser.md b/docs/parser.md index 5731716525..e0912a8629 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -46,6 +46,12 @@ 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. Set this + option to `true` to prevent the parser from complaining about undeclared + exports, if you are sure the appropriate declarations will be added by + transforms later in the plugin pipeline. + - **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"`.