forked from AKSW/ontodia-graph-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
74 lines (71 loc) · 1.76 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
const path = require('path');
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
// if BUNDLE_PEERS is set, we'll produce bundle with all dependencies
const BUNDLE_PEERS = Boolean(process.env.BUNDLE_PEERS);
// always include IE support in full bundle
const SUPPORT_IE = BUNDLE_PEERS || Boolean(process.env.SUPPORT_IE);
const aliases = {};
if (!SUPPORT_IE) {
const emptyModule = path.resolve(
__dirname,
'src',
'graph-explorer',
'emptyModule.ts'
);
aliases['canvg-fixed'] = emptyModule;
aliases['es6-promise/auto'] = emptyModule;
}
module.exports = {
mode: BUNDLE_PEERS ? 'production' : 'none',
entry: './src/graph-explorer/index.ts',
resolve: {
alias: aliases,
extensions: ['.ts', '.tsx', '.js'],
},
plugins: [
new NodePolyfillPlugin(),
],
module: {
rules: [
{ test: /\.ts$|\.tsx$/, use: ['ts-loader'] },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.(jpe?g|gif|png|svg)$/,
use: [{ loader: 'url-loader' }],
},
{ test: /\.ttl$/, use: ['raw-loader'] },
],
},
output: {
path: path.join(__dirname, 'dist'),
filename: BUNDLE_PEERS
? 'graph-explorer-full.min.js'
: SUPPORT_IE
? 'graph-explorer-ie.js'
: 'graph-explorer.js',
library: 'GraphExplorer',
libraryTarget: 'umd',
},
devtool: 'source-map',
externals: BUNDLE_PEERS
? []
: [
'd3-color',
'file-saverjs',
'lodash',
'n3',
'rdf-ext',
'react',
'react-dom',
'webcola',
'whatwg-fetch',
],
performance: {
maxEntrypointSize: 2048000,
maxAssetSize: 2048000,
},
};