Here is my project structure:

package.json:
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "nodemon $NODE_DEBUG_OPTION server/boot.js --exec babel-node",
     "start": "nodemon server/boot.js --exec babel-node",
     "build": "babel server -d dist/server",
     "serve": "node dist/server/boot.js"
   },
The main file is server/boot.js:
import dotenv from 'dotenv';
import path from 'path';
dotenv.load({path: path.join(__dirname, '.env')});
import _ from 'underscore';
import configs from './config/index';
The server/config/index.js is only a barrel file that imports the other config files:
import app from './app';
import database from './database';
export default Object.assign({}, app, database);
In each of the config files I am not able to access any properties of the process.env object that are defined in the .env file.
Here is one of the config files for reference:
export default  {
    app: {
        host: process.env.HOST || 'localhost',
        port: process.env.PORT || 9000,
    }
}
Here process.env.HOST is undefined, but the key is present in the .env file.
What is wrong with my code?