builder: decouple build from production logic

This commit is contained in:
Pooya Parsa 2017-06-14 01:04:28 +04:30
parent 5768ef5092
commit 4c07a397e2

View File

@ -119,10 +119,6 @@ export default class Builder extends Tapable {
} }
async production () { async production () {
// Avoid calling this method multiple times
if (this._buildStatus === STATUS.BUILD_DONE) {
return this
}
// Production, create server-renderer // Production, create server-renderer
const serverConfig = this.getWebpackServerConfig() const serverConfig = this.getWebpackServerConfig()
const bundlePath = join(serverConfig.output.path, 'server-bundle.json') const bundlePath = join(serverConfig.output.path, 'server-bundle.json')
@ -135,7 +131,6 @@ export default class Builder extends Tapable {
const manifest = fs.readFileSync(manifestPath, 'utf8') const manifest = fs.readFileSync(manifestPath, 'utf8')
this.createRenderer(JSON.parse(bundle), JSON.parse(manifest)) this.createRenderer(JSON.parse(bundle), JSON.parse(manifest))
this.addAppTemplate() this.addAppTemplate()
this._buildStatus = STATUS.BUILD_DONE
return this return this
} }