forked from grimesfive/archeage-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
59 lines (55 loc) · 1.41 KB
/
webpack.production.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
const webpack = require('webpack');
const path = require('path');
const loaders = require('./webpack.loaders');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackCleanupPlugin = require('webpack-cleanup-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const pkg = require('./package.json');
const devConfig = require('./webpack.config.js');
const { join, resolve } = path;
const root = resolve(__dirname);
const src = join(root, 'src');
module.exports = {
entry: [
join(src, 'index'),
],
mode: 'production',
output: {
publicPath: '/',
path: path.join(root, 'public'),
filename: 'bundle.[hash].js',
},
resolve: {
alias: Object.assign({}, devConfig.resolve.alias, {
config: join(src, 'config', 'production.js'),
'react-dom': 'react-dom',
}),
extensions: devConfig.resolve.extensions,
},
module: {
rules: loaders,
},
// Don't show the Size Limit warnings.
performance: {
hints: false,
},
plugins: [
new WebpackCleanupPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
__VERSION__: JSON.stringify(pkg.version),
__DEVELOPMENT__: false,
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new CopyWebpackPlugin({
patterns: [
'static',
],
}),
new HtmlWebpackPlugin({
template: './src/template.html',
}),
],
};