gaearon / gaearon/react-hot-loader

Can react-hot-loader work with not tsx/jsx files, but with dist/*.js which is a result of tsc compilation?

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

Description

Hi. Can react-hot-loader work with tsc - TypeScript Compiler - output (dist/*.js) generated from *.tsx source code? Such output is full of `React.createElement(..., React.createElement(...))` which e.g. looks like:

![image](https://user-images.githubusercontent.com/46383452/81470256-b8d44200-919e-11ea-951d-81f772ddb27b.png)

I.e., does the module process pure-JS react code (like above) with babel, or it relies on `<>` jsx syntax?

Background: we have a TypeScript monorepo with many projects. For various reasons (generally, modules reusability and watch-build performance) we let tsc compile everything from src/ to dist/ in each sub-project, and then we use webpack in some of projects to bundle this tsc output in dist/*.js as an input for bundles. In this configuration, webpack is totally unaware of TypeScript, it thinks that the project is pure-JS (and VSCode is totally unaware of webpack and thinks it's a pure TypeScript project BTW).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.