-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathwebpack.config.js
75 lines (70 loc) · 1.83 KB
/
webpack.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const plugins = [];
const entry = path.join(__dirname, './Sources/index.js');
const sourcePath = path.join(__dirname, './Sources');
const outputPath = path.join(__dirname, './Distribution');
const linterRules = require('./Utilities/rules/linter.js');
const glanceRules = require('./Utilities/rules/glance.js');
const vtkRules = require('./Utilities/rules/vtkjs.js');
const pvwRules = require('./Utilities/rules/paraviewweb.js');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// plugins.push(new BundleAnalyzerPlugin());
module.exports = (env) => {
if (env && env.release) {
plugins.push(
new UglifyJSPlugin({
uglifyOptions: {
beautify: false,
ecma: 6,
compress: true,
comments: false,
},
})
);
plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
})
);
}
return {
plugins,
entry,
output: {
path: outputPath,
filename: 'glance.js',
libraryTarget: 'umd',
},
module: {
rules: [{ test: entry, loader: 'expose-loader?Glance' }].concat(
linterRules,
glanceRules,
vtkRules,
pvwRules
),
},
resolve: {
modules: [path.resolve(__dirname, 'node_modules'), sourcePath],
alias: {
'pv-explorer': __dirname,
PVWStyle: path.resolve('./node_modules/paraviewweb/style'),
},
},
devServer: {
contentBase: outputPath,
port: 9999,
host: '0.0.0.0',
disableHostCheck: true,
hot: false,
quiet: false,
noInfo: false,
stats: {
colors: true,
},
},
};
};