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

vite.config.ts.ejs

41 lines1.7 KB

1<% if (bundler !== 'vite') { ignoreFile() } -%>
2import { defineConfig } from 'vite'
3<% const showDevtools = !blank || integrations.some((integration) => integration.type === 'devtools') -%>
4<% if (showDevtools) { -%>
5import { devtools } from '@tanstack/devtools-vite'
6<% } -%>
7<% if (addOnEnabled.paraglide) { -%>
8import { paraglideVitePlugin } from "@inlang/paraglide-js"
9<% } -%>
10<% if (routerOnly) { %>
11import { tanstackRouter } from '@tanstack/router-plugin/vite'
12<% } else { %>
13import { tanstackStart } from '@tanstack/react-start/plugin/vite';
14<% } %>
15<% if (addOnEnabled.compiler) { -%>
16import viteReact, { reactCompilerPreset } from '@vitejs/plugin-react'
17import babel from '@rolldown/plugin-babel'
18<% } else { -%>
19import viteReact from '@vitejs/plugin-react'
20<% } -%>
21<% if (tailwind) { -%>
22import tailwindcss from "@tailwindcss/vite"
23<% } -%>
24<% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
25<% } %>
26​
27const config = defineConfig({
28 resolve: { tsconfigPaths: true },
29 plugins: [<% if (showDevtools) { %>devtools(), <% } %><% if (addOnEnabled.paraglide) { %>paraglideVitePlugin({
30 project: './project.inlang',
31 outdir: './src/paraglide',
32 strategy: ['url', "baseLocale"],
33 }), <% } %><% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportCode(integration) %>,<% } %>
34 <% if (tailwind) { %>tailwindcss(),<% } %>
35 <% if (routerOnly) { %>tanstackRouter({ target: 'react', autoCodeSplitting: true }),<% } else { %>tanstackStart(),<% } %>
36 viteReact(),<% if (addOnEnabled.compiler) { %>
37 babel({ presets: [reactCompilerPreset()] }),<% } %>
38 ],
39})
40​
41export default config