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

Update package.json - add types to exports #677

Merged
merged 2 commits into from
Sep 6, 2023

Conversation

Barokai
Copy link
Contributor

@Barokai Barokai commented Jul 26, 2023

when changing moduleResolution from node to bundler (as in https://github.com/vercel/next.js/pull/51957/files#diff-066cacecd32e0ca72d47360ddb35c19a676835816eed05163e05564ec0874590) in tsconfig.json, the following errors occur during build:

./pages/sitemap.xml/index.tsx:2:36
Type error: Could not find a declaration file for module 'next-sitemap'. 'C:/dev/frontend/project/node_modules/next-sitemap/dist/esm/index.js' implicitly has an 'any' type.
  There are types at 'C:/dev/frontend/project/node_modules/next-sitemap/dist/@types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'next-sitemap' library may need to update its package.json or typings.

  1 | import type { GetServerSideProps } from "next";
> 2 | import type { ISitemapField } from "next-sitemap";

The error can be fixed by copying the types to the exports "." section in package.json (as described here: https://stackoverflow.com/a/76212193/1548552)

when changing moduleResolution from node to bundler (as in https://github.com/vercel/next.js/pull/51957/files#diff-066cacecd32e0ca72d47360ddb35c19a676835816eed05163e05564ec0874590)in tsconfig.json following errors occurs:

./pages/sitemap.xml/index.tsx:2:36
Type error: Could not find a declaration file for module 'next-sitemap'. 'C:/dev/frontend/project/node_modules/next-sitemap/dist/esm/index.js' implicitly has an 'any' type.
  There are types at 'C:/dev/frontend/project/node_modules/next-sitemap/dist/@types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'next-sitemap' library may need to update its package.json or typings.

  1 | import type { GetServerSideProps } from "next";
> 2 | import type { ISitemapField } from "next-sitemap";

The error can be fixed via copying the types to the exports "." section in package.json (as described here: https://stackoverflow.com/a/76212193/1548552)
@vercel
Copy link

vercel bot commented Jul 26, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @iamvishnusankar on Vercel.

@iamvishnusankar first needs to authorize it.

@agentkdot1
Copy link

This is much needed, when should we see the updated one?

agentkdot1

This comment was marked as off-topic.

@Barokai
Copy link
Contributor Author

Barokai commented Aug 23, 2023

Hi,
also wanted to ask what the current status is;
can somebody review/approve or even merge this please?

@agentkdot1
Copy link

Hi, also wanted to ask what the current status is; can somebody review/approve or even merge this please?

we need this asap as the site is suffering from this issue

@deviationist
Copy link

Any update on this?

Copy link
Owner

@iamvishnusankar iamvishnusankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Barokai Thanks for this PR. Approved

@iamvishnusankar iamvishnusankar merged commit 25bad1d into iamvishnusankar:master Sep 6, 2023
@Barokai Barokai deleted the patch-1 branch September 7, 2023 07:11
ariesclark pushed a commit to ariesclark/next-sitemap-x that referenced this pull request Dec 14, 2024
Update package.json - add types to exports
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.

4 participants