This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.production.js
85 lines (82 loc) · 2.02 KB
/
webpack.config.production.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
77
78
79
80
81
82
83
84
85
var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var webpackIsomorphicToolsConfig = require('./webpack-isomorphic-tools.config')
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin')
var webpackIsomorphicToolsPluginInstance = new WebpackIsomorphicToolsPlugin(webpackIsomorphicToolsConfig)
var postcssImport = require('postcss-import')
var postcssNext = require('postcss-cssnext')
module.exports = {
context: path.join(__dirname, '/src/shared'),
entry: {
vendors: [
'axios',
'babel-polyfill',
'react',
'react-dom',
'react-helmet',
'react-redux',
'react-router',
'redux'
],
app: ['../client']
},
output: {
path: path.join(__dirname, '/dist'),
filename: '[name].bundle.js',
publicPath: '/dist/'
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'file?name=[name].[ext]'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?modules&localIdentName=[hash:base64:5]&importLoaders=1!postcss-loader'
)
},
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
include: path.join(__dirname, '/src')
}
]
},
resolve: {
modulesDirectories: ['node_modules', 'shared'],
extensions: ['', '.js', '.jsx']
},
postcss: [
postcssImport({
path: ['./']
}),
postcssNext
],
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendors',
filename: 'vendors.bundle.js'
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
warnings: false,
screw_ie8: true
}
}),
new ExtractTextPlugin('[name]-[chunkhash].css', {
allChunks: true
}),
webpackIsomorphicToolsPluginInstance
]
}