-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathshared-webpack-configuration.js
More file actions
55 lines (48 loc) · 2.2 KB
/
shared-webpack-configuration.js
File metadata and controls
55 lines (48 loc) · 2.2 KB
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
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
const KeplerPackage = require('../package.json');
const {join, resolve} = require('path');
const LIB_DIR = resolve(__dirname, '..');
const SRC_DIR = resolve(LIB_DIR, './src');
const NODE_MODULES_DIR = resolve(__dirname, '../node_modules');
const resolveAlias = {
react: `${NODE_MODULES_DIR}/react`,
'react-dom': `${NODE_MODULES_DIR}/react-dom`,
'react-redux': `${NODE_MODULES_DIR}/react-redux/lib`,
'styled-components': `${NODE_MODULES_DIR}/styled-components`,
'react-intl': `${NODE_MODULES_DIR}/react-intl`,
'react-palm': `${NODE_MODULES_DIR}/react-palm`,
// Suppress useless warnings from react-date-picker's dep
'tiny-warning': `${SRC_DIR}/utils/src/noop.ts`,
// kepler.gl and loaders.gl need to use same apache-arrow
'apache-arrow': `${NODE_MODULES_DIR}/apache-arrow`
};
// add kepler.gl submodule aliases
const workspaces = KeplerPackage.workspaces;
workspaces.forEach(workspace => {
// workspace = "./src/types", "./src/constants", etc
const moduleName = workspace.split('/').pop();
resolveAlias[`@kepler.gl/${moduleName}`] = join(SRC_DIR, `${moduleName}/src`);
});
const ENV_VARIABLES_WITH_INSTRUCTIONS = {
MapboxAccessToken: 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/',
DropboxClientId: 'You can get the token at https://www.dropbox.com/developers',
CartoClientId: 'You can get the token at https://carto.com/help/working-with-data/carto-platform-api-keys',
MapboxExportToken: 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/',
FoursquareClientId: 'You can get the token at https://location.foursquare.com/developer',
FoursquareDomain: 'You can get the token at https://location.foursquare.com/developer',
FoursquareAPIURL: 'You can get the token at https://location.foursquare.com/developer',
FoursquareUserMapsURL: 'You can get the token at https://location.foursquare.com/developer'
};
const WEBPACK_ENV_VARIABLES = Object.keys(ENV_VARIABLES_WITH_INSTRUCTIONS).reduce(
(acc, key) => ({
...acc,
[key]: null
}),
{}
);
module.exports = {
ENV_VARIABLES_WITH_INSTRUCTIONS,
WEBPACK_ENV_VARIABLES,
RESOLVE_ALIASES: resolveAlias
};