Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wearehumblebee/config-webpack4
Centralized configuration for webpack v4
https://github.com/wearehumblebee/config-webpack4
Last synced: 23 days ago
JSON representation
Centralized configuration for webpack v4
- Host: GitHub
- URL: https://github.com/wearehumblebee/config-webpack4
- Owner: wearehumblebee
- License: mit
- Created: 2021-04-16T14:16:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-30T10:24:50.000Z (about 3 years ago)
- Last Synced: 2024-11-13T05:58:47.458Z (about 2 months ago)
- Language: TypeScript
- Size: 1.07 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @humblebee/config-wepback4
Centralized configuration for webpack v4
## Getting started
Install the packages from your favorite package manager
```bash
npm i -D webpack @humblebee/config-wepback4 # or yarn
```This package provides a default centralised config for building web applications with webpack v4.
```js
// webpack.config.babel.js
import path from 'path';
import { getWebpack4Configuration } from '@humblebee/config-webpack4';// arbitrary
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',
{
// options for the shared configuration
buildFolder: BUILD_FOLDER,
publicFolder: PUBLIC_FOLDER,
htmlTemplate: path.resolve(PUBLIC_FOLDER, 'index.html'),
// devServer: {
// // ...
// }
},
{
// options forwarded to the webpack configuration
// add whatever you need
},
);
case 'production':
return getWebpack4Configuration(
'production',
{
// options for the shared configuration
buildFolder: BUILD_FOLDER,
publicFolder: PUBLIC_FOLDER,
htmlTemplate: path.resolve(PUBLIC_FOLDER, 'index.html'),
// imageminOptions: {},
// subResourceIntegrityOptions: {},
// hashedModuleIdsOptions: {},
},
{
// options forwarded to the webpack configuration
// add whatever you need
},
);
default:
throw new Error(`Unable to provide configuration for unknown environment: "${mode}"`);
}
};
```