survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

in safari, not passing host fails the live reload of code #343

Closed superandrew closed 3 years ago

superandrew commented 3 years ago

In the book the example with webpack-plugin-serve fails on Safari (Mac Os Big sure) unless host is specified:

module.exports = {
  watch: mode === "development",
  entry: ["./src", "webpack-plugin-serve/client"],
  mode,
  plugins: [
    new MiniHtmlWebpackPlugin({ context: { title: "Demo" } }),
    new WebpackPluginServe({
      port: process.env.PORT || 8080,
      static: "./dist",
      liveReload: true,
      waitForBuild: true,
      host: "127.0.0.1",
    }),
  ],
}

In chrome it works normally. It took some time to understand what was going wrong, so I hope this might help others.

superandrew commented 3 years ago

I think it's related to https://github.com/survivejs/webpack-book/issues/342 (not sure why it was closed by the OP)

bebraw commented 3 years ago

Thanks! I've fixed this and I'll deploy the fix soon.

I opened a related issue at https://github.com/shellscape/webpack-plugin-serve/issues/215 . Maybe you can comment there.