@humblebee/config-wepback4
Centralized configuration for webpack v4
Getting started
Install the packages from your favorite package manager
npm i -D webpack @humblebee/config-wepback4
This package provides a default centralised config for building web applications with webpack v4.
import path from 'path';
import { getWebpack4Configuration } from '@humblebee/config-webpack4';
const BUILD_FOLDER = path.resolve(__dirname, 'dist');
const PUBLIC_FOLDER = path.resolve(__dirname, 'public');
const getWebpackConfiguration = (_env, args) => {
const { mode } = args;
switch (mode) {
case 'development':
return getWebpack4Configuration(
'development',
{
buildFolder: BUILD_FOLDER,
publicFolder: PUBLIC_FOLDER,
htmlTemplate: path.resolve(PUBLIC_FOLDER, 'index.html'),
},
{
},
);
case 'production':
return getWebpack4Configuration(
'production',
{
buildFolder: BUILD_FOLDER,
publicFolder: PUBLIC_FOLDER,
htmlTemplate: path.resolve(PUBLIC_FOLDER, 'index.html'),
},
{
},
);
default:
throw new Error(`Unable to provide configuration for unknown environment: "${mode}"`);
}
};