From e15741dacae03d3ea7e74befeb9449f10a7dde5b Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 8 May 2023 10:58:14 +0200 Subject: [PATCH] Remove empty config warning (#49435) ## What? Removes the empty `next.config.js` warning. Given that `create-next-app` now ships with an empty config with the type definition comment the warning is no longer needed. ## How? Removed the warning, removed the tests. Fixes NEXT-1107 --- packages/next/src/server/config.ts | 6 --- test/integration/config-empty/next.config.js | 6 --- test/integration/config-empty/pages/index.js | 1 - .../config-empty/test/index.test.js | 42 ------------------- 4 files changed, 55 deletions(-) delete mode 100644 test/integration/config-empty/next.config.js delete mode 100644 test/integration/config-empty/pages/index.js delete mode 100644 test/integration/config-empty/test/index.test.js diff --git a/packages/next/src/server/config.ts b/packages/next/src/server/config.ts index 4027458d74..7f8ffd87cc 100644 --- a/packages/next/src/server/config.ts +++ b/packages/next/src/server/config.ts @@ -779,12 +779,6 @@ export default async function loadConfig( } } - if (Object.keys(userConfig).length === 0) { - curLog.warn( - `Detected ${configFileName}, no exported configuration found. https://nextjs.org/docs/messages/empty-configuration` - ) - } - if (userConfig.target && userConfig.target !== 'server') { throw new Error( `The "target" property is no longer supported in ${configFileName}.\n` + diff --git a/test/integration/config-empty/next.config.js b/test/integration/config-empty/next.config.js deleted file mode 100644 index 0c04cc7288..0000000000 --- a/test/integration/config-empty/next.config.js +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable */ -{ - experimental: { - basePath: '/docs' - } -} diff --git a/test/integration/config-empty/pages/index.js b/test/integration/config-empty/pages/index.js deleted file mode 100644 index 02d90896bf..0000000000 --- a/test/integration/config-empty/pages/index.js +++ /dev/null @@ -1 +0,0 @@ -export default () =>
Hello World
diff --git a/test/integration/config-empty/test/index.test.js b/test/integration/config-empty/test/index.test.js deleted file mode 100644 index 6202c123c2..0000000000 --- a/test/integration/config-empty/test/index.test.js +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-env jest */ - -import { join } from 'path' -import { - nextBuild, - launchApp, - findPort, - killApp, - waitFor, -} from 'next-test-utils' - -const appDir = join(__dirname, '..') - -describe('Empty configuration', () => { - it('should show relevant warning and compile successfully for next build', async () => { - const { stderr, stdout } = await nextBuild(appDir, [], { - stderr: true, - stdout: true, - }) - expect(stdout).toMatch(/Compiled successfully/) - expect(stderr).toMatch( - /Detected next\.config\.js, no exported configuration found\. https:\/\// - ) - }) - - it('should show relevant warning and compile successfully for next dev', async () => { - let stderr = '' - - const appPort = await findPort() - const app = await launchApp(appDir, appPort, { - onStderr(msg) { - stderr += msg || '' - }, - }) - await waitFor(1000) - await killApp(app) - - expect(stderr).toMatch( - /Detected next\.config\.js, no exported configuration found\. https:\/\// - ) - }) -})