-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
91 lines (89 loc) · 2.28 KB
/
webpack.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
86
87
88
89
90
91
const path = require('path')
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CONFIG = require('./webpack.base')
const { CLIENT_ENTRY, CLIENT_OUTPUT, PUBLIC_PATH } = CONFIG
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: {
main: [
'webpack-hot-middleware/client',
CLIENT_ENTRY
],
vendor: [
'react',
'react-dom',
'react-router',
'react-redux',
'redux'
]
},
output: {
filename: '[name].js',
chunkFilename: '[name].chunk.js',
publicPath: PUBLIC_PATH,
path: CLIENT_OUTPUT
},
module: {
preLoaders: [
{
// set up standard-loader as a preloader
test: /\.js?$/,
loader: 'standard',
exclude: /(node_modules)/
}
],
loaders: [
{
test: /\.js$/,
loader: 'babel',
include: CLIENT_ENTRY
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?localIdentName=sp[name][local]__[hash:base64:5]&modules&importLoaders=1&sourceMap!postcss'),
exclude: /(node_modules)/
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss'),
include: /(node_modules)/
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.(gif|jpe?g|png|ico)$/,
loader: 'url',
query: { limit: 10000, name: '[name].[hash:8].[ext]' },
include: CLIENT_ENTRY
},
{
test: /\.(otf|eot|svg|ttf|woff|woff2).*$/,
loader: 'url',
query: { limit: 10000, name: '[name].[hash:8].[ext]' },
include: CLIENT_ENTRY
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js'
}),
new ExtractTextPlugin('styles.css'),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'__DEV__': true
})
],
postcss: () => [ autoprefixer ],
standard: {
// config options to be passed through to standard e.g.
parser: 'babel-eslint'
}
}