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

HMR doesn't work over network with multiple entry points, works fine with only one #421

Closed
mummybot opened this issue Mar 3, 2016 · 4 comments

Comments

@mummybot
Copy link

mummybot commented Mar 3, 2016

When I designate a single entry point, HMR works fine locally and on networked machines. When I switch to a named entry point for multiple entry points HMR continues to work locally but stops on networked machines. The console on the networked machine in both cases starts with [HMR] Waiting for update signal from WDS..., but nothing updates. A browser refresh serves the updated code.

On local machines I am accessing it via either http://localhost:9090 or IP http://X.X.X.X:9090. On network machines it is via IP http://X.X.X.X:9090 (so not IP related).

    // HMR Works locally and across network
    entry: [
        'webpack-dev-server/client?http://localhost:9090/',
        'webpack/hot/only-dev-server',
        path.resolve(__dirname, 'src/main.js')
    ],
    output: {
        path: path.resolve(__dirname, 'build'),
        filename: 'bundle.js',
    },
    // HMR works locally but not across network
    entry: {
        app: [
            'webpack-dev-server/client?http://localhost:9090/',
            'webpack/hot/only-dev-server',
            path.join(__dirname, 'src/main.js')
        ]
    },
    output: {
        path: path.resolve(__dirname, 'build'),
        filename: '[name]_bundle.js',
    },

Environment
NodeJS: v5.6.0
"webpack": "^1.12.13",
"webpack-dev-server": "^1.14.1"

  • Local
    • Mac OSX El Capitan and Chrome
    • xcode and iOs Simulator,
  • Network
    • a VirtualBox VM locally running Windows 8.1 and Chrome latest,
    • an external laptop on the network with Windows 7 and Chrome latest,
    • a networked iPad Air with iOs 9.2.1 and Safari
@mummybot
Copy link
Author

mummybot commented Mar 3, 2016

Hi @sokra and others,

I have created a test repo to show exactly this happening. Hopefully it is just my config setup.

Thanks for your help

@mummybot
Copy link
Author

mummybot commented Mar 3, 2016

Might be related to #416, the demo shows both bugs.

@sokra
Copy link
Member

sokra commented Mar 25, 2016

You can specify the network url for the webpack-dev-server:

'webpack-dev-server/client?http://localhost:9191/',

'webpack-dev-server/client?http://X.X.X.X:9191/',

@mummybot
Copy link
Author

Thanks @sokra

Instead of hardcoding your IP in the webpack config for different developers machines, you can use an IP library to specify the current IP.

# https://www.npmjs.com/package/ip
npm install ip --save-dev 

'webpack-dev-server/client?http://' + require("ip").address() + ':9191/',

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

2 participants