-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (49 loc) · 1.26 KB
/
webpack.config.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var webpack = require('webpack');
var path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var BUILD_DIR = path.resolve(__dirname, 'assets');
var APP_DIR = path.resolve(__dirname, 'src/js');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
APP_DIR + '/index.js'
],
output: {
path: BUILD_DIR,
publicPath: '/',
filename: 'lunchify.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.HotModuleReplacementPlugin(), //<-- to generate hot update chunk
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
],
module: {
loaders: [
{
test: /\.js?$/,
loaders: ['babel'],
exclude: /node_modules/
},
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
include: path.join(__dirname, '..', '..', 'src')
},
{
test: /\.scss$/,
loader: ["style", "css", "sass"]
}]
},
devServer: {
hot: true, // <-- enable HMR in webpack dev server and lib running in the browser
contentBase: './'
}
};