forked from edtr-io/edtr-io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabel.config.js
More file actions
41 lines (41 loc) · 1.22 KB
/
Copy pathbabel.config.js
File metadata and controls
41 lines (41 loc) · 1.22 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
/* eslint-disable import/no-commonjs */
module.exports = function(api) {
return {
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript'
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
...(api.env(['development', 'test'])
? [
[
'babel-plugin-module-resolver',
{
alias: {
'^@edtr-io/([^/]+)(.*)$': ([_, packageName, filePath]) => {
const base = `@edtr-io/${packageName}`
if (filePath.startsWith('/__fixtures__')) {
return `${base}${filePath}`
}
if (
filePath.startsWith('/beta') ||
filePath.startsWith('/internal')
) {
return `${base}/src${filePath
.replace('/beta', '')
.replace('/internal', '')}`
}
return `${base}/src${filePath}`
}
},
loglevel: 'silent'
}
]
]
: [])
]
}
}