V12.0.1 URL Import - `Cannot find module or type declarations` when deploying to Vercel
See original GitHub issueWhat 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:
- Created 2 years ago
- Comments:11
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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.