diff --git a/lib/builder/builder.js b/lib/builder/builder.js index 0982b3b7df..970d77ed2a 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -365,8 +365,9 @@ export default class Builder extends Tapable { compilersOptions.push(clientConfig) // Server - const serverConfig = serverWebpackConfig.call(this) + let serverConfig = null if (this.options.build.ssr) { + serverConfig = serverWebpackConfig.call(this) compilersOptions.push(serverConfig) } @@ -380,7 +381,7 @@ export default class Builder extends Tapable { } // Server config - if (!serverConfig.resolve.alias[p.name]) { + if (serverConfig && !serverConfig.resolve.alias[p.name]) { // Alias to noop for ssr:false plugins serverConfig.resolve.alias[p.name] = p.ssr ? src : './empty.js' }