Jason Hostetter
Jason Hostetter
Explore posts from servers
NNuxt
Created by Jason Hostetter on 7/14/2024 in #❓・help
Serving static assets from a dynamic path
I have a situation where I am serving an application at a particular path, say /path/to/document/doc-id-1234. The application handling that document is an external library that loads some codecs using web workers. These workers also load additional assets. It appears that the workers are hard-coded to load assets from the current file path, i.e. /path/to/document/asset-1.wasm. It works to put those assets in public/path/to/document. But, if I have alternate paths, I would have to copy those assets to every possible path in the public directory so it is available. Is there a way to write a hook that can see if one of these assets are being requested (matching the filename in the request url for instance), and then returning the asset regardless of the request path?
1 replies