Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dko-slapdash opened this issue May 9, 2020 · 1 comment

Comments

@dko-slapdash
Copy link

dko-slapdash commented May 9, 2020

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

@theKashey
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants