Skip to content

Browser Sync does not load - white screen with Webpack / Wordpress  #2013

@irenehardy

Description

@irenehardy

Issue details

Running browser-sync via webpack for a Wordpress plugin. Everything compiles fine, but the proxied browser-sync window just opens a white screen that hangs on loading infinitely. No source code, no console information. Happens both via webpack, and in the command line directly calling browser-sync with the proxy url.

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [ 2.27.11 ]
  • Node [ 18.13.0 ]
  • Npm [ 8.19.3 ]

Affected platforms

  • linux
  • windows
  • [ x ] OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • [ x ] CLI
  • [ x ] Webpack

If CLI, please paste the entire command below

browser-sync https://[[redacted]].test

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

Webpack config -

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var path = require('path');

const jsPath= './public/js';
const cssPath = './public/scss';
const outputPath = './public/dist';
const localDomain = 'https://[[redacted]].test/';
const entryPoints = {
  'app': jsPath + '/scripts.js',
};

module.exports = {
  entry: entryPoints,
  output: {
    path: path.resolve(__dirname, outputPath),
    filename: '[name].js',
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: '[name].css',
    }),

    new BrowserSyncPlugin({
        proxy:  {
            target: localDomain,
            },
        host: '127.0.0.1',
        files: [ outputPath + '/*.css' ],
        injectCss: true
    }, 
    { reload: false, }),
  ],
  module: {
    rules: [
      {
        test: /\.s?[c]ss$/i,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader',
          'sass-loader',
        ],
      },
      {
        test: /\.sass$/i,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader',
          {
            loader: 'sass-loader',
            options: {
              sassOptions: { indentedSyntax: true },
            },
          },
        ],
      },
      {
        test: /\.(jpg|jpeg|png|gif|woff|woff2|eot|ttf|svg)$/i,
        use: 'url-loader?limit=1024',
      },
    ]
  },
};

Screen Shot 2023-02-16 at 9 04 37 PM

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