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

Typescript intellisense is frustratingly slow in a nextjs project #30666

Closed
SEBIIWA opened this issue Oct 30, 2021 · 7 comments
Closed

Typescript intellisense is frustratingly slow in a nextjs project #30666

SEBIIWA opened this issue Oct 30, 2021 · 7 comments
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.

Comments

@SEBIIWA
Copy link

SEBIIWA commented Oct 30, 2021

What version of Next.js are you using?

11.1.2

What version of Node.js are you using?

14.16.0

What browser are you using?

new EDGE

What operating system are you using?

windows 10

How are you deploying your application?

vercel hosting

Describe the Bug

I’ve small next.js app which consists of 5 pages and 35 component and it's still at it's beginning and will grow complexe more and more.

the page loading is painfully slow it can reach up to 5-6 seonds ( in developement but super fast in production ) and it's getting hard to code like this also vscode typescript checking takes about 1-2 seconds to report anything. If there’s type error It’ll keep saying loading if and takes about 2 seconds to show the error and i only experinsed this when working on next js project.

i still don't have a lot of dependencies installed but here is how my package.json looks like

"dependencies": {
    "@types/styled-components": "^5.1.15",
    "axios": "^0.24.0",
    "framer-motion": "^4.1.17",
    "next": "11.1.2",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-icons": "^4.3.1",
    "styled-components": "^5.3.3"
  },
  "devDependencies": {
    "@types/react": "17.0.33",
    "eslint": "8.1.0",
    "eslint-config-next": "11.1.2",
    "typescript": "4.4.4"
  }

Expected Behavior

i expected this slowness when it get's to the point that project is complex and heavy enough to load at 6s but loading at 6s when only having 5 pages only 2 of them contains some code and the rest is just plain h1 tag is hard to code with

To Reproduce

this page is one of the pages that takes long to load

const LoginForm: FC = () => {
  const [email, setEmail] = useState<string>('')
  const [password, setPassword] = useState<string>('')
  const { authenticate, loading } = __auth()

  const auth = (e: FormEvent<HTMLInputElement>) => {
    e.preventDefault()
    authenticate(email, password)
  }

  return (
    <>
      <Form autoComplete='new-password'>
        <Cols>
          <Header>
            <h1>se connecter</h1>
            <p>Entrez vos identifiants pour accéder à votre compte</p>
          </Header>
          <Row>
            <Input
              placeholder='email...'
              type='email'
              icon={<MdAlternateEmail />}
              onClick={(e: ChangeEvent<HTMLInputElement>): void =>
                setEmail(e.target.value)
              }
            />
            <Input
              placeholder='mot de passe...'
              type='password'
              icon={<BiLockOpenAlt />}
              onClick={(e: ChangeEvent<HTMLInputElement>): void =>
                setPassword(e.target.value)
              }
            />
          </Row>
          <ButtonField
            title='connexion'
            status={loading}
            onClick={(e: FormEvent<HTMLInputElement>): void => auth(e)}
          />
        </Cols>
        <Redirect>
          <p>
            {"Si vous n'avez pas de compte "}
            <Link href='/auth/register' passHref>
              <a>cliquez ici</a>
            </Link>{' '}
            pour en créer un.
          </p>
        </Redirect>
      </Form>
    </>
  )
}

export default LoginForm
@SEBIIWA SEBIIWA added the bug Issue was opened via the bug report template. label Oct 30, 2021
@timneutkens timneutkens added the TypeScript Related to types with Next.js. label Oct 31, 2021
@pidogc
Copy link

pidogc commented Nov 16, 2021

I am in the same situation, the ts of vscode is very slow

@timneutkens
Copy link
Member

the page loading is painfully slow it can reach up to 5-6 seonds ( in developement but super fast in production )

Can you upgrade to Next.js 12 which is significantly faster. If you're then still running into slowdowns please provide the .next/trace file so that we can investigate what you're doing in the application that slows down compilation. Here's a thread about common causes: #29559 (comment)

@pidogc
Copy link

pidogc commented Nov 18, 2021

image

this is my package.json ,but slow

trace.ZIP

@timneutkens
Copy link
Member

Can you upgrade to the latest version of Next.js? npm install next@latest and try again? Looking at the trace there's some time unaccounted for and there's a label missing indicating you're not on the latest stable version. Can you also share your next.config.js if you have one?

@pidogc
Copy link

pidogc commented Nov 22, 2021

I upgraded the version, it is indeed faster than before

image

@timneutkens
Copy link
Member

@pidogc I guess this issue can be closed then?

@SEBIIWA SEBIIWA closed this as completed Nov 26, 2021
@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 27, 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. TypeScript Related to types with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants