Adding Development Environment Variables In
This feature is greatly inspired by
Poi will load
.env file from your project root by default:
Then you can access this variable via
process.env.MY_APP_SECRET in your app code, if you try to
console.log(process.env.MY_APP_SECRET) in your Poi config file, it also works.
.env files should be checked into source control (with the exclusion of .env*.local).
.env files can be used?
.env.local: Local overrides. This file is loaded for all environments except test.
.env.production: Environment-specific settings.
.env.production.local: Local overrides of environment-specific settings.
Files on the left have more priority than files on the right:
HTML template file
Poi uses html-webpack-plugin to generate
Here is the template file we use, basically it automatically injects webpack assets to the HTML and using
To use a custom one, you can populate an
index.ejs file in the root of your project, it will be automatically picked up.