wext-manifest-loader
wext-manifest-loader copied to clipboard
Support environment variable replacement in manifest value fields
User Story
As a developer, when I'm building for multiple environments (dev, staging, prod) and multiple platform targets, I want to define environment variables for replacement in the manifest, so I can dynamically change the name, icons and other properties based on the build requirements.
Example
When building for staging, we make the following changes to our manifest:
- add
-staging
to our app name - change favicon to a custom staging variant
- change
homepage_url
to the staging site (for integration testing)
And, based on semver commits, we also calculate and set out version number automatically when running builds in our ci. We don't get this from package.json, so we also need to update the manifest version number with the correct calculated version.
Potential implementation
Webpack WebExtension Plugin includes this capability by using a similar syntax to vendor keys:
For example:
In JS
process.env.APP_NAME
In Manifest
{
"name": "__APP_NAME__",
}