Skip to content

Config validation - part one #654

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

Closed
SpaceK33z opened this issue Oct 12, 2016 · 8 comments
Closed

Config validation - part one #654

SpaceK33z opened this issue Oct 12, 2016 · 8 comments

Comments

@SpaceK33z
Copy link
Member

SpaceK33z commented Oct 12, 2016

webpack-dev-server should validate it's configuration against a schema, just like webpack v2 does.

The plan is to add a hook to webpack. This hook validates the given schema against the given options. So before we can start on this ticket, webpack needs to provide this hook for us.

Note that this should also work for webpack-dev-middleware.

Part two will be about having even more config validation; e.g. warning if a combination of options doesn't work.

@SpaceK33z
Copy link
Member Author

Working on this atm in the options-schema branch. If anyone wants to help, that is very welcome.

@SpaceK33z SpaceK33z self-assigned this Nov 5, 2016
@SpaceK33z
Copy link
Member Author

Released in 2.1.0-beta.11.

@aaronroberson
Copy link

@SpaceK33z With 2.1.0-beta.11 I'm getting the following error:

/node_modules/webpack-dev-server/bin/webpack-dev-server.js:376
        throw e;
        ^
TypeError: webpack.validateSchema is not a function
    at new Server (/Users/bjon18/ashpod/node_modules/webpack-dev-server/lib/Server.js:23:33)
    at startDevServer (/Users/bjon18/ashpod/node_modules/webpack-dev-server/bin/webpack-dev-server.js:369:12)
    at processOptions (/Users/bjon18/ashpod/node_modules/webpack-dev-server/bin/webpack-dev-server.js:307:3)
    at Object.<anonymous> (/Users/bjon18/ashpod/node_modules/webpack-dev-server/bin/webpack-dev-server.js:431:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3```

@SpaceK33z
Copy link
Member Author

@aaronroberson, you need to update webpack to at minimum webpack 2.1.0-beta.26 (see also the release notes).

@aaronroberson
Copy link

Good to know, thanks!

@emilio-martinez
Copy link

@SpaceK33z as of beta.11 webpack-dev-server "fails" silently for me. I put fails in quotes because there's no real failure other than nothing happens—btw I'm using the node API.

The config that goes into webpack() is roughly:

devServer:
   { quiet: true,
     noInfo: true,
     compress: true,
     colors: true,
     contentBase: '/absolute/path/to/dir',
     publicPath: '/',
     port: 3000,
     hot: true,
     inline: true,
     historyApiFallback: true,
     host: '0.0.0.0',
     https: false,
     setup: [Function],
     staticOptions: { extensions: [Object] } }

I can share the rest of my config, but ultimately beta.10 worked fine with this setup, and I can't discern if there's any specific config item that should be called out. I know that there's emphasis on providing validation, but I'l literally getting radio silence. Is there anything specific that's changed in this release that I'm not accounting for?

@SpaceK33z
Copy link
Member Author

SpaceK33z commented Nov 15, 2016

@emilio-martinez weird. The biggest change is the config validation, but that should always throw an error if something is wrong. Could you try and remove as much options as possible with the error still occurring? The only wrong option I see here is colors: true, that doesn't do anything.

Edit: please open a new issue if you're sure it's a new bug introduce in beta.11, that way I'll not forget it ;).

@emilio-martinez
Copy link

@SpaceK33z hmm! Don't know where I got the colors option from but interestingly enough that's what was stopping the process silently. Logged! Thank you!

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

3 participants