When calling webpack using the node api like so:
webpack(webpackConfig, (error, stats) => {
// Do stuff
});
I can't find any documentation on how I'm supposed to pass along the mode env (--mode) that has been added in V4.
It is part of the webpackConfig object
Yeah I just now figured that out, what confused me was that setting mode: '..' in the config will throw a warning saying that webpack doesn't allow this. I assume this hasn't been updated?
Could you please post your webpack version and warning message?
"webpack": "^4.1.1",

the link to 'webpack Options schema' also returns a 404 :)
What is that? We don't have control over IDE Integrations.
But guessing I would say that is IntelliJ https://www.jetbrains.com/help/idea/webpack.html and it is using https://github.com/webpack-contrib/schema-utils to validate webpack options, in that case, Could you please send a PR to https://github.com/webpack-contrib/schema-utils adding that new option?
Thanks!
I explored Jetbrains issue tracker and found https://youtrack.jetbrains.com/issue/WEB-14019#u=1497141261503, it never mentions exactly what is used :/
@Pixelatex What is the link?
I took a look at the node modules folder of webpack, in 'schemas' the WebpackOptions.json doesn't have 'mode'
Yep, just found it https://github.com/webpack/webpack/blob/master/schemas/WebpackOptions.json, the current file have mode option documented, so, it is an error from Jetbrains.
That file was renamed on https://github.com/webpack/webpack/commit/cdd593b8472526ebb46edb85f43e6f414240f122#diff-03af1a9344cf93838ad925ff61de02aa (Nov 11, 2017), maybe you have an outdated version of your editor?
latest version of webstorm but I guess I might have to make a bug report on their end then. Bit strange that the validation seems to be using an older version.
Are you sure you have the latest version of webpack installed, that file have mode option on my computer using webpack 4.1.1

Yeah, it's the latest one but it seems like I misread, mode is indeed in there.
So it seems that they are using the wrong file to validate the schema, maybe from a global installation?
Check your IDE Webpack Settings for any related option that could affect it.
IntelliJ-based products are using bundled copy of the schema. 2017.3.* and lower use schema from webpack 2 which is missing that attribute. 2018.1 will use proper schema depending on the webpack version (WEB-31469).
So many things that won't be fixed until 2018.1, hope they release it soon
@Pixelatex we're releasing Public Preview this week with the full release around the end of month.
@denofevil didn't realise you were part of intelij :p thanks for that info. Been waiting a while for some things!
Most helpful comment
IntelliJ-based products are using bundled copy of the schema. 2017.3.* and lower use schema from webpack 2 which is missing that attribute. 2018.1 will use proper schema depending on the webpack version (WEB-31469).