-
Notifications
You must be signed in to change notification settings - Fork 154
/
webpack.config.js
64 lines (64 loc) · 1.59 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
63
64
var path = require('path');
var webpack = require('webpack');
module.exports = {
//entry:path.resolve('','src/main.js'),
resolve: {
root: [
path.resolve('./src/global/components'),
path.resolve('./src/global/supports'),
],
extensions: ['', '.js', '.jsx']
},
entry: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8081',
// path.resolve('', 'src/main.js')//for publish
path.resolve('', 'src/test.jsx')//for text
],
output: {
path: path.resolve('', 'build'),
filename: 'bundle.js'
},
module: {
loaders: [{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
}, {
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react'],
//compact: false
},
loaders: [
'babel?presets[]=react,presets[]=es2015,presets[]=stage-2'
]
}, {
test: /\.(jpg|png)$/,
loader: "url?limit=8192"
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.css$/, // Only .css files
loader: 'style!css' // Run both loaders
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
}),
new webpack.HotModuleReplacementPlugin()
]
};