-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (76 loc) · 2.5 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
65
66
67
68
69
70
71
72
73
74
75
76
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
var glob=require("glob");
var comps = glob.sync('./src/component/lar-*/*.js');
var lib = glob.sync('./src/lib/*.js');
var libFiles = glob.sync('./src/lib/**/**');
var tool = require('./configTool');
module.exports = {
context: path.join(__dirname)+'/src',
entry: tool.deal(comps,lib,libFiles),
/*devtool: debug ? "inline-sourcemap" : null,*/
module: {
loaders: [
{
test: /\.js?$/,
include:[path.resolve(__dirname, "component")],
loader: 'babel-loader',
/* query: {
presets: ['react', 'es2015'],
plugins: ['react-html-attrs'], //添加组件的插件配置
}*/
},
//下面是使用 ant-design 的配置文件
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{
test: /\.(jpg?g|png|gif|svg)$/i,
loader: "url-loader?limit=1024&name=./artTypeImgTest.[hash].[ext]"
},
{
test: /\.(png|jpg|gif)$/,
use: ['file-loader']
}
//使用pug-html-loader
/* {
test:/\.pug$/,
exclude: ['/node_modules/'],
loader: 'pug-html-loader',
query: {
data: {name:'test'},
pretty: true
}
},*/
/*{
test:require.resolve('./../jquery'),
loader:'expose-loader?$!expose-loader?jQuery'
},*/
]
},
output: {
path:path.resolve(__dirname, 'dist/V0.1'),
filename:"[name].min.js",
chunkFilename: "[name].bundle.js"
},
externals: {
jquery: 'window.$'
},
plugins: [
//new webpack.optimize.DedupePlugin(),
//new webpack.optimize.OccurenceOrderPlugin(),
//new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
//new CommonsChunkPlugin({names:['vendor','vendor.js']}),
/* new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
'window.$':'jquery',
'window.jQuery':'jquery'
}),*/
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
};