Hi team, it’s a wonderful project but recently i have been having trouble getting Piny to work with a tanstack app created with vite. the specific issue is that i cannot get ‘Click to select’ to work.
I suspect the plugin order in vite.config.ts maybe the issue.
here is the current (not working) vite config.
is there a workaround i can try?
thank u.
import { defineConfig } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import PinyVite from '@pinegrow/piny-vite'
const config = defineConfig({
resolve: { tsconfigPaths: true },
plugins: [
devtools(),
tailwindcss(),
tanstackStart(),
viteReact(),
PinyVite()
]
})
export default config
thanks for the followup. your repo is great and works for me.
the default vite command to install tanstack router insists on installing tanstack Start (the template). this interferes with injecting piny into the page.
i found out you need to add {import.meta.env.DEV && } in __root.tsx as below.
If you check `node_modules/@pinegrow/piny-vite/dist/index.js`, the runtime path is automatically injected (screeenshot below). Does you setup does something that interferes with this? Your feedback is welcome, so that we can improve our setup. Thanks!
Thanks @vips. That was very useful. Our piny vite plugin uses `transformIndexHtml` to inject piny into the shell index.html which is present in vanilla tanstack app (my git repo), while in the full tanstack app you shared, there is no shell, and is generated dynamically. We will patch it up to cover this scenario if possible. cc: @matjaz
Meanwhile, your hack adding it to __root.tsx was a smart one. Thanks for sharing.