D
Deno

help

solid-js with Deno

IioB3/4/2023
I was wondering if it was possible to use solid-js with Deno natively without something like esbuild. This is possible with react (with no config):
import * as React from "https://esm.sh/react@18.2.0"

function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
import * as React from "https://esm.sh/react@18.2.0"

function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
Currently my deno.json looks likes:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "solid-js/h"
},
"imports": {
"solid-js/": "https://esm.sh/solid-js@1.6.11/"
}
}
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "solid-js/h"
},
"imports": {
"solid-js/": "https://esm.sh/solid-js@1.6.11/"
}
}
and my code looks like
function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
but when I run it I get
$ deno run -A test.tsx
error: Uncaught SyntaxError: The requested module '/v110/solid-js@1.6.11/deno/web.js' does not provide an export named 'assign'
at <anonymous> (https://esm.sh/v110/solid-js@1.6.11/deno/h.js:2:20)
$ deno run -A test.tsx
error: Uncaught SyntaxError: The requested module '/v110/solid-js@1.6.11/deno/web.js' does not provide an export named 'assign'
at <anonymous> (https://esm.sh/v110/solid-js@1.6.11/deno/h.js:2:20)
I find it quite strange that the URL it is importing is "https://esm.sh/v110/solid-js@1.6.11/deno/h.js". Anyone have any ideas?
Aandykais3/4/2023
@iobdas maybe post your findings here and see if its a library issue? https://github.com/solidjs/solid/discussions/332
GitHub
Have you ever considered porting solid to deno? · solidjs/solid · D...
It would be quite the lift but might get some really interesting traction with solid. http://deno.land/
Ccdoremus3/5/2023
You might want to take a look at this: https://github.com/LePichu/solidjs-deno-example
GitHub
GitHub - LePichu/solidjs-deno-example: Example showing how to use S...
Example showing how to use Solid.js using Deno as the core runtime instead of Node. - GitHub - LePichu/solidjs-deno-example: Example showing how to use Solid.js using Deno as the core runtime inste...
IioB3/5/2023
I've seen it, but it uses esbuild which is kind of cheating (even if it is a common thing to do for deno frameworks)
Ccdoremus3/5/2023
I don't understand what your concern is. Why is es-build not an acceptable solution?
IioB3/5/2023
It would be cool to avoid a build step entirely
Ccdoremus3/5/2023
All the major Deno web frameworks incorporate a build but it is a just-in-time build
IioB3/5/2023
That seems a bit underwhelming, I think it would be cool to have the transpilation step done entirely by Deno itself since it does support JSX tranformation
Kkylejune3/5/2023
I still don't get the point in not having a build step and instead building at runtime. If it's fast enough to not negatively impact users, it would seem that it would also be fast enough in a build step without really slow down development. Having it in a build step avoids having to regenerate build artifacts for each newly spawned process.
IioB3/5/2023
In my opinion it's just a cool JIT build step Probably faster as well? I think I'd probably just use esbuild and a build step for a real production thing
Kkylejune3/5/2023
fresh is just using esbuild at runtime. Makes more sense to me to just run it once for each build via a build step instead of once for each process. Your build step could just be running esbuild like it does at runtime, so it shouldn't really slow development. If you're not using deploy and want to have multiple instances of the process running on the machine, each process would have a copy of the build artifacts in memory. Fresh just generates them and stores them in a map.
IioB3/5/2023
I understand, I get the reasoning here

Looking for more? Join the community!

Recommended Posts
Feature Suggestion: Dark Mode for `std` library Docs.Deno's documentation is great. I find myself reading it more and more. I currently use a browser addRunning esbuild with esbuild_deno_loaderI've spent probably four or five hours trying to track down this issue, to the point where I actuall`fetch` request always fails onceHello, I got a script containing a `fetch` request. Once in a while, it throws the `connection closeSequentially write to TPC connectionHey, I experience errors when multiple async functions write to a TCP (`Deno.Conn`) connection. How I'd like to change the background colour of the `body` element in Fresh. How do I do that simply?(see title)Deno process watcher. How?This code when compile, runs a simple http server. ```ts import { serve } from "https://deno.land/stmonaco-editor on freshHello. First of all, I am a newbie in web development. I played around with Deno for a while. So I tdeno in Dockerfilei have successfully installed deno with theese commands: ``` # install denojs RUN curl -fsSL https:could not find npm package forI'm trying to make Hardhat CLI work with Deno but I stumbled upon this error which comes from Deno: Microsoft Transact SQLIs there official Deno driver for this or a recommended way?Remove std/node, it was merged into Deno itself (#3206)This used to work, but now it doesn't. Where do you show examples of where this was moved to and howFFI Difference between buffer and pointerI’ve been using interchangeably `Deno.UnsafePointer.of(new Uint8Array())` with type `pointer` and `nDetecting invalid JS stringsIs there any built-in way to "detect" invalid strings? Here's an example: ```ts // this is an invaError connecting to MongoDB AtlasHello, I'm trying to connect to MongoDB Atlas via `mongoose` (`npm:mongoose`) but encountered the fointeract with deno Extension at runtimeIs there any way to interact with an extension at code execution? I need to pass a pointer from my rAny good way to modify remote url file and debug it?For example, I'm using `import server "https://deno.land/x/ultra@v2.1.7/server.ts"` I want to modifyCache related headers not included in deno deploy for static file servingI have a hello world level static site using `serveDir`. When I run the site locally I see that WeakError with relativ import path after "deno install"Is it possible that imports in deno.json are ignored after "deno install"? ```bash deno run ./my-Run examples on WindowsAnyone know how to run the `Piping to files` example on Windows? https://deno.land/manual@v1.30.3/exPython alternative to ctypes, can't figure how to convert a codeHello, I am trying to convert a Python ctypes code to Deno using FFI, but can't know why its not wo