Skip to content

Commit 5336d5a

Browse files
committed
chore: configure path aliases and update imports to use ~ prefix in tanstack-start example
1 parent 1bc2fa1 commit 5336d5a

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

examples/with-tanstack-start/src/components/secret-leak-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from "react";
2-
import { env } from "../env";
2+
import { env } from "~/env";
33

44
function LeakedSecret() {
55
// Accessing server-only DATABASE_URL directly in client render tree throws an error

examples/with-tanstack-start/src/routes/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createFileRoute } from "@tanstack/react-router";
22
import { createServerFn } from "@tanstack/react-start";
3-
import { SecretLeakButton } from "../components/secret-leak-button";
4-
import { env } from "../env";
3+
import { SecretLeakButton } from "~/components/secret-leak-button";
4+
import { env } from "~/env";
55

66
const getDatabaseHost = createServerFn({ method: "GET" }).handler(() => {
77
// Server functions can safely read server secrets without leaking them to the client:

examples/with-tanstack-start/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
33
"compilerOptions": {
4+
"paths": {
5+
"~/*": ["./src/*"]
6+
},
47
"strict": true,
58
"esModuleInterop": true,
69
"jsx": "react-jsx",

examples/with-tanstack-start/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import viteReact from "@vitejs/plugin-react";
44
import { defineConfig } from "vite";
55

66
export default defineConfig({
7+
resolve: {
8+
tsconfigPaths: true,
9+
},
710
server: {
811
port: 3000,
912
},

0 commit comments

Comments
 (0)