-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.config.js
62 lines (60 loc) · 1.7 KB
/
webpack.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
/**
* Created by xiangxn on 2016/12/11.
*/
let path = require('path');
let webpack = require('webpack');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
var git = require("git-rev-sync");
var root_dir = path.resolve(__dirname);
module.exports = {
entry: ['webpack/hot/dev-server', path.resolve(root_dir, './app/main.js')],
output: {
path: path.resolve(root_dir, 'build/assets'),
filename: 'bundle.js',
publicPath: '/assets/'
},
devServer: {
host: "0.0.0.0",
port: 8080,
hot: true
},
module: {
loaders: [
{
test: /\.js|jsx$/,
exclude: [/node_modules/],
loaders: ['babel?presets[]=es2015,presets[]=react,presets[]=stage-0']
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss!sass')
},
{
test: /\.(png|jpg|jpeg|gif|woff|otf)$/, loader: 'url?limit=8192'
},
{
test: /\.json$/, loader: 'json',
exclude: [
path.resolve(root_dir, "common")
]
}]
},
postcss: [
require('autoprefixer')
],
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
},
APP_VERSION: JSON.stringify(git.tag()),
__BASE_URL__: JSON.stringify("assets"),
__HASHHISTORY__: true
}),
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('style.css', {allChunks: true})
],
node: {
fs: "empty"
}
};