forked from gajus/react-css-modules-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.browsersync.js
74 lines (70 loc) · 1.77 KB
/
webpack.config.browsersync.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
var webpack,
path,
ExtractTextPlugin,
WriteFilePlugin,
devServer;
webpack = require('webpack');
path = require('path');
ExtractTextPlugin = require('extract-text-webpack-plugin');
WriteFilePlugin = require('write-file-webpack-plugin');
devServer = {
contentBase: path.resolve(__dirname, './endpoint'),
colors: true,
quiet: false,
noInfo: false,
publicPath: '/static/',
historyApiFallback: false,
host: '127.0.0.1',
port: 8000,
hot: true
};
module.exports = {
devtool: 'source-map',
debug: true,
devServer: devServer,
context: path.resolve(__dirname, './src'),
entry: {
app: [
'webpack/hot/dev-server',
'webpack-hot-middleware/client',
'./'
]
},
output: {
path: path.resolve(__dirname, './endpoint/static'),
filename: '[name].js',
publicPath: devServer.publicPath
},
plugins: [
new WriteFilePlugin(),
new ExtractTextPlugin('app.css', {
allChunks: true
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.OldWatchingPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]')
},
{
test: /\.js$/,
include: path.resolve(__dirname, './src'),
loaders: [
'react-hot',
'babel'
]
}
]
},
resolve: {
extensions: [
'',
'.js'
]
}
};