forked from metaphacts/ontodia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
61 lines (58 loc) · 1.69 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
const path = require('path');
// 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', 'emptyModule.ts');
aliases['canvg-fixed'] = emptyModule;
aliases['es6-promise/auto'] = emptyModule;
}
module.exports = {
mode: BUNDLE_PEERS ? 'production' : 'none',
entry: './src/index.ts',
resolve: {
alias: aliases,
extensions: ['.ts', '.tsx', '.js'],
},
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 ? 'ontodia-full.min.js' :
SUPPORT_IE ? 'ontodia-ie.js' :
'ontodia.js'
),
library: 'Ontodia',
libraryTarget: 'umd',
},
devtool: 'source-map',
externals: BUNDLE_PEERS ? [] : [
'd3-color',
'file-saverjs',
'intro.js',
'lodash',
'n3',
'rdf-ext',
'react',
'react-dom',
'webcola',
'whatwg-fetch',
],
performance: {
maxEntrypointSize: 2048000,
maxAssetSize: 2048000,
},
};