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

Support es6 exports from --entry_point #4167

Open
KimlikDAO-bot opened this issue May 30, 2024 · 2 comments
Open

Support es6 exports from --entry_point #4167

KimlikDAO-bot opened this issue May 30, 2024 · 2 comments

Comments

@KimlikDAO-bot
Copy link
Contributor

Support export statements from the entry point file. This will enable many requested features such as

while giving the user precise control.

Given a file

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

When compiled with

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.

@amitdhiman000
Copy link

Closure compiler is stripping off the default exports. Facing this problem with emscripten generated ES6 code.
When are we getting this feature ? Or at-least a workaround ?

@KimlikDAO-bot
Copy link
Contributor Author

KimlikDAO-bot commented Aug 19, 2024

At KimlikDAO we have a wrapper around Google Closure Compiler called kdjs which supports

  • export statements
  • import statements that are to be left as is (not "linked" or packaged in)

This or something like this could help you.
https://github.com/KimlikDAO/kimlikdao-js/tree/ana/kdjs

Using this you can compile a fully fledged es6 module having both import and export statements and is type checked an optimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants