This is a proof of concept of using Svelte with Deno.
First, I suggest you read the associated blog post in which I give more information on the research behind.
TL;DR:
make help
to see available commands.make init serve
to set up the project and launch the web server.The server-side rendering works! But not yet frontend-side, which needs adjustments.
Svelte is built-in, provided as a Git Submodule.
The provided Svelte version is a fork of mine which has only one change you can check here, TL;DR: it allows to build Svelte's compiler into an .mjs
file so Deno can use it.
The make init
command should initialize the git submodule and build Svelte as an ESM so you can use it.
The Svelte compiler is used in compile.ts in order to generate the files that are stored in output/. You can recompile the files using make compile
if you need.
The generated Javascript file throws an error when used with Deno. This is probably caused by the fact that importing from 'svelte/internal';
isn't possible, maybe because of a native Typescript issue, but not sure.
This is the reason why you will find a "dirty fix" in compile.ts line 36.
The generated DOM must include features that allow import {...} from "../svelte/internal";
to work, which is not the case now.
This means that somehow, we might have to include the compiled internal.mjs
file in the build (maybe I'll find a way to do it further).