-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.config.dev.js
85 lines (83 loc) · 2.12 KB
/
webpack.config.dev.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const { execSync } = require('child_process');
const __gitSHA__ = execSync('git rev-parse --short HEAD').toString();
module.exports = {
entry: {
main: [
'./app/js/app.jsx',
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:5000',
],
vendor: [
'redux',
'react-redux',
'react-router',
'react-router-dom',
'react',
'react-dom',
],
},
output: {
path: __dirname,
filename: '[name].bundle.js',
publicPath: '/',
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
path.resolve('./app'),
path.resolve('./app/js'),
'node_modules',
],
},
devtool: 'source-map',
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
API_ROOT: JSON.stringify(process.env.API_ROOT || '/api/v2/'),
'__gitSHA__': JSON.stringify(__gitSHA__),
},
}),
new HtmlWebpackPlugin({
title: 'Society of Software Engineers',
template: './app/index.ejs',
urlRoot: process.env.URL_ROOT || 'localhost:5000',
}),
],
module: {
rules: [
{
test: /\.jsx?$/,
loaders: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.md$/,
loaders: ['html-loader', 'markdown-loader'],
},
{
test: /\.s?css$/,
loaders: ['style-loader', 'css-loader', 'resolve-url-loader', 'sass-loader'],
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff',
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
},
{
test: /\.(gif|png|jpg|jpeg)(\?[a-z0-9]+)?$/,
loader: 'url-loader?limit=8192',
},
],
},
};