Allow serving virtual files
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
Research direction
Start at the handler configuration and the existing headers handling, then trace how requested paths are resolved to served files. Done means a configured virtual file can be served from a read-only filesystem and its response headers integrate with the headers option, with behavior verified for the proposed env.js use case.
Written by the indexing model from the issue text.
Description
We just stumbled across the issue where we needed to create a file dynamically and serve it.
Our usecase:
We need to inject environment variables from the server prefixed by REACT_APP_. I guess the normal case is, that these env vars cannot be known at built time, thus are not baked into the assets. We need to supply them dynamically. We used to handle this using the react-inject-env package, but now we have an environment where the file system is readonly, thus it cannot create the env.js and therefore this approach becomes useless.
It would be nice to have an additional configuration option, e.g.
handler(request, response, {
virtualFiles: [
{ source: 'env.js', content: myPreComputedEnvJs, type: 'application/json' }
]
})
which should also integrate nicely with e.g. the headers field.
- Dominant language
- JavaScript
- Stars
- 618
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/serve-handler
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
vercel/serve-handler#235 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
vercel/serve-handler#231 · 2 comments · 5 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
vercel/serve-handler#165 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
vercel/serve-handler#210 · 1 comment · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
vercel/serve-handler#205 · 1 comment · 3 reactions ·
All issues in vercel/serve-handler
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·