Skip to content

Webpack specified host not working on Windows #1567

@Snivio

Description

@Snivio
  • Operating System: Windows
  • Node Version: 8.11.1
  • NPM Version: 5.6.0
  • webpack Version: 4.20.2
  • webpack-dev-server Version: 3.1.9
  • [Webpack not running on specified host in the code as 0.0.0.0 on windows but works on others ]
  • [Require it to work on windows as well ]

Code

const HtmlWebPackPlugin = require("html-webpack-plugin");
const LiveReloadPlugin = require("webpack-livereload-plugin");
const path = require('path');

module.exports = {
  entry: [
    // 'webpack-dev-server/client?http://localhost:5500/',   //had to do this to fix the sockjs error
    './src/index.js'
  ],
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: 'index.bundle.js',
    publicPath: '/'
  },
  mode: 'development',
  devtool: 'source-map',
  devServer: {
    historyApiFallback: true,
    noInfo: true,
    overlay: true,
    port: 8080,
    host: '0.0.0.0',
    disableHostCheck: true,
  },
  module: {
    rules: [
      {
        test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: 'file-loader',
            options: {}
          }
        ]
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader"
        }
      },
      {
        test: /\.html$/,
        use: [
          {
            loader: "html-loader"
          }
        ]
      },
      {
        test: /\.less$/,
        use: [{
          loader: 'style-loader',
        }, {
          loader: 'css-loader', // translates CSS into CommonJS
        }, {
          loader: 'less-loader', // compiles Less to CSS
          options: {
            modifyVars: {
              'primary-color': '#0D2D46',
              'link-color': '#3f4756',
              'border-radius-base': '6px',
              'heading-color': '#011424',
              'text-color': '#002E57',
              'success-color': '#00d5ab',
              'error-color': '#C23E6C',
              'warning-color': '#DBA11C',
              'font-size-base': '14px',
            },
            javascriptEnabled: true,
          }
        }]
      }
    ]
  },
  plugins: [
    new HtmlWebPackPlugin({
      template: "./src/index.html",
      filename: "./index.html"
    })
  ]
};
  // webpack.config.js

The code should run on windows on host :0.0.0.0

it works on other OS on that host on windows it Works as Localhost

How to make it run on the specified host on windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions