forked from data-driven-forms/react-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabel.config.js
More file actions
25 lines (24 loc) · 777 Bytes
/
babel.config.js
File metadata and controls
25 lines (24 loc) · 777 Bytes
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
const camelToSnake = (string) => {
return string
.replace(/[\w]([A-Z])/g, function(m) {
return m[0] + '-' + m[1];
})
.toLowerCase();
};
module.exports = {
presets: ["@babel/preset-env", "@babel/preset-react", ["@babel/preset-typescript", {allowNamespaces: true}]],
plugins: [
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties",
[
'transform-imports',
{
'@data-driven-forms/react-form-renderer': {
transform: (importName) => `@data-driven-forms/react-form-renderer/${camelToSnake(importName)}`,
preventFullImport: true
}
},
'@data-driven-forms/react-form-renderer'
]]
}