-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
63 lines (61 loc) · 1.56 KB
/
webpack.dev.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
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin
module.exports = {
context: path.resolve(__dirname, 'client'),
entry: {
index: [path.resolve(__dirname, 'client/index.js')],
vendor: ['react', 'react-dom', 'prop-types'],
},
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name].js',
},
resolve: {
modules: [path.resolve(__dirname, 'client'), 'node_modules'],
extensions: ['.js', '.jsx', '.json'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(jpe?g|png|gif)$/i,
loader: 'url-loader',
options: {
limit: 1000,
name: 'assets/imgs/[name].[ext]',
},
},
{
test: /\.(woff2?|eot|ttf|otf|svg)$/i,
loader: 'url-loader',
options: {
limit: 10000,
name: 'assets/fonts/[name].[ext]',
},
},
],
},
plugins: [
new CommonsChunkPlugin({
names: ['vendor', 'manifest'],
filename: '[name].js',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'client/index.html'),
filename: 'index.html',
inject: 'body',
chunks: ['manifest', 'vendor', 'index'],
}),
],
}