Skip to content

Support environment variable replacement in manifest value fields #16

@WillNeill

Description

@WillNeill

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__",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: medup to a weekimpact: medminor perf improvements, fix broad userbase issuestype: feature or enhancementAn issue or pull request that adds a feature or enhances a current one

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions