Skip to content

Try to use Browser-sync in our kit. But failed. #266

Description

@wayearn

You guys do a good job, I love your kit to do my development, helps a lot. Here is my problem:

I try to use Browser-sync in our kit, refresh the browser automatically after change any html,css,js code!

Follow the config file here : https://github.com/Browsersync/recipes/tree/master/recipes/webpack.react-hot-loader

Changed our project's config like this:

    'use strict';
require('core-js/fn/object/assign');
const webpack = require('webpack');
const config = require('./webpack.config');
const open = require('open');
var browserSync = require('browser-sync');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackHotMiddleware = require('webpack-hot-middleware');
var path = require('path');

var bundler = webpack(config);

browserSync({
    server: {
      baseDir: './src',

      middleware: [
        webpackDevMiddleware(bundler, {
          publicPath: path.join(__dirname,'dist','assets'),
          stats: { colors: true }
        }),
        webpackHotMiddleware(bundler)
      ]
    },
    files: [
      'src/**/*.scss',  //use for SCSS change and refresh browser
      'src/*.html'
    ]
});

The error is:

  1. F12 and console: /assets/app.jsis not loaded!
  2. Change any js code in components, the browser is refreshed, but show nothing in the page.

Anyone, any suggestions? Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions