Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

scripts.tsx

31 lines649 Bytes

1import { createFileRoute } from '@tanstack/solid-router'
2​
3const isProd = import.meta.env.PROD
4​
5export const Route = createFileRoute('/scripts')({
6 head: () => ({
7 scripts: [
8 {
9 src: 'script.js',
10 },
11 isProd
12 ? undefined
13 : {
14 src: 'script2.js',
15 },
16 ],
17 }),
18 component: ScriptsComponent,
19})
20​
21function ScriptsComponent() {
22 return (
23 <div class="p-2">
24 <h3 data-testid="scripts-test-heading">Scripts Test</h3>
25 <p>
26 Both `script.js` and `script2.js` are included in development, but only
27 `script.js` is included in production.
28 </p>
29 </div>
30 )