Webpack-dev-server: webpack.config.js, webpack-dev-server open option has bug.

Created on 25 Jun 2017  路  20Comments  路  Source: webpack/webpack-dev-server

on the [email protected]. I was set like this.

    devServer: {
        hot : true,
        inline: true,
        host: '0.0.0.0',
        disableHostCheck: true,
        port: 3000,
        open : true,  // this is point option
        contentBase : "public",
        watchOptions: {
            aggregateTimeout: 300,
            poll: 1000
        }
    },

I expect open http://localhost:3000/ on browser, but the behavior is http://localhost:3000/undefined.
So I tested on [email protected]. It works good. I think @2.5.0 bug. How about reference require('opn'). I guess this module is related the behavior.

Thanks !

2 (regression) bug

Most helpful comment

As a quick fix, you can add openPage: '' to your options:

  devServer: {
    host: 'localhost',
    port: 3000,
    contentBase: './dist',
    hot: true,
    open: true,
    openPage: '', // <== Add this
  },

All 20 comments

+1

Can confirm. I had to downgrade to 2.4 to get it working again.

+1

+1

Same for me. Using the --open CLI option still works as expected, however. I speculate that this is some order of operations issue, where the middleware is called before the paths are set.

Use reactions 馃憤 option if you want to give more value to this issue instead of commenting +1.

Had the same problem with it today. Thanks for solutions!

+1

+1

As a quick fix, you can add openPage: '' to your options:

  devServer: {
    host: 'localhost',
    port: 3000,
    contentBase: './dist',
    hot: true,
    open: true,
    openPage: '', // <== Add this
  },

+1

@ThadeuLuz
Thank you for advise!
I expect to fix the bug on next version.

+1

@ThadeuLuz
Thank you for advise

+1

@MarioDabrowski @aprather51 @polettoweb @goartur @scarletgirl Please use reactions on the original post in this thread (for example, 馃憤 ) instead of posting "+1" replies. It doesn't contribute to the discussion and only clutters the issue.

also I found that this issue doesn't occur when --open flag is used

973 resolves this, so when that is merged, this issue will the resolved. locking the convo to avoid more followups.

Hi everyone,
For those whose struggling with HMR, you can have a look at BrowserSync plugin for Webpack

lol) * just chekin my new avatar))) *

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daryn-k picture daryn-k  路  3Comments

mischkl picture mischkl  路  3Comments

piotrszaredko picture piotrszaredko  路  3Comments

adiachenko picture adiachenko  路  3Comments

Jack-Works picture Jack-Works  路  3Comments