Nuxt/test/fixtures/module/modules/hooks/index.js

27 lines
648 B
JavaScript
Raw Normal View History

2017-07-17 19:38:02 +00:00
module.exports = function () {
let ctr = 1
// Add hook for module
2017-10-30 22:17:46 +00:00
this.nuxt.hook('modules:done', (moduleContainer) => {
2017-07-17 19:38:02 +00:00
this.nuxt.__module_hook = moduleContainer && ctr++
})
// Add hook for renderer
2017-10-30 21:39:08 +00:00
this.nuxt.hook('render:done', (renderer) => {
2017-07-17 19:38:02 +00:00
this.nuxt.__renderer_hook = renderer && ctr++
})
// Add hook for build
2017-10-30 22:17:46 +00:00
this.nuxt.hook('build:done', (builder) => {
2017-07-17 19:38:02 +00:00
this.nuxt.__builder_hook = builder && ctr++
})
2017-11-19 14:35:11 +00:00
2018-03-15 08:24:29 +00:00
this.nuxt.hook('build:done', (builder) => {
2017-11-19 14:35:11 +00:00
this.nuxt.__builder_plugin = builder && ctr++
})
2017-11-19 15:02:44 +00:00
this.nuxt.hook('build:extendRoutes', (builder) => {
throw new Error('hook error testing')
})
2017-07-17 19:38:02 +00:00
}