-
Notifications
You must be signed in to change notification settings - Fork 20
/
webpack.prod.dev.js
134 lines (127 loc) · 4.33 KB
/
webpack.prod.dev.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
// Commenting out ExportNodeModules plugin because it crashes with Babel7
// const ExportNodeModules = require('webpack-node-modules-list');
module.exports = merge(common, {
// development mode config start
// mode: 'development',
// devtool: 'eval-source-map',
// cache: true,
// performance: {
// hints: false
// },
// output: {
// pathinfo: true
// },
// optimization: {
// moduleIds: 'named',
// chunkIds: 'named',
// nodeEnv: 'development',
// flagIncludedChunks: false,
// occurrenceOrder: false,
// concatenateModules: false,
// splitChunks: {
// hidePathInfo: false,
// minSize: 10000,
// maxAsyncRequests: Infinity,
// maxInitialRequests: Infinity,
// },
// emitOnErrors: 'true',
// checkWasmTypes: false,
// minimize: false,
// removeAvailableModules: false,
// },
// plugins: [
// new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("development") }),
// ],
// development mode config end
// production mode config start
mode: 'production',
devtool: 'source-map',
// performance: {
// hints: 'warning'
// },
// output: {
// pathinfo: false
// },
// optimization: {
// moduleIds: 'named',
// chunkIds: 'named',
// nodeEnv: 'production',
// flagIncludedChunks: true,
// chunkIds: 'total-size',
// moduleIds: 'size',
// concatenateModules: true,
// splitChunks: {
// hidePathInfo: true,
// minSize: 30000,
// maxAsyncRequests: 5,
// maxInitialRequests: 3,
// },
// emitOnErrors: 'false',
// checkWasmTypes: true,
// minimize: true,
// },
// plugins: [
// new TerserPlugin(/* ... */),
// new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("production") }),
// new webpack.optimize.ModuleConcatenationPlugin(),
// new webpack.NoEmitOnErrorsPlugin()
// ]
// production mode config end
// Original config start
// mode: 'production',
// devtool: 'source-map',
plugins: [
// // Don't need to add UglifyJSPlugin here because production mode automatically does that
// // new UglifyJSPlugin({
// // sourceMap: true
// // }),
// Deletes the web-server/dist folder so that old files don't remain there, only fresh ones from the last run.
new CleanWebpackPlugin(),
// new webpack.DefinePlugin({
// 'process.env.NODE_ENV': JSON.stringify('development')
// }),
],
// Original config end
devServer: {
// Only compiles on refresh, not on file change. But does not work, complains of running webpack twice.
// lazy: true,
// Disable live reloading. Useful when trying to run two branches side by side.
// inline: false,
// Where non-webpack generated files are located on the filesystem.
// contentBase: [path.join(__dirname, 'web-server/plugins/slycat-project-wizards'), path.join(__dirname, 'web-server/plugins/slycat-model-wizards')],
// Public URL of served files. Commended out because we want them available at the root URL.
publicPath: '/',
// compress: true,
host: '0.0.0.0',
port: 9000,
https: true,
index: 'slycat_projects.html',
proxy: {
'/api': {
target: 'https://haproxy:443',
pathRewrite: {'^/api' : ''},
secure: false,
},
},
historyApiFallback: {
rewrites: [
// { from: /^\/$/, to: '/views/landing.html' },
// { from: /^\/subpage/, to: '/views/subpage.html' },
// If the URL begins with projects/ (note the trailing slash), serve up the single project page
{ from: /^\/projects\//, to: '/slycat_project.html' },
// If the URL begins with projects (note no trailing slash), serve up the listing of all projects.
// This is for backwards compatibility, since we used to redirect unknown URLs to /projects to give the user
// a projects listing.
{ from: /^\/projects/, to: '/slycat_projects.html' },
{ from: /^\/models/, to: '/slycat_model.html' },
{ from: /^\/login/, to: '/slycat_login.html' },
{ from: /^\/pages/, to: '/slycat_page.html' },
// { from: /./, to: '/views/404.html' },
]
}
}
});