-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbabel.esm.config.cjs
44 lines (41 loc) · 1.19 KB
/
babel.esm.config.cjs
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
let fs = require("fs");
let tsconf = eval("(()=>(" + fs.readFileSync("tsconfig.json", "utf-8") + "))()");
let aliases = {};
for (let k in tsconf.compilerOptions.paths) {
let v = tsconf.compilerOptions.paths[k];
aliases[k] = `./${v[0]}`; // /index.mjs`;
}
let DEV_SETTINGS = {};
try {
DEV_SETTINGS = require("./DEV_SETTINGS.cjs");
} catch (e) {
// console.trace(`DEV_SETTINGS not loaded`, e.stack);
}
const { DEV_BYPASS_AUTH } = DEV_SETTINGS;
module.exports = {
presets: ["@babel/preset-typescript","@babel/preset-react"],
plugins: [
[
"inline-replace-variables",
{
DEV_BYPASS_AUTH: DEV_BYPASS_AUTH,
},
],
"@babel/transform-typescript",
[
"@babel/plugin-proposal-decorators",
{ legacy: true },
],
"@babel/proposal-optional-chaining",
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
[
"module-resolver",
{
root: ["./"],
alias: aliases,
},
],
// DON'T ADD @babel/transform-modules-commonjs here! It's added in babel.cjs.config.cjs!
],
};