forked from GeoTIFF/geotiff.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
72 lines (68 loc) · 3.27 KB
/
webpack.prod.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
const webpack = require('webpack');
const merge = require('webpack-merge');
const path = require('path');
const shared = require('./webpack.shared');
const OfflinePlugin = require('offline-plugin');
const CnameWebpackPlugin = require('cname-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
const SITE_CONFIG = require(process.env.GEOTIFF_IO_CONFIG || './config.json');
const prod = {
mode: 'production',
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'docs'),
publicPath: '/'
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
plugins: [
new OfflinePlugin({
externals: [
'https://unpkg.com/[email protected]/dist/leaflet.css',
'https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.css',
'https://fonts.googleapis.com/css?family=Lalezar|Open+Sans:400,600,700',
'https://d3js.org/d3.v4.min.js',
'https://unpkg.com/[email protected]/dist/leaflet.js',
'https://unpkg.com/[email protected]/dist/geotiff.browserify.min.js',
'https://unpkg.com/[email protected]/leaflet-providers.js',
'https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/dist/leaflet.canvaslayer.field.js',
'https://fonts.googleapis.com/icon?family=Material+Icons',
'https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.0/chroma.min.js',
'https://unpkg.com/[email protected]/dist/style.css',
'https://unpkg.com/[email protected]/assets/css/leaflet.css',
'https://unpkg.com/[email protected]/dist/sweetalert.min.js',
'https://unpkg.com/[email protected]/dist/sweetalert.css',
'https://fonts.gstatic.com/s/lalezar/v4/zrfl0HLVx-HwTP82Yaf4Iw.woff2',
'https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2',
'https://fonts.gstatic.com/s/opensans/v15/mem8YaGs126MiZpBA-UFVZ0b.woff2',
'https://fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UN7rgOUuhp.woff2',
'https://fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UNirkOUuhp.woff2',
'https://unpkg.com/[email protected]/dist/images/marker-icon.png',
'https://unpkg.com/[email protected]/dist/images/marker-shadow.png',
'https://unpkg.com/[email protected]/dist/images/marker-icon.png',
'https://a.tile.openstreetmap.org/2/0/0.png',
'https://b.tile.openstreetmap.org/2/0/1.png',
'https://c.tile.openstreetmap.org/2/0/2.png',
'https://a.tile.openstreetmap.org/2/0/3.png',
'https://b.tile.openstreetmap.org/2/1/0.png',
'https://c.tile.openstreetmap.org/2/1/1.png',
'https://a.tile.openstreetmap.org/2/1/2.png',
'https://b.tile.openstreetmap.org/2/1/3.png',
'https://c.tile.openstreetmap.org/2/2/0.png',
'https://a.tile.openstreetmap.org/2/2/1.png',
'https://b.tile.openstreetmap.org/2/2/2.png',
'https://c.tile.openstreetmap.org/2/2/3.png',
'https://a.tile.openstreetmap.org/2/3/0.png',
'https://b.tile.openstreetmap.org/2/3/1.png',
'https://c.tile.openstreetmap.org/2/3/2.png',
'https://a.tile.openstreetmap.org/2/3/3.png'
]
})
]
};
if (SITE_CONFIG.domain) {
prod.plugins.push(new CnameWebpackPlugin({ domain: SITE_CONFIG.domain }));
}
module.exports = merge(shared, prod);