Open History to see the last commit
1import {
2 START_ENVIRONMENT_NAMES,
3 tanStackStartVite,
4} from '@tanstack/start-plugin-core/vite'
5import type {
6 TanStackStartViteInputConfig,
7 TanStackStartVitePluginCoreOptions,
8} from '@tanstack/start-plugin-core/vite'
9import { vueStartDefaultEntryPaths } from './shared'
10import type { PluginOption } from 'vite'
11β
12export function tanstackStart(
13 options?: TanStackStartViteInputConfig,
14): Array<PluginOption> {
15 const corePluginOpts: TanStackStartVitePluginCoreOptions = {
16 framework: 'vue',
17 defaultEntryPaths: vueStartDefaultEntryPaths,
18 providerEnvironmentName: START_ENVIRONMENT_NAMES.server,
19 ssrIsProvider: true,
20 ssrResolverStrategy: {
21 type: 'default',
22 },
23 }
24β
25 return [
26 {
27 name: 'tanstack-vue-start:config',
28 configEnvironment(environmentName, options) {
29 return {
30 optimizeDeps:
31 environmentName === START_ENVIRONMENT_NAMES.client ||
32 (environmentName === START_ENVIRONMENT_NAMES.server &&
33 // This indicates that the server environment has opted in to dependency optimization
34 options.optimizeDeps?.noDiscovery === false)
35 ? {
36 // As `@tanstack/vue-start` depends on `@tanstack/vue-router`, we should exclude both.
37 exclude: [
38 '@tanstack/vue-start',
39 '@tanstack/vue-router',
40 '@tanstack/start-static-server-functions',
41 ],
42 }
43 : undefined,
44 }
45 },
46 },
47 tanStackStartVite(corePluginOpts, options),
48 ]
49}