Skip to content

Instantly share code, notes, and snippets.

@SaeedPrez
Created March 13, 2017 17:50
Show Gist options
  • Save SaeedPrez/24551a02d059006821ab021769a137b3 to your computer and use it in GitHub Desktop.
Save SaeedPrez/24551a02d059006821ab021769a137b3 to your computer and use it in GitHub Desktop.
Custom webpack config with browsersync
var webpack = require("webpack");
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
module.exports = {
entry: {
app: [
"./resources/js/app.js",
"./resources/css/app.styl"
]
},
output: {
path: path.resolve(__dirname, "./public_html"),
filename: "/js/[name].js"
},
module: {
rules: [
{
test: /\.css/,
use: "css-loader"
},
{
test: /\.styl$/,
use: ExtractTextPlugin.extract({
use: ["css-loader", "stylus-loader"]
})
},
{
test: /\.js$/,
exclude: /node_modules/
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin("/css/[name].css"),
new webpack.LoaderOptionsPlugin({
minimize: true
}),
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
proxy: "http://test.dev:80",
notify: false
})
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment