Adding Development Environment Variables In .env

This feature is greatly inspired by create-react-app.

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).

What other .env files can be used?

  • .env: Default.
  • .env.local: Local overrides. This file is loaded for all environments except test.
  • .env.development, .env.test, .env.production: Environment-specific settings.
  • .env.development.local, .env.test.local, .env.production.local: Local overrides of environment-specific settings.

Files on the left have more priority than files on the right:

  • poi: .env.development.local, .env.development, .env.local, .env
  • poi build: .env.production.local, .env.production, .env.local, .env
  • poi test: .env.test.local, .env.test, .env (note .env.local is missing)

HTML template file

Poi uses html-webpack-plugin to generate index.html.

Here is the template file we use, basically it automatically injects webpack assets to the HTML and using lodash.template syntax.

To use a custom one, you can populate an index.ejs file in the root of your project, it will be automatically picked up.