Socket
Socket
Sign inDemoInstall

webpack-chain

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-chain

[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Build Status][travis-image]][travis-url]


Version published
Weekly downloads
644K
increased by1.97%
Maintainers
4
Weekly downloads
 
Created

What is webpack-chain?

webpack-chain provides a chaining API to simplify the customization of webpack configurations. It allows developers to modify webpack configurations in a more readable and maintainable way by using a fluent API.

What are webpack-chain's main functionalities?

Basic Configuration

This feature allows you to set up basic webpack configurations such as entry points and output paths using a fluent API.

const Config = require('webpack-chain');
const config = new Config();

config
  .entry('app')
    .add('./src/index.js')
    .end()
  .output
    .path(__dirname + '/dist')
    .filename('bundle.js');

module.exports = config.toConfig();

Loaders

This feature allows you to add and configure loaders for different file types. In this example, it sets up loaders for CSS files.

config.module
  .rule('css')
    .test(/\.css$/)
    .use('style-loader')
      .loader('style-loader')
      .end()
    .use('css-loader')
      .loader('css-loader');

Plugins

This feature allows you to add and configure plugins. In this example, it adds the HtmlWebpackPlugin to the webpack configuration.

const HtmlWebpackPlugin = require('html-webpack-plugin');

config.plugin('html')
  .use(HtmlWebpackPlugin, [{
    template: './src/index.html'
  }]);

Dev Server

This feature allows you to configure the webpack-dev-server. In this example, it enables hot module replacement, sets the port to 3000, and configures the server to open the browser automatically.

config.devServer
  .hot(true)
  .port(3000)
  .open(true);

Other packages similar to webpack-chain

Keywords

FAQs

Package last updated on 25 Jul 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc