#Static files resolved by nuxt

1 messages · Page 1 of 1 (latest)

wheat light
#

Hi. Does anyone know how to make static files to not be resolved by Nuxt?
Because on same domain we have separate endpoint that responded with static files, also to work locally with that I'm proxying this url.
For example: <img src="/static/images/someimg.webp" />. For now Nuxt returns error Internal server error: Failed to resolve import "/static/images/someimg.webp" from "pages/index.vue". Does the file exist?

In project driven with clean Vite build it works ok, no any issue, because it's not assets directory. Also I can replace this url with any other at build step depending on environment.

Thanks for help 😁

storm lance
#

add a server route

wheat light
#

Thanks. But I'm looking for static src in img and other media elements. I don't wanna set src bindings for just static string 🙂

storm lance
#

"we have separate endpoint that responded with static files"

#

i thought you were just trying to avoid the nuxt page error?

wheat light
#

this error. It's just example.

storm lance
#

ahh

wheat light
#

this happens because of transforming each src, srcset css url() to resolve as module

storm lance
#

:src="`/static/images/someimg.webp`" is what i do

wheat light
#

haha, I know this hack, but putting this everywhere is not good. In vite + vue allworks fine without src binding

wheat light
#

so, how to hack nuxt transformation to ignore some path, to not process as module ?

wheat light
#

up