-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.babel.js
98 lines (92 loc) · 2.41 KB
/
webpack.config.dev.babel.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
92
93
94
95
96
97
98
import path from 'path'
import autoprefixer from 'autoprefixer'
import config from 'config'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import webpack from 'webpack'
export default {
devtool: 'eval',
entry: [
'react-hot-loader/patch',
`webpack-hot-middleware/client?path=http://${config.wds.host}:${config.wds.port}/__webpack_hmr&timeout=20000`,
path.join(__dirname, 'src/shared/nt-styles/base.styl'),
path.join(__dirname, 'src/client/client.dev.js'),
],
output: {
path: path.join(__dirname, 'static', 'build'),
publicPath: `http://${config.wds.host}:${config.wds.port}/build/`,
filename: '[name].js',
chunkFilename: '[name].chunk.js',
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src'),
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
[ 'es2015', { modules: false } ],
'react',
'stage-2',
],
plugins: [
'react-hot-loader/babel'
],
cacheDirectory: true
}
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader'
},
{
test: /\.styl$/,
include: path.resolve(__dirname, 'src'),
use: [
'style-loader',
{
loader: 'css-loader',
options: {
module: true,
sourceMap: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
'postcss-loader',
{
loader: 'stylus-loader',
options: {
sourceMap: true,
includePaths: [ path.join(__dirname, 'src/shared/styles') ]
}
},
],
}
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
BROWSER: JSON.stringify(true),
},
}),
new ExtractTextPlugin({
filename: '[name]-[contenthash].css',
allChunks: true,
}),
new webpack.LoaderOptionsPlugin({
test: /\.styl$/,
options: {
context: __dirname,
postcss: [
autoprefixer({ browsers: [ '> 5%', 'IE > 10', 'last 2 versions' ] })
]
}
})
],
}