forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
52 lines (49 loc) · 1.4 KB
/
vue.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
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv))
.parserConfiguration({'camel-case-expansion': false})
.boolean([
'allowExternalAccess',
'displayGeoTiffByDefault',
'redirectLegacyUrls',
'showThumbnailsAsAssets',
'stacLint',
'useTileLayerAsFallback'
])
.number([
'itemsPerPage',
'maxPreviewsOnMap'
])
.argv;
// Clean-up arguments
delete argv._;
delete argv.$0;
const pkgFile = require('./package.json');
const path = require('path');
const configFile = path.resolve(argv.CONFIG ? argv.CONFIG : './config.js');
const configFromFile = require(configFile);
const mergedConfig = Object.assign(configFromFile, argv);
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production',
publicPath: mergedConfig.pathPrefix,
chainWebpack: webpackConfig => {
webpackConfig.plugin('define').tap(args => {
args[0].STAC_BROWSER_VERSION = JSON.stringify(pkgFile.version);
args[0].CONFIG_PATH = JSON.stringify(configFile);
args[0].CONFIG_CLI = JSON.stringify(argv);
return args;
});
webpackConfig.plugin('html').tap(args => {
args[0].title = mergedConfig.catalogTitle;
return args;
});
},
configureWebpack: {
plugins: [
new NodePolyfillPlugin({
includeAliases: ['Buffer', 'console', 'http', 'https', 'process', 'url']
})
]
}
};