API: The hooks Property

    Example (nuxt.config.js):

    Internally, hooks follow a naming pattern using colons (e.g., build:done). For ease of configuration, you can structure them as an hierarchical object when using nuxt.config.js (as exemplifed above) to set your own hooks. See Nuxt Internals for more detailed information on how they work.

    Examples

    This is maybe an edge-case, and the point of nuxt.config.jsrouter.base is for when a Web server will serve Nuxt elsewhere than the domain root.

    But when in local development, hitting localhost, when router.base is not / returns a 404.In order to prevent this, you can setup a Hook.

    To begin, you can change router.base; Update your nuxt.config.js:

    Then, create a few files;

    • , Hooks module
    • hooks/render.js, Render hook