-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
52 lines (50 loc) · 1.51 KB
/
webpack.config.prod.js
File metadata and controls
52 lines (50 loc) · 1.51 KB
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
var webpack = require("webpack");
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var TransferWebpackPlugin = require('transfer-webpack-plugin');
module.exports = {
// 页面入口文件配置
entry: {},
// 入口文件输出配置
output: {
path: './.tmp/public/',
publicPath: '/',
filename: 'js/[name].js'
},
module: {
// 加载器配置
loaders: [
{test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader')},
{test: /\.less$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!less-loader')},
{test: /\.js[x]?$/, loader: 'babel?compact=false'}
]
},
// 其他解决方案配置
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.json'],
},
// 插件项
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
React: 'react',
EventProxy: 'eventproxy',
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
mangle: {
except: ['$super', '$', 'jQuery', 'exports', 'require', "EventProxy"]
}
}),
new ExtractTextPlugin("/styles/[name].css", {
allChunks: false
}),
new TransferWebpackPlugin([
{from: 'images', to: 'images'}
], path.join(__dirname, 'assets')
)
]
}