Move ssr build from priv/static/assets into priv/svelte

This commit is contained in:
Dmitrii Maganov 2023-08-01 04:01:37 +03:00 committed by Wout De Puysseleir
parent 07c14a770c
commit 26cdfb462f
No known key found for this signature in database
GPG key ID: 3DE9371B50FEC46A
4 changed files with 7 additions and 7 deletions

View file

@ -34,7 +34,7 @@ let optsServer = {
minify: false,
target: "node19.6.1",
conditions: ["svelte"],
outdir: "../priv/static/assets/server",
outdir: "../priv/svelte",
logLevel: "info",
sourcemap: watch ? "inline" : false,
watch,

View file

@ -28,6 +28,9 @@ example-*.tar
# Ignore assets that are produced by build tools.
/priv/static/assets/
# Ignore ssr build for svelte.
/priv/svelte/
# Ignore digested assets cache.
/priv/static/cache_manifest.json

View file

@ -34,7 +34,7 @@ let optsServer = {
minify: false,
target: "node19.6.1",
conditions: ["svelte"],
outdir: "../priv/static/assets/server",
outdir: "../priv/svelte",
logLevel: "info",
sourcemap: watch ? "inline" : false,
watch,

View file

@ -11,12 +11,9 @@ defmodule LiveSvelte.SSR do
@moduledoc false
@doc false
def render(name, props, slots \\ nil)
def render(name, nil, slots), do: render(name, %{}, slots)
def render(name, props, slots) do
try do
NodeJS.call!({"server/server", "ssrRenderComponent"}, [name, props, slots])
NodeJS.call!({"server", "ssrRenderComponent"}, [name, props, slots])
catch
:exit, {:noproc, _} -> raise LiveSvelte.SSR.NodeNotConfigured
end
@ -24,6 +21,6 @@ defmodule LiveSvelte.SSR do
def server_path() do
{:ok, path} = :application.get_application()
Application.app_dir(path, "/priv/static/assets")
Application.app_dir(path, "/priv/svelte")
end
end