Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Distribute code with ES module syntax #381

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Distribute code with ES module syntax #381

merged 1 commit into from
Jul 11, 2022

Conversation

jonkoops
Copy link
Contributor

Closes #380. More information about pure ESM packages here.

edewit
edewit previously approved these changes Jan 27, 2022
@jonkoops jonkoops marked this pull request as ready for review January 27, 2022 11:26
@jonkoops
Copy link
Contributor Author

Everything is compiling as expected and the tests are passing, however this code will not yet work as expected when consumed. The reason for this is that a file extension is required (see 'Mandatory file extensions' in the NodeJS documentation).

The TypeScript compiler does not support this as it is a design choice to ensure that JS code is not transformed microsoft/TypeScript#15479 (comment). So we'lll have to come up with a solution to transform the code accordingly.

@jonkoops
Copy link
Contributor Author

Looks like the nightly version of TypeScript has support for this new module convention in NodeJS (see the documentation). This feature was supposed to land in version 4.5 but has been deferred due to to concerns over developer experience (more in the release blog post).

I"m going to see how much effort it would be to implement this flag, also out of curiosity what the impact would be.

@jonkoops jonkoops dismissed edewit’s stale review January 27, 2022 12:00

PR is not quite ready yet.

@jonkoops jonkoops marked this pull request as draft January 27, 2022 12:00
@jonkoops
Copy link
Contributor Author

Ok, so most of the issues have been fixed. However some dependencies we are using are not properly resolved at the moment. This seems to be because they are not including types, and the compiler cannot resolve the installed type packages.

@jonkoops jonkoops force-pushed the es-modules branch 2 times, most recently from fc6776b to 1eeb4f1 Compare May 2, 2022 16:22
@jonkoops jonkoops force-pushed the es-modules branch 4 times, most recently from c34a9f8 to 0f562b1 Compare July 11, 2022 11:16
@jonkoops
Copy link
Contributor Author

Okay, the last issues have been resolved. I am marking this as ready to be reviewed.

@jonkoops jonkoops marked this pull request as ready for review July 11, 2022 11:20
@jonkoops jonkoops requested a review from edewit July 11, 2022 11:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESmodule support: TypeError: KcAdminClient is not a constructor
2 participants