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

[4.0.0-rc4] Regression after removing lodash (when using multi-compiler mode) #390

Closed
jakub-g opened this issue Jan 22, 2019 · 4 comments
Closed

Comments

@jakub-g
Copy link
Contributor

jakub-g commented Jan 22, 2019

In #364 _.clone was replaced with Object.assign.

This change assumed that webpackOptions is always an object, but in fact, it can be an array (multi-compiler mode, see https://github.com/webpack/webpack/tree/master/examples/multi-compiler).

So after this change, an array [ objA, objB ] becomes an object { 0: objA, 1: objB } and then some subsequent logic gets changed, but also the subsequent webpack(...) call checks the passed config and throws an error:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property '1'. These properties are valid:
...

I propose to rollback this change then. But instead of using lodash we could use lodash.clone: https://www.npmjs.com/package/lodash.clone as it's the only lodash method used.

@jakub-g jakub-g changed the title [4.0.0-rc4] Regression after removing lodash when using multi-compiler mode [4.0.0-rc4] Regression after removing lodash (when using multi-compiler mode) Jan 22, 2019
@matthieu-foucault
Copy link
Collaborator

Good catch! Feel free to make a pull request if you have time!

@jakub-g
Copy link
Contributor Author

jakub-g commented Jan 22, 2019

Yep I'm working on it :)

@georgeholt
Copy link

Unsure if this is related, however I'm getting the same error when using a multi-compiler config, but I'm on webpack-karma version 3.0.5. The error I get is:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration has an unknown property '9'.

My Karma configuration is as follows:

{
  frameworks: ['mocha'],
  reporters: ['mocha'],
  files: [
    { pattern: './tests/index.js' }
  ],
  preprocessors: {
    'tests/**/*.js': ['webpack', 'sourcemap']
  },
  webpack: webpackMerge(webpackConfig({ development: true }), {
    entry: null,
    output: null,
    devtool: 'inline-source-map',
    resolve: {}
  })
}

My webpack config is a little large (first time using it), but it builds fine.

On a side note, feel free to ignore this but I haven't found anything on the subject, but is there a way to disable security policies on browsers that Karma tests on? I need to run tests that use the Audio element, but of course the browser makers thought it "wise" to block playback until user interaction.

@codymikol
Copy link
Owner

Closing as this seems to have been fixed with 63cfd78

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

No branches or pull requests

4 participants