Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As of 0.8.3 webpackMerge mutates the inputs #12

Closed
sullivanpt opened this issue Mar 17, 2016 · 3 comments
Closed

As of 0.8.3 webpackMerge mutates the inputs #12

sullivanpt opened this issue Mar 17, 2016 · 3 comments

Comments

@sullivanpt
Copy link

This is a new behavior that didn't occur in 0.7.x; I'm not sure its a "bug" but it should at least be documented. The webpackMerge function mutates the inputs, as evidenced by the unit test below. It's a problem because I've been using webpackMerge in series to build multiple distinct configurations, for example in webpack.config.js:

module.exports = [
  webpackMerge({}, defaultConfig, commonConfig, clientConfig),
  webpackMerge({}, defaultConfig, commonConfig, serverConfig)
]

The failing test:

  it('should not mutate inputs', function () {
    const a = {
      output: {
        filename: 'bundle.js'
      }
    };
    const b = {
      output: {
        path: 'path/b'
      }
    };

    const aClone = JSON.parse(JSON.stringify(a));
    merge({}, a, b);

    assert.deepEqual(a, aClone); // this fails with actual: -    "path": "path/b"
  });
@PatrickJS
Copy link

I use webpack-merge everywhere now but this is becoming a problem for universal applications

@bebraw bebraw closed this as completed in 14855a5 Mar 17, 2016
@bebraw
Copy link
Member

bebraw commented Mar 17, 2016

Thanks for reporting! I was missing a little corner case there. Fixed in 0.8.4.

@PatrickJS
Copy link

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants