forked from leilihuang/React
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.h5.config.js
61 lines (58 loc) · 1.66 KB
/
webpack.h5.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'),
px2rem = require('postcss-px2rem'),
webpack = require('webpack');
var config = {
cache:true,
devtool: 'eval',
entry: {
index:['webpack/hot/dev-server', path.resolve(__dirname, 'H5/main')]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js'
},
resolve:{
//modulesDirectories: ['node_modules', path.join(__dirname, '../node_modules')],
extensions:['','.web.js','.js','.json','.jsx']
},
plugins:[
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress:{
warnings : false
}
}),
new webpack.DllReferencePlugin({
context:__dirname,
manifest:require('./dist/vendor-manifest.json')
})
],
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel',
exclude:/node_modules/,
query: {
presets: ['react', 'es2015'],
plugins: ["transform-class-properties","transform-runtime",["import",{libraryName:"antd-mobile",style:"css"}]]
},
include:__dirname
}, {
test: /\.less$/,
loader: 'style!css!postcss!less'
},{
test: /\.css$/,
loader: 'style!css!postcss'
}, {
test: /\.scss$/,
loader: 'style!css!postcss!sass'
}, {
test: /\.(jpg|png)$/,
loader: 'url?limit=25000'
}]
},
postcss: function() {
return [px2rem({remUnit: 75})];
}
};
module.exports = config;