-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
executable file
·42 lines (37 loc) · 1.24 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
const moduleResolver = require('babel-plugin-module-resolver');
module.exports = function (api) {
const config = {
"presets": ["module:metro-react-native-babel-preset", "@babel/preset-typescript"],
"plugins": [
["@babel/plugin-proposal-decorators",
{ legacy: true }
],
["module-resolver",
{
"root": ["./src"],
"extensions": [".ios.js", ".android.js", ".js", ".json", ".ts", ".tsx"],
"alias": {
"@component": "./src/component",
"@const": "./src/const",
"@domain": "./src/domain",
"@interface": "./src/interface",
"@image": "./src/image",
"@nav": "./src/nav",
"@screen": "./src/screen",
"@state": "./src/state",
"@styles": "./src/styles"
},
resolvePath(sourcePath, currentFile, opts) {
// if the file is from node_modules don't do any aliasing!!!
if (currentFile.indexOf('node_modules') >= 0) return sourcePath;
return moduleResolver.resolvePath(sourcePath, currentFile, opts);
}
}
]
]
}
if (api.env("production")) {
config.plugins.push("transform-remove-console")
}
return config;
}