Static config file at project root post 1.0.0
See original GitHub issueCreating a new issue as I can’t reopen https://github.com/facebookincubator/create-react-app/issues/1469
With the 1.0 updates stopping any files outside src
working, where is the correct place to have static config files?
My previous solution (seen below) of having a config
folder at the project root doesn’t work. Not sure what the recommend solution is because it doesn’t feel right to pull a config
folder inside src
.
env
files won’t provide the functionality I am after, as the config files include arrays/objects.
const merge = require('lodash/merge');
const global = require('./global');
var env; // let doesn't seem to work here
if (process.env.NODE_ENV === 'development') {
env = require('./development');
} else {
env = require('./production');
}
module.exports = merge(global, env);
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Static config file at project root · Issue #1469 - GitHub
I want to have a config directory in the root of my project, and inside an index.js something like: import local from './local';...
Read more >node.js - express.static() only works when run locally
static (__dirname + '/build')) should be serving all static files in my build folder, but it seems that in production it isn't working...
Read more >Config Plugins - Expo Documentation
The compiler iterates over all of the mods and asynchronously evaluates them, providing some base props like the projectRoot . After each mod,...
Read more >Create-react-app environments - Medium
React imports environment variables that are defined in a .env file at the root of the project. Skip to Environment Configuration if you're...
Read more >Configuration Reference - Astro Documentation
Configuration Reference. The following reference covers all supported configuration options in Astro. To learn more about configuring Astro, read our guide ...
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 Free
Top 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
That’s the recommended solution, if you need to import it, put it in
src
. This ensures it gets compiled.Fair enough, doesn’t feel right that
config
should live insidesrc
but guess it the easiest solution.Thanks for the help @codedavinci