Skip to content
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

Fix NodeNext incompatibility in package.json #8439

Closed
wants to merge 1 commit into from
Closed

Fix NodeNext incompatibility in package.json #8439

wants to merge 1 commit into from

Conversation

adam-coster
Copy link

The spec for the "exports" field has it completely take over when present. Latest Typescript (4.7+), when using moduleResolution "NodeNext" follows the spec. It therefore looks for types in package.json/exports/./types. Puppeteer does not have that value, so Typescript gets confused and throws errors of various sorts on import statements.

Adding package.json/exports/./types = "./lib/types.d.ts" resolves this.

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

No. It's an extremely minor change that should not create backwards incompatibilities and brings the package.json to spec.

Summary

Resolves #8438

Does this PR introduce a breaking change?

No.

Other information

The spec for the "exports" field has it completely take over when present. Latest Typescript (4.7+), when using `moduleResolution` "NodeNext" follows the spec. It therefore looks for types in `package.json/exports/./types`. Puppeteer does not have that value, so Typescript gets confused and throws errors of various sorts on import statements.

Adding `package.json/exports/./types = "./lib/types.d.ts"` resolves this.
@google-cla
Copy link

google-cla bot commented May 30, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OrKoN OrKoN requested a review from jrandolf May 31, 2022 07:31
@jrandolf
Copy link
Contributor

@adam-coster Mind signing the CLA so we can submit this?

@jrandolf
Copy link
Contributor

Merged here: #8445

@jrandolf jrandolf closed this May 31, 2022
@adam-coster
Copy link
Author

@jrandolf Whoops, sorry! Thanks for making the fix anyway.

@adam-coster adam-coster deleted the patch-1 branch May 31, 2022 16:29
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.

[Bug]: Typescript 4.7+ incompatibility with "NodeNext" module resolution
2 participants