Skip to content

fix: module issues with types #212

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 3 commits into from
Jan 19, 2023
Merged

fix: module issues with types #212

merged 3 commits into from
Jan 19, 2023

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Jan 18, 2023

Fixes an issue with imports in ES module projects. Specifically, in some TS configurations, compilation would fail because TS esm support requires file extensions on all imports. Though our code is bundled, our declaration files are not, and they are also subject to this requirement. To avoid having to add .js extensions in our rendered type files, this adds a package.json with type: commonjs only in the type file roots, making them behave as commonjs modules, (which don't require file extensions in imports).

I attempted first to bundle all our types into a single d.ts (to avoid imports entirely), but was unable to find a decent solution to that.

Fixes: #198

I've tested this fix with the example repo in the linked issue, as well as another es-module project, and a commonjs project. Everything works as expected.

@toddbaert toddbaert changed the title fix: bundling issues in types fix: bundling issues with types Jan 19, 2023
@toddbaert toddbaert changed the title fix: bundling issues with types fix: module issues with types Jan 19, 2023
Fix runtime issues with types in ES module projects

Signed-off-by: Todd Baert <[email protected]>
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

Successfully merging this pull request may close these issues.

[flagd-provider] Can't import flagd provider in ESM Typescript project
2 participants