Tutorial This is an community solution, and the official document only provides tutorial for Nuxt2
Tutorial This is a demo provided by the author
We use vue-router's interceptor in the old project and use /router/index.ts
to specify our routes.
However, nuxt integrates vue-router by default, and the routing is configured out of a naming convention.
Nuxt official provides a solution that allows us to configure a middleware to implement the interceptor logic.
What should be emphasized is that Nuxt3 will override the routes
and history
options, and there is no way to control this.
Vite provides powerful plugins like unplugin-icons
. Since nuxt3 uses vite by default, there are should be a way to do the same thing in nuxt3.
Fortunately, unplugin-icons has added support to nuxt3. There is no big change between using vite and nuxt3, and your just need to copy the config from vite.config.ts
to the relevant part in nuxt.config.ts