Add environment variables to manifest.json files
See original GitHub issueIs your proposal related to a problem?
In the application, we have several places where we put the values that are in the manifest file, like the theme color, the app name, etc. Unfortunately, if we need to change them one day, we would need to do it everywhere we use them.
Describe the solution you’d like
It would be of very good use if we were able to insert those names in an environment variable file, such as .env
, and use it in the manifest.json
as well, just like we do in the index.html
file.
{
"short_name": "%REACT_APP_SHORT_NAME%",
"name": "%REACT_APP_NAME%"
}
Describe alternatives you’ve considered
The only solution to have it automatic would be to or eject the configuration and apply the JSON files to the compilation files, or to add another compilation script that would run during the build process.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:83
- Comments:15
Top Results From Across the Web
Environment variables in manifest.json - Chrome Extension
In my case, I needed to set version automatically on manifest file. I added to webpack script: plugins: [ new CopyWebpackPlugin([ { from:...
Read more >Environment variables in manifest.json - Chrome Extension ...
Here's how you do it: Install craco into your project using npm i @craco/craco . Install copy-webpack-plugin as a dev-dependency in your project...
Read more >App Manifest Attribute Reference | Cloud Foundry Docs
Create a file called vars.yml . · Add attributes to your vars.yml file. For example: · Add the variables to your app manifest...
Read more >Creating environment variable from JSON file
You could write some PHP at the top of your general.php file that reads the JSON manifest in your public root directory, and...
Read more >Additional folders needed for path when running build ...
Build error: env: node: No such file or directory Path was: ... desktop app currently doesn't set the PATH environment variable correctly”.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Marian0 In
webpack.config.js
I usedCopyPlugin
which has atransform
method that you can do string replacements on. e.g.This works in dev and builds.
Would love to env var support build into CRA for any/all(?) public dir files.