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?

dko-slapdash opened this issue · 1 comments

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

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).

React-Hot-Loader is working on the variables, not JSX. So should would fine.
However, I would not be so sure about classes - they might be instrumented improperly.

For dev mode please use as modern target, as possible.