-
Notifications
You must be signed in to change notification settings - Fork 60
Open
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
<script>
const API_URL = "${API_URL}";
// ...
</script>package.json
{
"scripts": {
"build": "envsubst '$API_URL' < ./index.html > ./dist/index.html"
}
}GitHub workflow step:
# ...
- 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels