debian-image-builder-frontend/babel.config.js
lucasgarfield c33cc6ef70 Typescript: Add initial Typescript setup
This commit adds the initial setup for using Typescript in our project.
The tsconfig.json is very minimal at this point, we will introduce
stricter rules as our Typescript migration progresses.
2023-06-20 07:25:02 +02:00

32 lines
1.1 KiB
JavaScript

// copied from https://github.com/RedHatInsights/frontend-starter-app/blob/master/babel.config.js
module.exports = {
presets: [
// Polyfills
'@babel/env',
'@babel/react',
'@babel/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',
],
],
};