question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V12.0.1 URL Import - `Cannot find module or type declarations` when deploying to Vercel

See original GitHub issue

What version of Next.js are you using?

12.0.1

What version of Node.js are you using?

v14.17.6

What browser are you using?

Safari/Chrome

What operating system are you using?

Linux

How are you deploying your application?

Vercel

Describe the Bug

Importing Confetti and rendering in a simple application, works perfectly on dev server when running next dev error shows in IDE and when deploying to Vercel.

Full error message:

Type error: Cannot find module 'https://cdn.skypack.dev/canvas-confetti' or its corresponding type declarations.

Expected Behavior

Deploy to work without issue.

To Reproduce

Create next.js project on Version 12 using the following code

import confetti from "https://cdn.skypack.dev/canvas-confetti"
import {useEffect} from "react"

export default function Home() {
  useEffect(() => {
    confetti()
  })
  return <h1>Home</h1>
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
aboveyunhaicommented, Nov 11, 2021

Well, in some edge special cases where your import url is actually a typescript file itself then it’s not going to work. I guess //@ts-ignore is the only way to go right now for this particular case until it’s fixed later.

0reactions
github-actions[bot]commented, Mar 3, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve a 'module not found' error? - Vercel
The 'module not found' error is a syntax error that appears when the static import statement cannot find the file at the declared...
Read more >
How to fix Next.js Vercel deployment module not found error
I think it may be an internal issue with Vercel's deployment infrastructure. Notice the line it is failing on: Error: Cannot find module...
Read more >
Vercel Cannot Find Module Or Type Declarations While It ...
V12.0.1 URL Import Cannot find module or type declarations when deploying to Vercel #. Cannot find module '@contexts/folder/folder' or its corresponding ...
Read more >
cannot find module 'formik' or its corresponding type ...
Vercel cli build fails with error "Type error: Cannot find module 'Formik' or its corresponding type ... The issue was the import from...
Read more >
How to fix Next.js Vercel deployment module not found error ...
This error typically happens if you're accidentally committing node_modules to your project's Git Repostiory. Could you try to do the following?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found