This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
/
webpack.config.prod.js
59 lines (58 loc) · 1.95 KB
/
webpack.config.prod.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
devtool: 'source-map',
entry: {
app: './app/index.jsx',
vendors: ['react', 'react-dom', 'lodash', 'baobab', 'react-router',
'react-select', 'history']
},
output: {
path: path.join(__dirname, 'dist'),
filename: "/static/[name].js"
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
// new webpack.DefinePlugin({
// 'process.env': {
// 'NODE_ENV': JSON.stringify('production')
// }
// }),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new HtmlWebpackPlugin({
template: 'index-prod.html',
inject: true
}),
new ExtractTextPlugin("/static/styles.css"),
],
resolve: {
extensions: ['', '.js', '.jsx'],
// Tell webpack to look for required files in bower and node
modulesDirectories: ['bower_components', 'node_modules']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel?optional[]=runtime&stage=0'],
include: path.join(__dirname, 'app')
},
{
test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=/static/[name]-[hash].[ext]" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=/static/[name]-[hash].[ext]" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=/static/[name]-[hash].[ext]" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=/static/[name]-[hash].[ext]" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=/static/[name]-[hash].[ext]" },
{ test: /\.jpg$/, loader: "file?name=[name]-[hash].[ext]" },
{ test: /\.png$/, loader: "file?name=[name]-[hash].[ext]" },
]
}
};