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

ES6 module compatibility #58

Open
vorth opened this issue Sep 1, 2020 · 1 comment
Open

ES6 module compatibility #58

vorth opened this issue Sep 1, 2020 · 1 comment

Comments

@vorth
Copy link
Contributor

vorth commented Sep 1, 2020

I'm pulling J4TS into my project as a Maven dependency, and it works fine* as long as I use JSweet with module=none. If I turn on module=commonjs or module=es2015, the errors from the transpiler are very different, as if it couldn't see J4TS at all. Is there something else I need to do so that the J4TS dependency works with module=commonjs?

I saw somewhere in a README here that J4TS is "module compatible". It looks like that means it is published on NPM, so I suppose a commonjs module. I can see how I could benefit from that in my client build, but that doesn't help me transpile with J4TS.

I should note, I did find the language spec section on modules, but that seems to apply only to the "def" package for bindings, and it is not clear whether it addresses compile-time dependencies at all.

*I do get some errors about java.util.StringTokenizer, which now seem odd, since I see that StringTokenizer is part of J4TS.

@aolney
Copy link

aolney commented Jan 24, 2021

I resolved the StringTokenizer issue by copy/pasting the java implementation here:

https://github.com/j4ts/j4ts/blob/8a371ac068834d5d36dae762e2f197a160ca95bf/src/main/java/java/util/StringTokenizer.java

into a new class in my java project.

Similar to what you describe, I can build individual files and make a bundle, but if I use the es2015, I suddenly get hundreds of errors, e.g. Cannot find name 'ArrayList'.

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