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

Type error: Could not find a declaration file for module 'next-sitemap' #678

Closed
Barokai opened this issue Jul 26, 2023 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Barokai
Copy link
Contributor

Barokai commented Jul 26, 2023

Describe the bug
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";

Info: Seems as bundler will be used for all future applications created with create-next-app.

To Reproduce
Steps to reproduce the behavior:

  1. change tsonfig.json moduleResolution from node to bundler in an existing project which uses next-pw
  2. try to build

Expected behavior
Build should succeed

Screenshots

Additional context
created a pull-request #677 which should fix it (tested locally)

@Barokai Barokai added the bug Something isn't working label Jul 26, 2023
@deviationist
Copy link

Got the same issue

@Barokai
Copy link
Contributor Author

Barokai commented Sep 7, 2023

Closing this as my PR was merged, tested with version https://github.com/iamvishnusankar/next-sitemap/releases/tag/4.2.3

@Barokai Barokai closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants