Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 6, 2024 via pnpm

webpack-merge 5.9.0

Variant of merge that's useful for webpack configuration
Package summary
Share
0
issues
1
license
7
MIT
Package created
26 Jun 2015
Version published
22 May 2023
Maintainers
1
Total deps
7
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
clone-deep@4.0.1
is-plain-object@2.0.4
isobject@3.0.1
kind-of@6.0.3
shallow-clone@3.0.1
webpack-merge@5.9.0
wildcard@2.0.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of webpack-merge 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
clone-deep4.0.13.12 kBMIT
prod
wildcard2.0.13.98 kBMIT
prod

Visualizations

Frequently Asked Questions

What does webpack-merge do?

Webpack-merge is a powerful tool designed for the purpose of merging and configuring Webpack objects. It provides a merge function that concatenates arrays and merges objects, creating a new object. If functions are encountered during merging, Webpack-merge executes them, runs the results through the algorithm, and then wraps the returned values within a function again. This makes Webpack-merge particularly useful for configuring Webpack, but it also has numerous applications beyond this.

How do you use webpack-merge?

In order to use Webpack-merge, you first need to import the module using const { merge } = require('webpack-merge');. Then, you can use the merge function to merge multiple objects together, resulting in a new combined object. A basic usage example is as follows:

const { merge } = require('webpack-merge');

// Merging object1, object2 and object3 into a new object
const output = merge(object1, object2, object3);

// Merging an array of objects. This works with all available functions
const output = merge([object1, object2, object3]);

For a more dynamic and complex Webpack configuration, you could use a switch case statement to merge different configurations depending on the provided mode:

const commonConfig = { ... };
const productionConfig = { ... };
const developmentConfig = { ... };

module.exports = (env, args) => {
  switch(args.mode) {
    case 'development':
      return merge(commonConfig, developmentConfig);
    case 'production':
      return merge(commonConfig, productionConfig);
    default:
      throw new Error('No matching configuration was found!');
  }
};

In this case, you would use webpack --mode development or webpack --mode production to choose your desired configuration.

Moreover, merge behavior can be customized at a per-field level using mergeWithCustomize.

Where are the webpack-merge docs?

The detailed documentation and code examples for Webpack-merge can be found directly in the package's README on its GitHub repository at https://github.com/survivejs/webpack-merge. Comprehensive explanations and additional use cases for Webpack-merge are featured in the book "SurviveJS - Webpack 5", accessible at http://survivejs.com/. Further support and expertise is also available through the consulting services provided by the creators and maintainers of Webpack-merge.