Socket
Book a DemoInstallSign in
Socket

@humblebee/config-webpack5

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@humblebee/config-webpack5

Centralized configuration for webpack v5

2.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

@humblebee/config-wepback5

Centralized configuration for webpack v5

Getting started

Install the packages from your favorite package manager

npm i -D webpack @humblebee/config-wepback5 # or yarn

This package provides a default centralised config for building web applications with webpack v5.

// webpack.config.babel.js
import path from 'path';
import { getWebpack5FrontendConfiguration } from '@humblebee/config-webpack5';

// 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 getWebpack5FrontendConfiguration(
        '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 getWebpack5FrontendConfiguration(
        '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}"`);
  }
};

Keywords

build

FAQs

Package last updated on 04 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.