-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwebpack.hot.js
63 lines (60 loc) · 1.66 KB
/
webpack.hot.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 webpack = require('webpack');
const path = require('path');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
const simpleVars = require('postcss-simple-vars');
const postcssMixins = require('postcss-mixins');
const postcssBEM = require('postcss-bem')({style: 'bem'});
const postcssNested = require('postcss-nested');
const colorFunctions = require('postcss-color-function');
const postcssImport = require('postcss-import');
const customMedia = require('postcss-custom-media');
const BUILD_DIR = path.resolve(__dirname, 'public');
const APP_DIR = path.resolve(__dirname, 'src');
const config = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000',
'webpack/hot/only-dev-server',
APP_DIR + '/index.js'
],
output: {
path: BUILD_DIR,
publicPath: '/public/',
filename: 'bundle.js'
},
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
exclude: /node_modules/,
loaders: ['react-hot', 'babel'],
plugins: [
'transform-runtime',
'add-module-exports',
'transform-decorators-legacy',
]
},
{ test: /\.css$/, loader: "style-loader!css-loader!postcss-loader" },
{ test: /\.json$/, loaders: ['json-loader'] }
]
},
postcss: function(webpack) {
return [
postcssImport({addDependencyTo: webpack}),
precss,
autoprefixer,
postcssMixins,
simpleVars,
colorFunctions,
postcssBEM,
postcssNested,
customMedia
];
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};
module.exports = config;