Skip to content

Error: React Router Vite plugin can't detect preamble. Something is wrong. #12655

Closed Answered by ianjmacintosh
akoskm asked this question in Q&A
Discussion options

You must be logged in to vote

tl;dr:
Update vite.config.ts with:

// ..
export default defineConfig({
  plugins: [!process.env.VITEST && reactRouter()],
  // ..
});

@akoskm I found this thread when I ran into this exact same issue.

Then I found this really good article about it:
https://akoskm.com/react-router-vitest-example/

Then I came back here to share a link to that article here aaaaand after looking at your username, it seems like that's not necessary!

Thanks for the help, looks like you figured it out :)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@akoskm
Comment options

Answer selected by akoskm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants