Unverified Commit 82ed6a3b authored by Johannes Obermair's avatar Johannes Obermair Committed by GitHub

Fix next/image config injection during static generation (#47007)

Fixes #39330.

I've not added a new test, but extended the existing test instead (and
re-enabled it).

It seems to me that a custom next/image config was not considered during
static generation (which itself uses `next export`?) before. Adding the
config to `renderOpts` in `packages/next/src/export/index.ts` resolves
the issue.
parent 48b9c1a2
...@@ -410,6 +410,7 @@ export default async function exportApp( ...@@ -410,6 +410,7 @@ export default async function exportApp(
'server', 'server',
`${NEXT_FONT_MANIFEST}.json` `${NEXT_FONT_MANIFEST}.json`
)), )),
images: nextConfig.images,
} }
const { serverRuntimeConfig, publicRuntimeConfig } = nextConfig const { serverRuntimeConfig, publicRuntimeConfig } = nextConfig
......
module.exports = { module.exports = {
images: { images: {
domains: ['i.imgur.com'], domains: ['i.imgur.com'],
deviceSizes: [1234],
}, },
} }
...@@ -14,15 +14,17 @@ let appPort ...@@ -14,15 +14,17 @@ let appPort
let app let app
function runTests() { function runTests() {
// This feature was added in PR #31065. it('should apply image config for node_modules', async () => {
// Skip this test until we promote `next/image` from
// experimental to stable status.
it.skip('should apply image config for node_modules', async () => {
const browser = await webdriver(appPort, '/') const browser = await webdriver(appPort, '/')
const src = await browser const src = await browser
.elementById('image-from-node-modules') .elementById('image-from-node-modules')
.getAttribute('src') .getAttribute('src')
expect(src).toMatch('i.imgur.com') expect(src).toMatch('i.imgur.com')
const srcset = await browser
.elementById('image-from-node-modules')
.getAttribute('srcset')
expect(srcset).toMatch('1234')
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment