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

JSX does not reload if included as import #178

Closed
RitzyMage opened this issue Apr 5, 2022 · 2 comments
Closed

JSX does not reload if included as import #178

RitzyMage opened this issue Apr 5, 2022 · 2 comments

Comments

@RitzyMage
Copy link

RitzyMage commented Apr 5, 2022

(this may be related to issue #135)

If JSX contains a component using the comp object (e.g.

export default ({comp}) =><div>
  {comp.componentName({
      prop: "value",
  })}
</div>

),
then the hot reloading works just fine. Specifically, Lume outputs

Changes detected:
- /_components/componentName.jsx

🔥 / /index.jsx
Changes sent to the browser

However, if included via an import (e.g.

import ComponentName from "./_components/componentName.jsx";
export default () => <div>
   <ComponentName prop="value" />
</div>

), then the reload does not work for changes in the included component (componentName in this example). In fact, the server must be completely restarted to get these changes. Specifically, Lume outputs

Changes detected:
- /_components/componentName.jsx

but does not output the hot reloading text.

@oscarotero
Copy link
Member

This is a know limitation of Deno, see denoland/deno#8327

ATM, there isn't a good way to implement a hot module reload system for imported modules. But you can use jsx with Lume modules. In your example, you could do this:

export default ({comp}) => <div>
  <comp.componentName prop="value" />
</div>

This is the only way to use jsx modules supporting hot reloading in Lume. And it's even more convenient because you don't need to import the modules, they are automatically available.

@RitzyMage
Copy link
Author

Just tested on v1.7.2 and the <comp.componentName /> syntax does hot reload. Thanks!

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