I have the following app structure:
- angular
– angular app here - proxy
– dist/ ← publish folder
– src/ ← functions folder
— index.ts ← functions catch-all endpoint - netlify.toml
The way it works is this, in short:
- Angular app builds and copies compiled artifacts into proxy/dist
- proxy app is an expressJS app. It acts as the production-ready app and ensures connection to CMS and some other useful integrations.
- Proxy app is the endpoint/the site that is deployed to Netlify
When deployed/built, the proxy app:
- Installs npm dependencies in both angular and proxy
- Builds angular app, copies output to /dist
- Calls tsc within the proxy app folder.
- index.ts function then gets data from CMS and uses complied angular artifacts to render the site properly.
Now here’s the crux of the problem. If I push the artifacts from proxy/dist folder into Git, they will be deployed and be visible in Deploy file browser.
If I remove them from git and only rely on the expected build pipeline, I only see the output from tsc:
And the site fails to render, not finding the dist server.bundle:
Error - ERROR: The server.bundle.js error. Error: Cannot find module ‘…/dist/server.bundle’ Require stack: - /var/task/src/angularstarter/proxy/src/index.js - /var/task/index.js - /var/runtime/index.mjs
Is there any way to ensure the build-time artifacts persist during and after deployment? Any help or pointers is deeply apprecited.