Follow the steps below to use babel
together with ts-loader
so that you can
use emotion
(or any other Babel plugin) in your React and TypeScript project.
1. Use create-react-app-typescript
$ create-react-app my-app --scripts-version=react-scripts-ts
$ yarn add emotion react-app-rewired babel-loader babel-preset-env
"scripts": {
"start": "react-app-rewired start --scripts-version react-scripts-ts",
"build": "react-app-rewired build --scripts-version react-scripts-ts",
"test": "react-app-rewired test --scripts-version react-scripts-ts --env=jsdom",
"eject": "react-app-rewired eject --scripts-version react-scripts-ts"
}
The babel config probably needs some further changes for production use