forked from RedHatInsights/frontend-starter-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
32 lines (32 loc) · 945 Bytes
/
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
module.exports = {
presets: [
// Polyfills
'@babel/env',
// Allow JSX syntax
'@babel/react',
'@babel/preset-typescript',
],
plugins: [
// Put _extends helpers in their own file
'@babel/plugin-transform-runtime',
// Support for {...props} via Object.assign({}, props)
'@babel/plugin-proposal-object-rest-spread',
// Devs tend to write `import { someIcon } from '@patternfly/react-icons';`
// This transforms the import to be specific which prevents having to parse 2k+ icons
// Also prevents potential bundle size blowups with CJS
[
'transform-imports',
{
'@patternfly/react-icons': {
transform: (importName) =>
`@patternfly/react-icons/dist/js/icons/${importName
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase()}`,
preventFullImport: true,
},
},
'react-icons',
],
],
};