-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
executable file
·50 lines (48 loc) · 1.16 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const SRC_DIR = path.join(__dirname, '/src');
const DIST_DIR = path.join(__dirname, '/public');
module.exports = {
devtool: 'inline-source-map',
entry: [
'babel-polyfill',
'react-hot-loader/patch',
'./src/index.js',
],
output: {
path: DIST_DIR,
publicPath: '/',
filename: 'js/bundle.js',
},
module: {
rules: [{
exclude: /node_modules/,
test: /\.(jsx|js)?$/,
loaders: ['babel-loader'],
include: SRC_DIR,
},
{
test: /\.(sass|scss)$/,
loader: ExtractTextPlugin.extract(['css-loader', 'sass-loader']),
},
{ test: /\.(jpe?g|png|gif|svg)$/i, loader: 'file-loader?name=[name].[ext]' },
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin({
filename: 'css/style.css',
allChunks: true,
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
devServer: {
inline: true,
contentBase: DIST_DIR,
hot: true,
historyApiFallback: true,
},
};