Created
March 13, 2017 17:50
-
-
Save SaeedPrez/24551a02d059006821ab021769a137b3 to your computer and use it in GitHub Desktop.
Custom webpack config with browsersync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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