svg-sprite: UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '.../.nuxt/nuxt-svg-sprite-icons-list.vue'
Hi there,
I’m using SSR mode with express server and I got below error:
(node:25166) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '.../.nuxt/nuxt-svg-sprite-icons-list.vue'
It can’t generate the template correctly in the dev mode, but production mode works really well.
the build process of below code:
if (this.nuxt.options.dev) {
this.addTemplate({
src: path.resolve(__dirname, 'pages', 'icons-list.vue'),
fileName: 'nuxt-svg-sprite-icons-list.vue',
options
})
// register page
this.nuxt.hook('build:extendRoutes', (routes) => {
routes.push({
name: 'icons-list',
path: options.iconsPath,
component: path.resolve(this.nuxt.options.buildDir, 'nuxt-svg-sprite-icons-list.vue')
})
})
}
should change like this:
if (this.nuxt.options.dev) {
this.addTemplate({
src: path.resolve(__dirname, 'pages', 'icons-list.vue'),
fileName: 'nuxt-svg-sprite-icons-list.vue',
options
})
// register page
this.extendRoutes((routes) => {
routes.push({
name: 'icons-list',
path: options.iconsPath,
component: path.resolve(this.nuxt.options.buildDir, 'nuxt-svg-sprite-icons-list.vue')
})
})
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (2 by maintainers)
If I move ‘@nuxtjs/svg-sprite’ in nuxt.config.js after ‘nuxt-i18n’ - it works