Document how to compile a Fresh site into an executable
Opened this issue · 4 comments
With Deno 2.1.0, we can now compile assets directly into the executable. This means we should be able to ship a Deno Fresh (Application) as a single binary.
I've tried this, and it fails to load some of the assets at runtime. I'm not sure if this is just a documentation issue, or if something within Fresh needs to be adjusted to handle asset locations. Here is what I did:
deno --version
(deno 2.1.1 (stable, release, aarch64-apple-darwin)deno run -A -r https://fresh.deno.dev fresh-site
(answered Y to all questions)cd fresh-site
deno task build
There are a few options here:
5. deno compile --include static/ --include _fresh/ --include deno.json --include fresh.gen.ts -A dev.ts
6. ./dev
This fails with:
error: Uncaught (in promise) NotSupported: writefile '/var/folders/0v/jhqzvwhx345fsngdr12f6zg00000gn/T/deno-compile-dev/fresh-site/fresh.gen.ts': writefile '/var/folders/0v/jhqzvwhx345fsngdr12f6zg00000gn/T/deno-compile-dev/fresh-site/fresh.gen.ts'
We could also try and compile the main.ts
5. deno compile --include static/ --include _fresh/ --include deno.json --include fresh.gen.ts -A main.ts
6. ./fresh-site
This starts the Fresh application:
$ ./fresh-site
Using snapshot found at /var/folders/0v/jhqzvwhx345fsngdr12f6zg00000gn/T/deno-compile-fresh-site/fresh-site/_fresh
🍋 Fresh ready
Local: http://localhost:8000/
But assets fail to load when rendering this site.
Are there other assets that need to be included? Other suggestions?
I've the same issue, would be great if that would work
I believe this issue has been fixed in Deno v2.1.2.
denoland/deno#27008 denoland/deno#27006