`next.config.js` is not considered for node_modules that import `next/image`
See original GitHub issueWhat version of Next.js are you using?
12.0.3
What version of Node.js are you using?
16.x
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
Getting an error during next dev
when a dependency imports next/image
:
Error: Invalid src prop (https://i.imgur.com/CgezKMb.jpg) on
next/image
, hostname “i.imgur.com” is not configured under images in yournext.config.js
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host
Expected Behavior
Should read the next.config.js
properly, even for 3rd party packages inside node_modules
that import next/image
To Reproduce
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:9 (4 by maintainers)
Top Results From Across the Web
next.config.js: Introduction
next.config.js is a regular Node.js module, not a JSON file. It gets used by the Next.js server and build ... Phases can be...
Read more >Support ESM in next.config.js - Stack Overflow
From Next.js 12, ES modules is now supported in the config file by renaming it to next.config.mjs . // next.config.mjs import withLess from ......
Read more >Building a Next.js shopping cart app - LogRocket Blog
Setting up a Next.js project with create-next-app ... Now, to use the styles inside the component, import the CSS module, and add className ......
Read more >Next.js Tutorial for Beginners (Getting Started) | Stack Diary
Layout settings in _app.js; Using an API to fetch and render data (getStaticProps, getServerSideProps); How to use global.css and CSS modules ...
Read more >How to Build Your Own Blog with Next.js and MDX
MDX brings this flexibility into a markdown file by allowing you to literally write or import JavaScript (React) components into your ...
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
This was released in 12.0.11-canary.10.
You can try it out today with
npm i next@canary
oryarn add next@canary
, thanks!We’ll have it for 12.1.0.
The work is being done in PR #33559