What is the best practice to continuously build and deploy a static javascript/css/html application (SPA)?
Coming from a backend development world, normally we build once and then deploy to various targets where the configuration sits in the environment. So for a basic Java web app, we'd just setup one build in Bamboo, but link it to various deployments.
However, we're moving towards more SPA type applications and these all run in the client browser. So, there is no environment to get configuration from. In this case I'm using a React/Redux app that is bundled/wrapper using Webpack and it's build using npm/node.
The only way I have found to be able to configure this correctly is by having the environment/configuration injected during the npm build phase. Because, basically, after that, you're left with a folder of minified and uglified and hashed javascript files so it's virtually impossible to do post-build variable updates.
So, now I have one project that has as many builds as that it has deployment targets and then for each I have to create one single deployment task.
Given that I'm surely not the only one building SPA type applications, I was wondering what the best practice for this is?
Are you perhaps doing the npm build during the deployment task? And instead of having the build folder as artifact, use the entire source tree?