diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 981998880b17f6ba3103a250a9807ea005a7083a..06cf875fce0d4d966afe9571fd5ad4a6873f9925 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -56,14 +56,14 @@ export default async function build(dir: string, conf = null): Promise { const pages = createPagesMapping(pagePaths, config.pageExtensions) const entrypoints = createEntrypoints(pages, config.target, buildId, config) const configs = [ - getBaseWebpackConfig(dir, { + await getBaseWebpackConfig(dir, { buildId, isServer: false, config, target: config.target, entrypoints: entrypoints.client, }), - getBaseWebpackConfig(dir, { + await getBaseWebpackConfig(dir, { buildId, isServer: true, config, diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 331a96757f128bda12f8038da2a724b519df5f95..c5a280155addac3152c937f6c94b436111cf3705 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -299,9 +299,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, isServe // @ts-ignore: Property 'then' does not exist on type 'Configuration' if (typeof webpackConfig.then === 'function') { - throw new Error( - '> Promise returned in next config. https://err.sh/zeit/next.js/promise-in-next-config.md' - ) + console.warn('> Promise returned in next config. https://err.sh/zeit/next.js/promise-in-next-config.md') } } diff --git a/test/integration/config-promise-error/test/index.test.js b/test/integration/config-promise-error/test/index.test.js index fda845731acf59bfd562f109d4a360e4b158f81a..85139917f66e69fb09e2eb800a6c44b59ddd59c1 100644 --- a/test/integration/config-promise-error/test/index.test.js +++ b/test/integration/config-promise-error/test/index.test.js @@ -30,8 +30,9 @@ describe('Promise in next config', () => { expect(stderr).toMatch(/Error: > Promise returned in next config\. https:\/\/err\.sh\/zeit\/next\.js\/promise-in-next-config\.md/) }) - it('should throw error when a promise is returned on webpack', async () => { + it('should warn when a promise is returned on webpack', async () => { configFile.write(` + setTimeout(() => process.exit(0), 2 * 1000) module.exports = (phase, { isServer }) => { return { webpack: async (config) => { @@ -46,6 +47,6 @@ describe('Promise in next config', () => { { stderr: true } ) - expect(stderr).toMatch(/Error: > Promise returned in next config\. https:\/\/err\.sh\/zeit\/next\.js\/promise-in-next-config\.md/) + expect(stderr).toMatch(/> Promise returned in next config\. https:\/\/err\.sh\/zeit\/next\.js\/promise-in-next-config\.md/) }) })