-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Depecrated way of passing compiler and options does not work if options is not defined #3659
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
Comments
Please use |
You should always pass options to constructor, if you have not options, please use |
Even if it's deprecated you shouldn't just break it until it's actually removed, this is a breaking change for some people. |
Do you mean |
We are in beta, it is not stable and never be stable |
Well, if you're bothering with a support for the legacy order of arguments, it should work with the legacy order of arguments. Deprecated means "will stop working in a future version" not "well maybe it works maybe it doesn't, who knows". |
Code
In Server.js, the signature of the constructor is "(options={}, compiler)".
For reasons I have not looked into, there is a temporary code (signaled by a TODO), that reverses those two if options.hooks is true. I'm guessing essentially making it work with (options, compiler) as well as (compiler, options).
But compiler does not have a default value, unlike options. So if you call
without options, options will be undefined, which throws an error when calling validate.
works.
This used to work in our pipeline and stopped working suddenly, not sure what caused it, probably an update somewhere.
Please paste the results of
webpack-cli info
here, and mention other relevant informationExpected Behavior
I can call WebpackDevServer with only a compiler without passing options
Actual Behavior
If you just call new WebpackDevServer(compiler) it will throw an error, even though
and
work
For Bugs; How can we reproduce the behavior?
see above snippet.
The text was updated successfully, but these errors were encountered: