Use `createEffect` in a terminal environment with Deno and TypeScript

Hello everyone! I wrote the following code, but the effect doesn't work. Nothing is shown in the console:
import { createEffect } from "npm:solid-js";
import { createMutable } from "npm:solid-js/store";

const state = createMutable({ count: 0 });

createEffect(() => {
console.log(state.count);
});

setInterval(() => state.count++, 1000);
import { createEffect } from "npm:solid-js";
import { createMutable } from "npm:solid-js/store";

const state = createMutable({ count: 0 });

createEffect(() => {
console.log(state.count);
});

setInterval(() => state.count++, 1000);
But if I use Skypack imports it works:
import { createEffect } from "https://cdn.skypack.dev/solid-js";
import { createMutable } from "https://cdn.skypack.dev/solid-js/store";

// ...
import { createEffect } from "https://cdn.skypack.dev/solid-js";
import { createMutable } from "https://cdn.skypack.dev/solid-js/store";

// ...
But Skypack doesn't provide the TypeScript types. So everything is any and I get the JavaScript experience. Does anyone smarter than me have an idea how to fix this? Thanks for any help! 😄
1 Reply
mdynnl
mdynnl•6mo ago
solid js relies on export conditions. reactive for browser (import), non-reactive for node (require) deno probably pulls in the cjs version of it probably have to workaround things until we have https://github.com/solidjs/signals
Want results from more Discord servers?
Add your server