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 definitions file getting overwritten on build and dev #26622

Closed
azzazkhan opened this issue Jun 26, 2021 · 2 comments
Closed

Type definitions file getting overwritten on build and dev #26622

azzazkhan opened this issue Jun 26, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@azzazkhan
Copy link

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14.16.0

What browser are you using?

Chrome version 91.0.4472.114 (Official Build) (64-bit)

What operating system are you using?

Windows 10 Home (64-bit)

How are you deploying your application?

next dev/next build

Describe the Bug

When running next build or next start the configured next-env.d.ts gets overwritten and all configurations are removed. I'm using the next-page-transitions package to add transition effects on navigation but when I import the package typescript yells that no type definitions found for package next-page-transitions.

To solve this I added custom type declarations for the next-page-transitions and .svg files, by doing so my next-env.d.ts files looks like this.

/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

declare module "next-page-transitions";

declare module "*.svg" {
  content: string;
  export default content;
}

But when I run next build or next dev commands it overwrites my next-env.d.ts file to this

/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

BTW I'm using the yarn package manager and using the yarn run dev and yarn run build commands. Due to this bug, I have to rewrite the file every time I need to start the server.

Expected Behavior

Should not overwrite the type declaration file.

To Reproduce

Just initialize a new Next.js project with yarn create next-app --typescript and add type declarations for packages in next-env.d.ts file or follow up using this repository

@azzazkhan azzazkhan added the bug Issue was opened via the bug report template. label Jun 26, 2021
@ijjk
Copy link
Member

ijjk commented Jun 26, 2021

Closing as a duplicate of #26560

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants