Skip to content

Add hot-only option to allow setting only-dev-server from cli or config #439

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

Merged
merged 1 commit into from
May 15, 2016
Merged

Add hot-only option to allow setting only-dev-server from cli or config #439

merged 1 commit into from
May 15, 2016

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Mar 29, 2016

I currently have to mess around with entry manually as I want only-dev-server. This allows me to just add the options, or cli flag.

current:

entry: [
  'webpack-dev-server/client?http://0.0.0.0:3030',
  'webpack/hot/only-dev-server',
  origConfig.entry
],
devServer: {
  host: '0.0.0.0',
  port: 3030,
  hot: true,
},

wanted:

devServer: {
  host: '0.0.0.0',
  port: 3030,
  hotOnly: true,
  inline: true
},

Ideally I'd PR this into webpack-dev-server@1 (as IE8 support is dropped, we'll probably never upgrade), but there doesn't seem like there's a branch for it.

@SimenB
Copy link
Contributor Author

SimenB commented Apr 12, 2016

@sokra ping

@@ -38,6 +39,11 @@ yargs.options({
default: true,
describe: "Inline mode"
},
"hotOnly": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"hotOnly" => "hot-only" for the CLI argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yargs normalizes it, so both works. I can change it though 😄

@SimenB
Copy link
Contributor Author

SimenB commented Apr 12, 2016

@sokra Updated

@SimenB
Copy link
Contributor Author

SimenB commented Apr 25, 2016

@sokra ping.

Also, thoughts on a v1 branch?

@SimenB
Copy link
Contributor Author

SimenB commented May 12, 2016

@sokra ping.

@sokra sokra merged commit a77eac5 into webpack:master May 15, 2016
@sokra
Copy link
Member

sokra commented May 15, 2016

Thanks

@SimenB SimenB deleted the hot-only branch May 16, 2016 06:03
@harmony7
Copy link

Hi, I have a comment on this. It seems that with --hot-only, the HotModuleReplacementPlugin plugin does not get loaded as it would with --hot. At the current time I can work around this problem by supplying both --hot and --hot-only to get the behavior I want.

Digging deeper it seems that this processing is done in webpack/bin/convert-argv.

        ifBooleanArg("hot", function() {
            ensureArray(options, "plugins");
            var HotModuleReplacementPlugin = require("../lib/HotModuleReplacementPlugin");
            options.plugins.push(new HotModuleReplacementPlugin());
        });

How would we go about getting this fixed? Is it something that needs fixing in webpack? (Why is it webpack's job to handle ARGV for webpack-dev-server, anyway?)

@SimenB
Copy link
Contributor Author

SimenB commented Jun 23, 2016

That's by design. It's for the entrypoint webpack/hot/only-dev-server. You still need to activate hmr with hot.

The goal of this option was to avoid supplying entrypoints, as can be seen in my opening post

@harmony7
Copy link

Thanks for your response.

Okay. I saw this code change you made in Server.js:

    this.hot = options.hot || options.hotOnly;

So I thought you were trying to make it so you had to specify only one or the other to activate hot

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

Successfully merging this pull request may close these issues.

3 participants