deno: Cannot use npm package `@vitejs/plugin-react-swc`
Reproduction: https://github.com/brillout/deno_vitejs-plugin-react-swc.
$ deno --version
deno 1.29.1 (release, x86_64-unknown-linux-gnu)
v8 10.9.194.5
typescript 4.9.4
Thanks for your wonderful work on Deno. I’d love the Vite + Deno combo (and provide a vite-plugin-ssr Deno starter).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154) Fixes for various `Attemped to access invalid request` bugs (#19058, #15427, #17213). We did not wait for both a drop even... — committed to denoland/deno by mmastrac a year ago
- fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154) Fixes for various `Attemped to access invalid request` bugs (#19058, #15427, #17213). We did not wait for both a drop even... — committed to denoland/deno by mmastrac a year ago
- fix(napi): properly handle arguments in napi_get_cb_info (#19269) Closes https://github.com/denoland/deno/issues/17213 — committed to denoland/deno by bartlomieju a year ago
We’ve managed to track down the bug here. Will try to fix it tonight.
Thank you for personally addressing this issue @bartlomieju ❤️
This fix hasn’t been released yet. I will be later tonight/tomorrow.
Thanks, that’s very useful. I traced the problem to the call to
napi_typeof, which somehow passes an empty pointer as an argument, which is explicitly guarded against. Since it works in Node I assume it’s a problem in anothernapi_symbol we have that doesn’t return a proper value.Sure, here’s a minimal repro of
@swc/corecrashing:I’d make Deno permissive.
For example, a widespread problem is npm packages having invalid ESM imports, e.g.
import './foo'instead ofimport './foo.js', which makes Node.js choke. Another example is packages that ship ESM but don’t havetype: "module"in theirpackage.json. Deno should be able to execute npm packages that ship invalid code.I’d make Deno permissive only for npm packages, while being more strict for user land and Deno packages. In order to foster a Deno ecosystem that is correct.
I think the number one goal for now is to fix the many problems users encounter because of Node.js.
Together with Vite we have a unique opportunity to own the entire stack while fostering a diverse ecosystem (in contrast to other companies’ tendency to control everything and being ecosystem-unfriendly), enabling folks to inovate like Svelte, Solid, Hydrogen/Preact, etc. Our “only” job being to offer basic tools that work very well. Vite is hitting a limit because there is no communication between the Vite team and the Node.js team (I’m not sure if the Node.js team is intersted in that to begin with).
On my side, let me first show you a prototype of that React framework “Base”. I think you’ll like what you see.
(Base is only a thin wrapper on top of vite-plugin-ssr, which means that improvements also benefits the entire Vite ecosystem.)
Ideally I’ll ship Base with Deno right away. We can then systematically polish Deno to fix problems, most notably the many ESM/CJS issues users are having today. FYI another pet peeve of mine is that errors can be swallowed. That’s a no-go, exceptions should always emit a stack trace. (Although I’m not sure whether it’s a V8 problem that Deno cannot work around.)
I’ve always like Deno, because Deno cares, truly cares.