Open History to see the last commit
1import { createFileRoute } from '@tanstack/react-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 className="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 )
31}