-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
66 lines (62 loc) · 1.47 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
let fs = require('fs');
var webpack = require('webpack')
let polyfills = require('./node_modules/rn-pack/polyfills');
let definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(true),
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
});
let platform = process.env.PLATFORM || 'ios';
let configObj = {
entry:{
main: [
...polyfills,
"./index."+platform+ ".js",
],
},
output: {
//hot loader require js need
publicPath:'http://localhost:8081/',
path: __dirname,
filename: "index."+ platform +".bundle"
},
// devtool: 'eval-source-map',
// devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['rn-pack-hot-loader'],
},
{
test: /\.js$/,
exclude: /(__test__|bower_components)/,
loaders: ['babel-loader'],
},
{
test: /\.(png|gif|svg)$/,
exclude: /node_modules/,
loaders: ['rn-pack-url-loader'],
},
],
},
resolve:{
modules:['node_modules'],
alias: {
HMRClient: 'rn-pack/hotloadClient'
},
extensions: ['.'+ platform +'.js','.native.js','.js']
},
plugins:[
definePlugin,
new webpack.ProgressPlugin(),
new webpack.HotModuleReplacementPlugin()
],
devServer:{
publicPath: 'http://localhost:8081/',
port: 8081,
}
};
module.exports = configObj;