google / google/closure-compiler
Compiler crash for dynamic imports importing goog.module
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
a.js
```js
goog.module('a');
import('./b.js').then(out => {
console.log(out.b);
});
```
b.js
```js
goog.module('b');
/** @type {number} */
exports.b = 1;
```
compiler flags
```
--language_in=ECMASCRIPT_2020
--language_out=ECMASCRIPT_2020
--chunk_output_type=ES_MODULES
--emit_use_strict=false
--js=b.js
--chunk=b_out:1
--js=a.js
--chunk=a_out:1:b_out
```
Then the compiler crashes with a message to report it.
On a related note, I have a question: Is dynamic import supposed to work in goog.module? Or is it supposed to use some other Closure Library function to achieve on-demand loading of other goog.modules?
Contributor guide
Assessment
This issue has not been assessed yet.