How to use browser-sync-webpack-plugin - 4 common examples

To help you get started, we’ve selected a few browser-sync-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rehabstudio / fe-skeleton / run / tasks / scripts / index.js View on Github external
// If production argument was specified then add UglifyJS plugin into webpack.
    if (args.hasOwnProperty('is-production') && args['is-production'] === true) {
        scriptSettings.webpackSettings.plugins.push(
            new webpack.optimize.UglifyJsPlugin(scriptSettings.uglifySettings)
        );
    }

    // Asking webpack to watch will keep the process running until it's cancelled.
    // It will also start up a BrowserSync server which hosts the `dist` folder.
    if (taskOptions.watch) {
        scriptSettings.webpackSettings.watch = true;

        if (args.hasOwnProperty('serve') === false || (args.hasOwnProperty('serve') && args.serve !== false)) {
            scriptSettings.webpackSettings.plugins.push(
                new BrowserSyncPlugin(scriptSettings.browserSyncSettings)
            );
        }
    }

    // Open a stream, trigger webpack-stream compilation and push output to file system.
    return gulp.src([])
               .pipe(webpackStream(scriptSettings.webpackSettings))
               .pipe(gulp.dest(globalSettings.destPath + scriptSettings.genericOutputFolder));
}
github foxhound87 / rfx-stack / webpack / config.client.dev.js View on Github external
path.join(Dir.src, entry, 'client'),
      ],
    },
    output: {
      path: '/',
      publicPath: '/',
      filename: 'bundle.js',
    },
    plugins: [
      new FriendlyErrorsWebpackPlugin({
        clearConsole: true,
        compilationSuccessInfo: {
          messages: logServerConfigWebpack(entry),
        },
      }),
      new BrowserSyncPlugin({
        host: getenv('BROWSERSYNC_HOST'),
        port: getenv('BROWSERSYNC_PORT'),
        proxy: webhost(entry),
      }, { reload: false }),
      new webpack.HotModuleReplacementPlugin(),
      new webpack.NoErrorsPlugin(),
    ],
  };
}
github ethibox / ethibox / webpack.config.babel.js View on Github external
},
    plugins: [
        new HtmlWebpackPlugin({ filename: 'index.html', template: `${__dirname}/src/client/index.html`, hash: true }),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(env),
            'process.env.VERSION': JSON.stringify(gitRevisionPlugin.version()),
        }),
        new ExtractTextPlugin({ filename: '[name].css', allChunks: false }),
        new UglifyJsPlugin({ uglifyOptions: { output: { comments: false } } }),
        new CopyWebpackPlugin([{ from: './static/' }]),
    ],
};

if (env === 'development') {
    config.plugins.push(
        new BrowserSyncPlugin({ proxy: `http://0.0.0.0:${port}`, open: false }),
        new BundleAnalyzerPlugin({ openAnalyzer: false, defaultSizes: 'gzip', analyzerMode: 'static' }),
    );
}

export default config;
github dsifford / academic-bloggers-toolkit / webpack.config.ts View on Github external
transform(content) {
                    return content
                        .toString()
                        .replace(/{{VERSION}}/g, VERSION)
                        .replace(/{{CHANGELOG}}/g, CHANGELOG);
                },
            },
        ]),
        new CheckerPlugin(),
    ]);

    if (IS_PRODUCTION) {
        plugins.add(new ProgressPlugin());
    } else {
        plugins.add(
            new BrowserSyncPlugin({
                proxy: 'localhost:8080',
                open: false,
                reloadDebounce: 2000,
                port: 3005,
                notify: false,
            }),
        );
    }

    const TS_BASE_CONFIG = {
        silent: argv.json,
        useCache: !IS_PRODUCTION,
        cacheDirectory: path.resolve(
            __dirname,
            'node_modules/.cache/awesome-typescript-loader',
        ),

browser-sync-webpack-plugin

BrowserSync and Webpack integration

MIT
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis

Popular browser-sync-webpack-plugin functions