Refactor extendRoutes for Tapable plugins

This commit is contained in:
Ivan Nikulin 2017-08-23 08:49:24 +02:00
parent 9c39c128f2
commit 37abaa0e80
No known key found for this signature in database
GPG Key ID: F800F559F11A1A10

View File

@ -254,11 +254,7 @@ export default class Builder extends Tapable {
templateVars.router.routes = this.options.build.createRoutes(this.options.srcDir)
}
const extendedRoutes = await this.applyPluginsAsync('extendRoutes', { routes: templateVars.router.routes, templateVars, r })
// Only overwrite routes when something is returned for backwards compatibility
if (extendedRoutes !== undefined) {
templateVars.router.routes = extendedRoutes
}
await this.applyPluginsAsync('extendRoutes', { routes: templateVars.router.routes, templateVars, r })
// router.extendRoutes method
if (typeof this.options.router.extendRoutes === 'function') {