Failed to resolve async components, failure in references to `static` folder
Tahul opened this issue · comments
Versions
nuxt-vite: 0.0.36
nuxt: 2.16.0-26932357.0a988668 (nuxt-edge)
Reproduction
https://codesandbox.io/s/nifty-jones-p9kqf?file=/components/Logo.vue
Description
Had an issue with SVG imports from tags, tried to resolve it using:
vite: {
publicDir: resolve(__dirname, 'static')
}
Fixed the imports, but I still have failures to resolve components, marked by these error messages:
[Vue warn]: Failed to resolve async component: () => import('/@fs/Users/tahul/Projets/nuxt/nuxtjs.com/components/templates/Home/HomeDiscover.vue').then(c => c.default || c)
Reason: TypeError: Failed to fetch dynamically imported module: http://localhost:3000/@fs/Users/tahul/Projets/nuxt/nuxtjs.com/components/templates/Home/HomeDiscover.vue
I don't know if this is an issue or just a misconfiguration from my side, we investigated with @farnabaz but couldn't find the source of this problem.
Also tried installing @nuxt/components just to be sure it wasn't a problem from that side and it didn't solved the problem.
Thank you a lot for your help, amazing work on nuxt-vite, can't wait to use it on this project. 🚀
I've updated the reproduction to a CodeSandbox example.
You can visit it here.
The problem seem to happen when the src
attribute from an image is used to point to an image directly:
<img src="/img/test.svg" />
^ This seem to be throwing an error.
<template>
<img :src="src" />
</template>
<script>
export default {
setup() {
return {
src: '/img/test.svg'
}
}
}
</script>
^ This seem to work.
I fixed it temporarily on my repository by doing that:
<img src="~/static/img/test.svg" />
I think this is a bug, or at least an update in the behavior that needs to be document on nuxt-vite docs.