Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module hooks documentation #3069

Closed
derevandal opened this issue Mar 20, 2018 · 4 comments
Closed

Module hooks documentation #3069

derevandal opened this issue Mar 20, 2018 · 4 comments

Comments

@derevandal
Copy link

@derevandal derevandal commented Mar 20, 2018

Hi,

Where are module hooks documentation?
The link in released v.1.0.0 is broken.
Could anyone help me?

Thanks.

This question is available on Nuxt.js community (#c2656)
@NicoPennec

This comment has been minimized.

Copy link
Contributor

@NicoPennec NicoPennec commented Mar 20, 2018

@derevandal

from doc: https://nuxtjs.org/guide/modules#run-tasks-on-specific-hooks

or

from the github doc repository: https://github.com/nuxt/docs/blob/c6493850060aa798542abcc811ced23c3c401fab/en/guide/modules.md#run-tasks-on-specific-hooks

module.exports = function () {
  // Add hook for modules
  this.nuxt.hook('module', moduleContainer => {
    // This will be called when all modules finished loading
  })

  // Add hook for renderer
  this.nuxt.hook('renderer', renderer => {
    // This will be called when renderer was created
  })

  // Add hook for build
  this.nuxt.hook('build', async builder => {
    // This will be called once when builder created

    // We can even register internal hooks here
    builder.hook('compile', ({compiler}) => {
        // This will be run just before webpack compiler starts
    })
  })

  // Add hook for generate
  this.nuxt.hook('generate', async generator => {
    // This will be called when a Nuxt generate starts
  })
}
@derevandal

This comment has been minimized.

Copy link
Author

@derevandal derevandal commented Mar 20, 2018

@cmty

This comment has been minimized.

Copy link

@cmty cmty bot commented Aug 8, 2018

This question has been resolved by @NicoPennec, see answer.

@cmty cmty bot closed this Aug 8, 2018
@cmty cmty bot added the cmty:status:resolved label Aug 8, 2018
@lock

This comment has been minimized.

Copy link

@lock lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.