Nuxt/test/fixtures/module/modules/hooks/index.js
2018-03-15 16:24:29 +08:00

27 lines
648 B
JavaScript

module.exports = function () {
let ctr = 1
// Add hook for module
this.nuxt.hook('modules:done', (moduleContainer) => {
this.nuxt.__module_hook = moduleContainer && ctr++
})
// Add hook for renderer
this.nuxt.hook('render:done', (renderer) => {
this.nuxt.__renderer_hook = renderer && ctr++
})
// Add hook for build
this.nuxt.hook('build:done', (builder) => {
this.nuxt.__builder_hook = builder && ctr++
})
this.nuxt.hook('build:done', (builder) => {
this.nuxt.__builder_plugin = builder && ctr++
})
this.nuxt.hook('build:extendRoutes', (builder) => {
throw new Error('hook error testing')
})
}