Skip to content

Introduced support of modules #13

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

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Conversation

catap
Copy link

@catap catap commented May 25, 2021

Here a bit tricky code. Let me start from use-case.

Let image that I made a library that should be compiled to JS code which checking in runtime where it is running: on DOM, NodeJS, etc.

Some features inside nodeJS are available only via requirements.

Right now it is possibly to get access to it via js.Dynamic.global.

But it isn't possible to get access via typed like @JSImport because it fails on linking with error like:

Unsupported input: List(CommonJSModule([some path]/main.js))

So, here a trivial changes that allows to mix withModuleKind(ModuleKind.CommonJSModule) with this jsEnv.

I also added a test to proove that it works, and explain how it works.

Here a bit tricky code. Let me start from use-case.

Let image that I made a library that should be compiled to JS code which
checking in runtime where it is running: on DOM, NodeJS, etc.

Some features inside nodeJS are available only via requirements.

Right now it is possibly to get access to it via `js.Dynamic.global`.

But it isn't possible to get access via typed like `@JSImport` because
it fails on linking with error like:
```
Unsupported input: List(CommonJSModule([some path]/main.js))
```

So, here a trivial changes that allows to mix
`withModuleKind(ModuleKind.CommonJSModule)` with this `jsEnv`.

I also added a test to proove that it works, and explain how it works.
@catap catap force-pushed the modules-support branch from 2219dc5 to 796f6e0 Compare May 25, 2021 20:05
Copy link
Owner

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks 👍

@exoego exoego merged commit ec70d3c into exoego:master Jun 7, 2021
@exoego exoego added the enhancement New feature or request label Jun 7, 2021
@catap
Copy link
Author

catap commented Jun 7, 2021

@exoego thanks! I hope that you will release it soon :)

@exoego
Copy link
Owner

exoego commented Jun 7, 2021

@catap v2.1.0 was released to Sonatype.

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

Successfully merging this pull request may close these issues.

2 participants