This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.prod.js
70 lines (68 loc) · 1.77 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
60
61
62
63
64
65
66
67
68
69
70
const webpackBaseConfig = require('./webpack.config.base')
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const Clean = require('clean-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const loaders = webpackBaseConfig.module.loaders
const pages = require('./pages')
const htmls = pages(true).map((page) => {
return new HtmlWebpackPlugin(page)
})
module.exports = Object.assign(webpackBaseConfig, {
entry: {
app: ['babel-polyfill', './index']
},
output: {
path: path.join(__dirname, 'dist_tmp'),
filename: 'app.js',
publicPath: '/'
},
plugins: [
new webpack.DefinePlugin({'process.env.NODE_ENV': '"production"'}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin( { sourceMap: false, compressor: { warnings: false } } ),
new ExtractTextPlugin("index.css"),
new CopyWebpackPlugin([
{
from: 'assets/',
to: './assets'
},
{
from: 'logo/',
to: './logo'
},
{
from: 'robots.txt',
to: './'
},
{
from: 'sitemap.xml',
to: './'
},
{
from: 'googlea2b9850d0473629c.html',
to: './'
},
{
from: 'BingSiteAuth.xml',
to: './'
}
]),
new Clean(['dist_tmp'])
].concat(htmls),
module: {
loaders: loaders.concat([{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css!postcss'),
include: __dirname
}])
}
})