Skip to content

Instantly share code, notes, and snippets.

@sthzg
Last active August 10, 2016 22:06
Show Gist options
  • Save sthzg/b0d10767dd7b49dec657139d0377e5d0 to your computer and use it in GitHub Desktop.
Save sthzg/b0d10767dd7b49dec657139d0377e5d0 to your computer and use it in GitHub Desktop.
Config w/ activated Browser Sync Plugin
'use strict';
let path = require('path');
let webpack = require('webpack');
let baseConfig = require('./base');
let defaultSettings = require('./defaults');
let BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// Add needed plugins here
let BowerWebpackPlugin = require('bower-webpack-plugin');
let config = Object.assign({}, baseConfig, {
entry: [
'webpack-dev-server/client?http://127.0.0.1:' + defaultSettings.port,
'webpack/hot/only-dev-server',
'./src/index'
],
cache: true,
devtool: 'eval-source-map',
plugins: [
new BrowserSyncPlugin(
// BrowserSync options
{
// browse to http://localhost:3000/ during development
host: 'localhost',
port: 3000,
// proxy the Webpack Dev Server endpoint through BrowserSync
proxy: 'http://localhost:8000/',
files: [
'src/styles/*.css',
'src/*.html'
]
},
// plugin options
{
// prevent BrowserSync from reloading the page and let Webpack Dev Server take care of this
reload: false
}
),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new BowerWebpackPlugin({
searchResolveModulesDirectories: false
})
],
module: defaultSettings.getDefaultModules()
});
// Add needed loaders to the defaults here
config.module.loaders.push({
test: /\.(js|jsx)$/,
loader: 'react-hot!babel-loader',
include: [].concat(
config.additionalPaths,
[ path.join(__dirname, '/../src') ]
)
});
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment