Skip to content

Config validation - part two #615

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 Sep 21, 2016 · 2 comments
Closed

Config validation - part two #615

SpaceK33z opened this issue Sep 21, 2016 · 2 comments

Comments

@SpaceK33z
Copy link
Member

SpaceK33z commented Sep 21, 2016

See part one for what needs to get done before this is even relevant.

webpack has strict validation of the configuration now. It's time for webpack-dev-server, and webpack-dev-middlware to also get some validation on the configuration.

The validation should give warnings only in the beginning. In a later release, we can change this to be errors. The webpack-dev-* packages are used in so many different usecases, that it is very hard to not break things for users.

A couple of things that we should especially look at:

  • Invalid combinations (e.g. --inline in combination with --lazy or --hot with --hot-only).
  • Using inline: true in the node API; this only has effect if you're using the CLI.
  • Using hot: true in the node API without the HotModuleReplacementPlugin.
  • Using CLI with inline modus (defaults to on since v2), and manually including webpack-dev-server/client.
  • Some options don't work correctly when using a relative path; this should show a warning.
  • Using an absolute path in output.filename or in entry (see Webpack dev server respond 404 if set entry name or output.fileName with prefix ‘/’.  #670).

cc @bebraw

@SpaceK33z SpaceK33z changed the title Validate the config Config validation Sep 21, 2016
@SpaceK33z
Copy link
Member Author

Started working on this today, but I'm running into a couple of problems.

webpack itself handles a part of the command line parsing from webpack-dev-server, because there is some overlap. E.g. webpack handles --hot and the adding of HotModuleReplacementPlugin when this flag is given.

But, some options are specific to WDS, so they are parsed in WDS and not in webpack. E.g. the inline option.

Other options are specific to webpack-dev-middleware, like the lazy and filename option.

A while ago I made PR #2950 for webpack, which introduces some validation when you're using --hot AND already including HotModuleReplacementPlugin in your webpack config.

So my question is, where do we put all the validation logic? When starting WDS, it would be nice if there is a list of all errors. This is difficult when everything is spread out into different repo's though.

@bebraw
Copy link
Contributor

bebraw commented Sep 22, 2016

I'm thinking the best course of action would be to decouple WDS from webpack entirely. I have a feeling their interaction leads some of those configuration issues.

I understand you need to do entry and HMR configuration on webpack to get this working, but the way it's currently done isn't great. There's also the additional problem of devServer configuration at webpack core. Validation for that should probably happen at WDS.

Good problems to solve.

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

No branches or pull requests

4 participants