Skip to content

Commit 4d3e61c

Browse files
committed
chore: Fix build errors.
1 parent 4a9a06f commit 4d3e61c

File tree

9 files changed

+85
-11826
lines changed

9 files changed

+85
-11826
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ node_modules
1010
package-lock.json
1111
/priv/tmp
1212
/priv/static/assets/
13+
/priv/bun
1314
bun.lockb

config/dev.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import Config
33
config :phoenix_react_server, Phoenix.React,
44
runtime: Phoenix.React.Runtime.Bun,
55
component_base: Path.expand("../assets/component", __DIR__),
6+
render_timeout: 5_000,
67
cache_ttl: 60

config/prod.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import Config
33
config :phoenix_react_server, Phoenix.React,
44
runtime: Phoenix.React.Runtime.Bun,
55
component_base: Path.expand("../priv/react/component", __DIR__),
6+
render_timeout: 5_000,
67
cache_ttl: 60 * 15

config/test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import Config
33
config :phoenix_react_server, Phoenix.React,
44
runtime: Phoenix.React.Runtime.Bun,
55
component_base: Path.expand("../test/fixtures", __DIR__),
6+
render_timeout: 5_000,
67
cache_ttl: 60

lib/phoenix/mix/build/server.js.eex

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,20 @@ const server = serve({
8989
},
9090
});
9191
} catch(error) {
92-
throw error;
92+
const html = `
93+
<div role="alert" class="alert alert-error">
94+
<div>
95+
<div class="font-bold">${escapeHTML(error)}</div>
96+
<pre style="white-space: pre-wrap;">${escapeHTML(error.stack)}</pre>
97+
</div>
98+
</div>
99+
`;
100+
return new Response(html, {
101+
status: 500,
102+
headers: {
103+
"Content-Type": "text/html",
104+
},
105+
});
93106
}
94107
},
95108
error(error) {

lib/phoenix/react/server.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ defmodule Phoenix.React.Server do
6060
render_timeout = cfg[:render_timeout]
6161
args = [component_base: component_base, render_timeout: render_timeout]
6262

63-
{:ok, _} = Runtime.start_runtime(runtime, args)
63+
{:ok, runtiem_process} = Runtime.start_runtime(runtime, args)
6464

6565
{:ok,
6666
%{
6767
runtime: runtime,
6868
component_base: component_base,
6969
render_timeout: render_timeout,
70-
runtiem_process: nil
70+
runtiem_process: runtiem_process
7171
}}
7272
end
7373

0 commit comments

Comments
 (0)