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

constants.ts

34 lines1.3 KB

1export const START_ENVIRONMENT_NAMES = {
2 // 'ssr' is chosen as the name for the server environment to ensure backwards compatibility
3 // with vite plugins that are not compatible with the new vite environment API (e.g. tailwindcss)
4 server: 'ssr',
5 client: 'client',
6} as const
7​
8export type StartEnvironmentName =
9 (typeof START_ENVIRONMENT_NAMES)[keyof typeof START_ENVIRONMENT_NAMES]
10​
11export const VITE_ENVIRONMENT_NAMES = START_ENVIRONMENT_NAMES
12​
13export type ViteEnvironmentNames = StartEnvironmentName
14​
15// for client and router:
16// if a user has a custom server/client entry point file, resolve.alias will point to this
17// otherwise it will be aliased to the default entry point in the respective framework plugin
18export const ENTRY_POINTS = {
19 client: 'virtual:tanstack-start-client-entry',
20 server: 'virtual:tanstack-start-server-entry',
21 // the start entry point must always be provided by the user
22 start: '#tanstack-start-entry',
23 router: '#tanstack-router-entry',
24} as const
25​
26export const DEV_CLIENT_ENTRY = 'virtual:tanstack-start-dev-client-entry'
27​
28export const SERVER_FN_LOOKUP = 'server-fn-module-lookup'
29​
30// matches
31// .ts, .tsx, .cts, .mts, .js, .jsx, .cjs, .mjs
32// with optional query params after
33// but not .json
34export const TRANSFORM_ID_REGEX = [/\.[cm]?[tj]sx?($|\?)/]