Skip to content

Ambiguity in Overriding Configurations #6813

Open
@cseas

Description

@cseas

Feature to document

Merging arrays and objects within two webpack configs.

Congrats to the team on shipping the extends flag! 🎉

I went through the docs and it's not clear whether the extends option can be used to merge arrays and objects from two configs like we can do with the webpack-merge package.

For example, is the below config going to override the module property of the base config completely?

module.exports = {
  extends: path.resolve(__dirname, './base.webpack.config.js'),
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
};

It's a common use-case to preserve the rules and plugins of the base config and only add to the existing rules/plugins. Example, adding one rule to Storybook's webpack config.

If this is not supported by the extends property, can webpack-merge or object spreading be listed as an alternative in the documentation?

Use-case:

Merging two webpack configs and concatenating the objects and arrays inside them instead of overriding the base config's properties completely.

Author(s)

@burhanuday

Additional information

[ ] I am willing to work on this issue and submit a pull request.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions