This repository has been archived by the owner on Oct 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
babel.config.js
62 lines (56 loc) · 1.6 KB
/
babel.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
const path = require('path');
const common = require('./config/common');
const packages = require('./package.json');
/**
* Define build options environment variables here
* format: [var name]: default value
* check README for variable names and purpose
*/
const buildEnvVarDefaults = {
PICKER_URL:
'https://static-cdn.kloudless.com/p/platform/file-picker/v2/index.html',
// old version that supports custom_css
PICKER_URL_V1:
'https://static-cdn.kloudless.com/p/platform/explorer/explorer.html',
BASE_URL: 'https://api.kloudless.com',
// for development only
KLOUDLESS_APP_ID: null,
// 'MIT' or 'AGPL'.
// The MIT build excludes the plupload module.
BUILD_LICENSE: 'MIT',
};
const transformDefines = {
VERSION: packages.version,
};
Object.keys(buildEnvVarDefaults).forEach((varName) => {
transformDefines[varName] = (
process.env[varName] || buildEnvVarDefaults[varName]);
});
module.exports = {
presets: [
['@babel/preset-env', {
useBuiltIns: 'usage',
corejs: 3,
}],
// Used by storybook-react
'@babel/preset-react',
],
ignore: common.ignorePaths,
plugins: [
[
'module-resolver', {
// avoid node_modules path being relative path
root: common.resolvePaths.filter(p => p !== 'node_modules'),
alias: {
'picker-config': path.resolve(__dirname, './src/picker/js/',
(process.env.NODE_ENV === 'production'
&& !JSON.parse(process.env.DEBUG || false)) ?
'./config_prod.json' : './config.json'),
},
},
],
[
'transform-define', transformDefines,
],
],
};