Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable nuxt default error redirection

Tags:

vue.js

nuxt.js

Set up a nuxt project with Vuetify. One of the pages uses a client-only (no-ssr) component. During development, in case of an error in this component, I get redirected to the default error page, which prevents me from inspecting the variables and components using Vue devtools.

I feel like it should be really simple but I couldn't find a way to disable this auto redirecting behavior. So I guess my question is how do you disable nuxt default error redirection?

like image 330
yam Avatar asked Dec 11 '19 19:12

yam


1 Answers

I found a hack with a nuxt plugin :

./plugins/errors.js

export default function({ app }) {
  app.nuxt.error = () => {}
}

./nuxt.config.js

module.exports = {
  ...
  plugins: [
    "~/plugins/errors.js",
  ],
}
like image 192
vqoph Avatar answered Oct 02 '22 21:10

vqoph