Aliasing React to Preact in Deno #4252
Replies: 9 comments 1 reply
-
That sounds more like a sandpack issue. My guess is that it doesn't know about |
Beta Was this translation helpful? Give feedback.
-
Maybe. So you're saying that:
in |
Beta Was this translation helpful? Give feedback.
-
With the
|
Beta Was this translation helpful? Give feedback.
-
@rschristian Gotcha, thanks for clarifying. |
Beta Was this translation helpful? Give feedback.
-
@marvinhagemeister @rschristian I think we can close this out. This addressed my question. I'll go ahead and close it but if you want to re-open it, please feel free to of course. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Actually, sorry, I think I moved to close this too soon. Neither:
nor
in In this repo I was able to get Sandpack working with Preact + Vite. That makes me think that Sandpack does in fact work in a Preact app that successfully aliases React to Preact, and that the issue I am having in my Deno app is regarding the above approaches not successfully aliasing React to Preact. To see if this issue is specific to Sandpack or my repo, I tried testing a different library that depends on React (React Bootstrap) in a new Fresh project (repo). I was able to reproduce the issue. routes/index.tsx
deno.json
And I get this error when I run
And this (without the
doesn't work either. So then, it seems that the question of how to alias React to Preact in a Deno project is still an open one. |
Beta Was this translation helpful? Give feedback.
-
This is more of a Deno issue rather than an issue with Preact. At the moment there is no support for deduplicating npm dependencies and aliasing FYI: There is no |
Beta Was this translation helpful? Give feedback.
-
@marvinhagemeister Is there a way to alias |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is a section on the Getting Started page called "Aliasing React to Preact". There is no example for how to do this in a Deno project. So 1) I'd like to ask how to do so in a Deno project, and 2) I'd like to propose that a Deno example be added to "Aliasing React to Preact".
Context: I am using Fresh, am trying to use Sandpack, and get the following error when I do. This error is because Sandpack uses React's
useState
and Fresh uses Preact. I think (but am unsure) that what I need to do to resolve this is alias React topreact/compat
.As a guess, I tried doing:
in
imports
indeno.json
but it didn't work.Beta Was this translation helpful? Give feedback.
All reactions