-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.example.js
33 lines (31 loc) · 1.08 KB
/
webpack.example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const WebpackDevServer = require('webpack-dev-server')
const webpack = require("webpack")
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
const compiler = webpack({
entry: ["./example/index.js","./example/theme.scss", "./hotReloadScript.js", "webpack/hot/dev-server"],
output: {
path: path.join(__dirname, './example/dist'),
filename: "example.bundle.js",
},
devtool: 'source-map',
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.scss/, loader: ExtractTextWebpackPlugin.extract('style','css!sass')},
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: './example/index.html',
inject: 'body'
}),
new ExtractTextWebpackPlugin("styles.css")
]
})
new WebpackDevServer(compiler, { // Start a server
contentBase: "./example",
hot: true
}).listen(8081)