google / google/closure-compiler

Support es6 exports from --entry_point

Open
#4,167 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Support `export` statements from the entry point file. This will enable many requested features such as
- import chunking (e.g., [Dynamic Import Support](https://docs.google.com/document/d/1thSbGV5i96jltVwn76KYrPkWoNc-yj_KU3HtBGUCgMc/edit#heading=h.c037si364tjn))
- dynamic import

while giving the user precise control.

Given a file

```javascript
// entry.js
import { m1, m2 } from "./mod"
...
...
export { sym1, ..., symN }
export default symDefault;
```

When compiled with
```shell
google-closure-compiler -O ADVANCED --js mod.js entry.js --entry_point entry.js --module_resolution NODE
```
should output a file containing `export { sym1, ..., symN, symDefault as default}`.

Currently, this behavior can be achieved by assigning each exported symbol to `globalThis` in a preprocessing step and then replacing each such assignment in the compiled file to an export statement in a postprocessing step.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.