Skip to content

TypeScript Support Impacted By Incorrect Package.json Configuration #1164

@crutchcorn

Description

@crutchcorn

Hey there! First of all; thank you immensely for this package - your work on it is awesome and deeply appreciated. 😄

While working on integrating this package in a project, I ran into problems with importing the packages, especially the subpackages. It's a little difficult to pin-down between import and require and what bundlers, but when I took a look at AreTheTypesWrong (a utility that helps maintainers like us figure out how different bundlers resolve TypeScript types), I noticed things were off:

image

https://arethetypeswrong.github.io/?p=compromise%4014.14.3

In comparison, this is what a correctly configured library package.json looks like to TypeScript via dual-CJS/ESM publising:

image

This may be the root cause of some previous issues like:

#1012

#845

#862

And more.

I'll be opening a PR to address this problem without modifying your bundling solution. I'm also trying to dogfood this PR in my project to confirm it fixes the issues we're running into.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions