-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroot.tsx
56 lines (49 loc) · 1.29 KB
/
root.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { json } from '@remix-run/node'
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'
import type { LinksFunction, MetaFunction } from '@remix-run/node'
/**
* ErrorBoundary
* @see {@link https://remix.run/docs/en/main/route/error-boundary}
*/
export { default as ErrorBoundary } from '~/components/ErrorBoundary'
export const loader = () => {
const isProd = process.env.NODE_ENV === 'production'
const packageVersion = isProd
? process.env.npm_package_version
: `${process.env.npm_package_version}-${process.env.NODE_ENV}`
return json({ packageVersion })
}
export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [
{ charSet: 'utf-8' },
{ name: 'viewport', content: 'width=device-width,initial-scale=1' },
{ title: 'Remix App' },
{ name: 'application-version', content: data?.packageVersion ?? '' },
]
}
export const links: LinksFunction = () => {
return [
{
rel: 'icon',
href: '/favicon.svg',
type: 'image/svg+xml',
},
]
}
const Root = () => {
return (
<html>
<head>
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
)
}
export default Root