Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Strange behavior while importing react #14

Open
thebergamo opened this issue May 26, 2023 · 1 comment
Open

Strange behavior while importing react #14

thebergamo opened this issue May 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@thebergamo
Copy link

I have a different use case, where I build my SSR react entry-server.tsx using Vite (either with noExternals or with externals), then try to dynamically import it into Deno, but what happens is that it while processing the output from esbuild it doesn't find some React part, for instance useState that is being used by some component.

Not sure if esbuild is treeShaking my files the output in this case, but in any case I can't correctly import my module. Any advice?

@thebergamo
Copy link
Author

From my current discoveries, it seems that React is getting imported twice and that might be the reason that is causing this issue.
As my entry-server.tsx exports export a react component I marked it as external inside vite, but while importing it using this module, inside Deno Deploy it seems to be importing it again and bundling it. Is there any way to avoid importing and bundling this?

Locally it is working now, only in Deno Deploy it is having this issue with duplicated React version

@ayoreis ayoreis added the bug Something isn't working label Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants