提交 ddd01df4 编写于 作者: W wtgtybhertgeghgtwtg 提交者: Tim Neutkens

Make `getBaseWebpackConfig` synchronous. (#6356)

Currently, `getBaseWebpackConfig` is marked async, but it doesn't await anything or otherwise return a Promise.  Please correct me if I am wrong, but it looks like it can be made synchronous.
上级 fcf1167c
......@@ -58,7 +58,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
const pagePaths = await collectPages(pagesDir, config.pageExtensions)
const pages = createPagesMapping(pagePaths, config.pageExtensions)
const entrypoints = createEntrypoints(pages, config.target, buildId, config)
const configs: any = await Promise.all([
const configs: any = [
getBaseWebpackConfig(dir, {
buildId,
isServer: false,
......@@ -73,7 +73,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
target: config.target,
entrypoints: entrypoints.server,
}),
])
]
let result: CompilerResult = { warnings: [], errors: [] }
if (config.target === 'serverless') {
......
......@@ -146,7 +146,7 @@ function optimizationConfig ({ dev, isServer, totalPages, target }) {
return config
}
export default async function getBaseWebpackConfig (dir, { dev = false, isServer = false, buildId, config, target = 'server', entrypoints }) {
export default function getBaseWebpackConfig (dir, { dev = false, isServer = false, buildId, config, target = 'server', entrypoints }) {
const defaultLoaders = {
babel: {
loader: 'next-babel-loader',
......
......@@ -168,10 +168,10 @@ export default class HotReloader {
const pagePaths = await glob(`+(_app|_document).+(${this.config.pageExtensions.join('|')})`, { cwd: join(this.dir, 'pages') })
const pages = createPagesMapping(pagePaths, this.config.pageExtensions)
const entrypoints = createEntrypoints(pages, 'server', this.buildId, this.config)
return Promise.all([
return [
getBaseWebpackConfig(this.dir, { dev: true, isServer: false, config: this.config, buildId: this.buildId, entrypoints: entrypoints.client }),
getBaseWebpackConfig(this.dir, { dev: true, isServer: true, config: this.config, buildId: this.buildId, entrypoints: entrypoints.server })
])
]
}
async start () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册