未验证 提交 8eb813a6 编写于 作者: T Tim Neutkens 提交者: GitHub

await config (#6488)

* await config

* update config-promise-error test

* Actually update test
上级 330bedac
......@@ -56,14 +56,14 @@ export default async function build(dir: string, conf = null): Promise<void> {
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,
......
......@@ -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')
}
}
......
......@@ -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/)
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册