2022-10-14 13:31:40 -07:00
|
|
|
import dotenv from 'dotenv';
|
|
|
|
|
|
|
|
import type { Configuration } from 'webpack';
|
|
|
|
|
|
|
|
dotenv.config();
|
2020-04-26 10:49:20 -07:00
|
|
|
|
|
|
|
const { NODE_ENV } = process.env;
|
|
|
|
|
2022-10-14 13:31:40 -07:00
|
|
|
let configuration: Configuration = {};
|
|
|
|
|
2022-05-11 10:40:34 -07:00
|
|
|
switch (NODE_ENV) {
|
2022-05-11 14:06:35 -07:00
|
|
|
case 'development':
|
|
|
|
case 'production':
|
|
|
|
case 'test':
|
2022-10-14 13:31:40 -07:00
|
|
|
configuration = require(`./webpack/${NODE_ENV}`).default;
|
|
|
|
break;
|
2022-05-11 14:06:35 -07:00
|
|
|
default:
|
|
|
|
console.error('ERROR: NODE_ENV must be set to either `development`, `test`, or `production`.');
|
|
|
|
process.exit(1);
|
2020-04-26 10:49:20 -07:00
|
|
|
}
|
2022-10-14 13:31:40 -07:00
|
|
|
|
|
|
|
export default configuration;
|