Va1 / browser-sync-webpack-plugin

Easily use BrowserSync in your Webpack project.
MIT License
371 stars 42 forks source link

IPv6 #50

Open infintesimal opened 7 years ago

infintesimal commented 7 years ago

Hi, I am running webpack on a very new chromebook that prefers IPv6 strongly to IPv4. When I start my webpack/browser-sync with the following config

var customer = process.env.customer;
var commonConfig = require('./webpack.common.js');
var customerUrl = require('./customerUrls.json');
var webpackMerge = require('webpack-merge');
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');

module.exports = webpackMerge(commonConfig, {
    plugins: [
        new BrowserSyncPlugin({
                host: "[::1]",
                port: 3000,
                proxy: customerUrl[customer],
                serveStatic: ["./build/" + customer, "./src/"],
                snippetOptions: {
                    rule: {
                        async: false,
                        match: /<\/head>/i,
                        fn: function(snippet, match) {
                            var file = "<script async type='text/javascript' src='/bundle.js' />";
                            return  file + snippet + match
                        }
                    }
                }
            },
            {
                reload: true
            })
    ]
});

I get the mostly correct output on my dev console, it looks like

[Browsersync] Access URLs:
 ----------------------------------
       Local: http://localhost:3000
    External: http://[::1]:3000
 ----------------------------------
          UI: http://localhost:3001
 UI External: http://::1:3001
 ----------------------------------

I am new to webpack and browser-sync world, I haven't found the toggle that would try to autopop the site I am proxying at

http://[::1]:3000

rather than

http://localhost:3000

I've mucked with etc hosts to no avail yet, I am sure I am overlooking some really simple. Help is appreciated!

For what it is worth: ipv6 may be a culprit too in issue #27 for the person who spoke of works on older host but not newer one.