gaearon / gaearon/react-hot-loader

Sucrase support

Open
#1,008 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
775
PR merge metrics
No merged PRs in 30d

Description

Is there any way how the hot loader could work directly with [sucrase](https://sucrase.io/)? Currently it requires the slow babel step to transpile typescript into es6 (https://github.com/alangpierce/sucrase/issues/228):

```
// Load TypeScript (.ts, .tsx).
{
test: /\.tsx?$/,
use: [
...(isDevServer
? [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: ['react-hot-loader/babel'],
},
},
]
: []),
...(targetES6
? [
{
loader: '@sucrase/webpack-loader',
options: {
transforms: ['imports', 'jsx', 'typescript'],
},
},
]
: [{ loader: 'ts-loader', options: { configFile: paths.tsConfig } }]),
],
},
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the TypeScript loader configuration shown in the issue and compare the babel-loader and @sucrase/webpack-loader paths. Done means the hot loader can work directly with Sucrase for TypeScript without requiring the slow Babel transpilation step.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, react, typescript, webpack
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.