-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
46 lines (39 loc) · 1.13 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
const path = require('path')
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const filenamePrefix = '[hash:8]/'
module.exports = {
entry: {
vendor: [ 'react', 'react-dom' ],
home: path.resolve(__dirname, 'web/home.js')
},
output: {
filename: `${filenamePrefix}[name].js`,
path: path.resolve(__dirname, 'web/public/assets'),
publicPath: '/assets/'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css!postcss') }
]
},
resolve: {
alias: {
'react-native': 'react-native-web'
}
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: `${filenamePrefix}vendor.js`
}),
new ExtractTextPlugin(`${filenamePrefix}styles.css`),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
})
],
postcss: () => [ autoprefixer ]
}