FR: Provide `envsubst` in build environment
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I'd like to host a very simple SPA on SWA that only requires a single value, an API url, that has to be injected into the code on build to be runnable. The simplest way to achieve this appears to be something like this:
`index.html`
```html
const API_URL = "${API_URL}";
// ...
```
`package.json`
```json
{
"scripts": {
"build": "envsubst '$API_URL' < ./index.html > ./dist/index.html"
}
}
```
GitHub workflow step:
```yaml
# ...
- name: Deploy frontend
uses: azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: "..."
action: "upload"
app_location: "frontend/"
output_location: "build/"
app_build_command: "npm run build"
```
Unfortunately, runnings this fails with:
```
...
sh: 1: envsubst: not found
---End of Oryx build logs---
Oryx has failed to build the solution.
```
**Describe the solution you'd like**
The environment in which the site is built comes with standard unix tooling including `envsubst`.
**Describe alternatives you've considered**
Obviously, one could introduce some full-fledged build system into the project but this appears to be overkill for a simple string replacement.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.