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