forked from leejaen/react-lz-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.release.config.js
61 lines (61 loc) · 1.6 KB
/
webpack.release.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
var path = require('path');
var webpack = require('webpack');
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
module.exports = {
resolve: {
root: [
path.resolve('./src/global/components'),
path.resolve('./src/global/supports'),
],
extensions: ['', '.js', '.jsx']
},
entry: [
path.resolve('', 'src/test.jsx')
],
output: {
path: __dirname + '/release',
filename: 'bundle.js',
chunkFilename: '[id].[chunkhash:4].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'],
},
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': JSON.stringify("production") //部署时用
}),
new webpack.optimize.DedupePlugin() //找相等或近似的模块,避免在最终生成的文件中出现重复的模块
]
};