Introduced support of modules #13
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:So, here a trivial changes that allows to mix
withModuleKind(ModuleKind.CommonJSModule)
with thisjsEnv
.I also added a test to proove that it works, and explain how it works.