Closed Julien-Hery closed 2 years ago
Looking at @babel/preset-react docs, the Babel Node API can be used to transform the actual code into a usable one with something like :
require("@babel/core").transformSync("<code>", {
presets: ["@babel/preset-react"],
})
I tried using it and it works, I can import icons generated by babel. I'll make a PR
🐞 Pattern bug report
Where did you experience this bug ?
Is this a regression?
I don't know
Description
React icons can't be imported in standard React application created with create-react-app
🔬 Steps to reproduce the issue
npx create-react-app cra-mozaic --template typescript
npm install @mozaic-ds/icons
import {FullScreen48} from '@mozaic-ds/icons/react'
🔥 Exception or Error
🌍 Your Environment
Styleguide Version:
Anything else relevant? React projects should be able to import icons without any specific Babel plugin enabling "experimental" syntax