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

V2.8.0/#1058 breaks promise based configs #1086

Closed
1 of 2 tasks
waterfoul opened this issue Sep 14, 2017 · 2 comments
Closed
1 of 2 tasks

V2.8.0/#1058 breaks promise based configs #1086

waterfoul opened this issue Sep 14, 2017 · 2 comments

Comments

@waterfoul
Copy link

  • Operating System: Windows 10
  • Node Version: v6.11.0
  • NPM Version: 5.4.1
  • webpack Version: 3.5.6
  • webpack-dev-server Version: 2.8.0+
  • This is a feature request
  • This is a bug

Code

I don't have time to make a small reproducible example but I found where the issue lies. In bin/webpack-dev-server.js you had a wpOpt variable which was being shadowed by function processOptions(wpOpt) {. 69239ce changed this but unfortunately you missed a few on lines 341 and 349 (both lines contain startDevServer(wpOpt, options);) This is causing them to load the formerly shadowed variable which I'm assuming contains some form of the config. Unfortunately if you have a promise based config this means that the promise unwrap code at the top of the function never runs on the variable which is passed in, resulting in the error below

Expected Behavior

A working server

Actual Behavior

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

  • configuration.entry should be one of these:
    object { : non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
    The entry point(s) of the compilation.
    Details:
    • configuration.entry should be an object.
    • configuration.entry should be a string.
    • configuration.entry[1] should be a string.
    • configuration.entry should be an instance of function
      function returning an entry object or a promise..

For Bugs; How can we reproduce the behavior?

It should happen for any promise based config

For Features; What is the motivation and/or use-case for the feature?

@shellscape
Copy link
Contributor

@waterfoul thanks for the report. unfortunately I'm having a hard time following you. looking at that commit, the only thing that changed with processOptions was a code format change. The functions are identical in functionality between the two commits: 69239ce#diff-83c4482ab4d62154c877147880243858L221

The same is true for the blocks surrounding the two calls to startDevServer 69239ce#diff-83c4482ab4d62154c877147880243858L364

I'm afraid we're going to need a more in-depth explanation of what you believe to be the cause.

@shellscape
Copy link
Contributor

Managed to get to the bottom of it. Moving forward, please try to be as specific as possible in issues with regard to the lines causing issues. It wasn't immediately clear what you were trying to convey when speaking about the lines mentioned; those two lines were using the wrong variables as the first parameter, and should have been using webpackOptions, instead of wpOpt from the top level scope.

smQaaa added a commit to smQaaa/webpack-dev-server that referenced this issue Jul 7, 2019
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

2 participants