T
TanStack•2y ago
conscious-sapphire

Issue with Electron & vite & tanstack

Hi guys, having some issues with electron & vite & tanstack: Failed to resolve import "./routeTree.gen" from "src/renderer/src/app.tsx". Does the file exist? The routeTree never generate, there is my eletron.vite.config.ts:
import path, { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import { TanStackRouterVite } from '@tanstack/router-vite-plugin'

export default defineConfig({
main: {
plugins: [externalizeDepsPlugin(), TanStackRouterVite()]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('./src/renderer/src'),
'@': path.resolve(__dirname, './src/renderer/src')
}
},
plugins: [react()]
}
})
import path, { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import { TanStackRouterVite } from '@tanstack/router-vite-plugin'

export default defineConfig({
main: {
plugins: [externalizeDepsPlugin(), TanStackRouterVite()]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('./src/renderer/src'),
'@': path.resolve(__dirname, './src/renderer/src')
}
},
plugins: [react()]
}
})
4 Replies
conscious-sapphire
conscious-sapphireOP•2y ago
And that's because of that: Error: ENOENT: no such file or directory, scandir '/Users/user/development/electron/esthERP/src/routes' => The src file & routes are in /renderer
conscious-sapphire
conscious-sapphireOP•2y ago
No description
ratty-blush
ratty-blush•2y ago
Will need a reproduction for this. Also, make sure the generatedRouteTree and routesDirectory options are correctly mapped to your their intended destinations. https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing#options
conscious-sapphire
conscious-sapphireOP•2y ago
that was the configuration. Thanks 🙂

Did you find this page helpful?