diff --git a/CHANGELOG.md b/CHANGELOG.md index a3b35d6b..7dc5fce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Released: TBD ### New features ### Bug fixes +- [#490](https://github.com/peggyjs/peggy/issues/490) Throw error when imports are used in unsupported formats. Supported formats are now only "es" and "commonjs". 4.0.1 ----- diff --git a/docs/documentation.html b/docs/documentation.html index 5eddcdbf..44a1da73 100644 --- a/docs/documentation.html +++ b/docs/documentation.html @@ -746,8 +746,16 @@

Importing External Rules

grammar, NOT the source. Grammars MUST be compiled by a version that supports imports in order to be imported. Only rules that are allowed start rules are valid. It can be useful to specify - --allowed-start-rules \* in library grammars. All of the - following are valid:

+ --allowed-start-rules \* in library grammars. Imports are + only valid in output formats "es" and "commonjs". If you + use imports, you should use { output: "source" }; the default + output of "parser" will call `eval` on the source which fails immediately + for some formats (e.g. "es") and will not find modules in the expected + places for others (e.g. "commonjs"). The + from-mem project is + used by the Peggy CLI to resolve these issues, but note well its + relatively severe limitations.

+

All of the following are valid: