#createFileRoute removed on save

13 messages · Page 1 of 1 (latest)

ripe agate
#

Trying to migrate from Next.js, running the alpha. Running into two issues with file based routing:

  1. No createFileRoute being inserted in existing files
  2. With new files, createFileRoute is added, but when saving the createFileRoute import is removed
    "@tanstack/react-router": "1.121.0-alpha.14",
    "@tanstack/react-start": "1.121.0-alpha.21",

Vite config

import tailwindcss from "@tailwindcss/vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import { defineConfig } from "vite"
import tsconfigPaths from "vite-tsconfig-paths"

export default defineConfig({
  server: {
    port: 3000,
  },
  plugins: [tailwindcss(), tsconfigPaths(), tanstackStart()],
})
real bear
#

yes, this is expected. you dont import createFileRoute anymore

#

this will be much smoother soon

ripe agate
real bear
#

it's done for you automatically

#

no need to worry about that

ripe agate
# real bear it's done for you automatically

It seems that this only works for 1 file for me. In my index.tsx I dont need the import. In other files it will give me a missing definition error.

Also, is there a way to fix #1? It seems that Vite is not adding export const Route ... to files that already existed

real bear
#

we only prefill empty files

#

so you would need to add the export yourself. should be picked up then .

ripe agate
#

Fair enough, thanks!

real bear
#

however the code generator is currently being rewritten by me to me much more robust.

#

will be out soon

ripe agate
#

Nice! Looking forward to it