Change address from 127.0.0.1 to 0.0.0.0

Question:
I’ve changed my host to 0.0.0.0 but whenever I run the script replit says it is 127.0.0.1. What am I missing to get this corrected?
Repl link:
https://replit.com/@MajorPayne95/webpack-starter-template

module.exports = {
  mode: 'development',
  entry: {
    bundle: path.resolve(__dirname, 'src/index.js'),
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name][contenthash].js',
    clean: true,
    assetModuleFilename: '[name][ext]',
  },
  devtool: 'source-map',
  devServer: {
    static: {
      directory: path.resolve(__dirname, 'dist'),
    },
    host: '0.0.0.0',
    port: 8888,
    open: true,
    hot: true,
    compress: true,
    historyApiFallback: true,
  },
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env'],
          },
        },
      },
      {
        test: /\.(png|svg|jpg|jpeg|gif)$/i,
        type: 'asset/resource',
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Webpack App',
      filename: 'index.html',
      template: 'src/template.html',
    }),
    new BundleAnalyzerPlugin(),
  ],
}

what does that have to do with OP’s problem?

not what I was confused about

2 Likes

oh I read it wrong XD I thought they wanted it on 127.0.0.1

My host is set to 0.0.0.0 but when I build npm gives me an output of 127.0.0.1. I’m trying to figure out why it’s not staying at 0.0.0.0 xD

1 Like

Pretty sure that’s the default ip when you host anything.
If you try opening replname.majorpayne95.repl.co it (should?) work.

1 Like

Right, but replit is telling me to change it to 0.0.0.0 even though it is? Maybe I’m explaining it wrong.

Every solution to this error I found said to just set my host to 0.0.0.0 but it still won’t let me use webview

1 Like

when you try to open a port on host 0.0.0.0 each 0 is automatically replaced; this seems like expected behavior.

1 Like

Why does webview not work then? And why does Riplet give me an error indicating my host is wrong?

1 Like

Hiya @MajorPayne95, and welcome to the Replit Ask community! To answer your question, 0.0.0.0 is actually a placeholder for the default address. The default address… is… (drumroll please)

127.0.0.1! So yes, this is the normal behaviour of 0.0.0.0. To ‘fix’ it (assuming that means to have a different address):

  • change the address from 0.0.0.0 to something else
  • or, do not set the address entirely.

Happy coding! :upside_down_face:

2 Likes