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

How to import ES6 modules #202

Open
appsofteng opened this issue Oct 24, 2022 · 0 comments
Open

How to import ES6 modules #202

appsofteng opened this issue Oct 24, 2022 · 0 comments

Comments

@appsofteng
Copy link

How to use external ES6 modules with j2cl. In particular I tried Firebase web SDK version 9 which is written in TS and compiled into JS. It has multiple modules and some of them import another modules. I tried to compile them with closure but I didn't succeed.
The modules have either full http url or npm folder paths in the imports.

The externs work. The only problem is that I need to insert the Firebase imports later when the final closure resulting JS file is generated.
I tried to put the imports inside the externs JS file or the native.js file but it causes an error.

Therefore I use maven ant plugin to concat an external file containing import declaration with the final JS file. This solution works but does not go well with the j2cl plugin watch goal.

One solution could be to have a configuration of the j2cl maven plugin that would take a path to an external file with import declarations and insert the contents of the file at the beginning of the resulting JS after the compilation is done.

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

1 participant