You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have come across a possible use case where I need to access the static assets directory in hooks.ts.
Locally, it works well
newUrl('../static',import.meta.url)
But in production, all goes to hell. Because in production, the hooks.ts is running on a lambda or some server, this breaks.
Is it possible to expose a platform-independant absolute path of final static directory in the hooks.ts file?, aka the root from where files are served?
Motivation
This will help me make a platform agnostic image component that can optimize images on the fly, rather than limited to the build-time image optimisation that vite-imagetools provides
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have come across a possible use case where I need to access the static assets directory in
hooks.ts
.Locally, it works well
But in production, all goes to hell. Because in production, the hooks.ts is running on a lambda or some server, this breaks.
Is it possible to expose a platform-independant absolute path of final static directory in the
hooks.ts
file?, aka the root from where files are served?Motivation
This will help me make a platform agnostic image component that can optimize images on the fly, rather than limited to the build-time image optimisation that
vite-imagetools
providesBeta Was this translation helpful? Give feedback.
All reactions