-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite Router Plugin generates routeTree.gen.ts with imports using .tsx instead of .js for esm module #3221
Comments
sounds reasonable. do you want to create a PR for this? |
Hey guys! Correct me if I am wrong, but I believe this option already exists:
// If typescript is disabled, make sure the generated route tree is a .js file
if (config.disableTypes) {
config.generatedRouteTree = config.generatedRouteTree.replace(
/\.(ts|tsx)$/,
'.js',
)
} Can you try specifying the |
I am happy to add a new config type to allow specifying extension if that is still needed |
@schiller-manuel Thanks for the approval. @itsjoeoui Yes, it is still needed.
We can probably extend the existing property Such that the final config can be like: TanStackRouterVite({
semicolons: true,
quoteStyle: "double",
addExtensions: "js",
autoCodeSplitting: true
}) Currently, I am occupied with something else so if @itsjoeoui doesn't get the time to do it then I might do it after a week or so. |
Which project does this relate to?
Router
Describe the bug
Using
@tanstack/router-plugin/vite
inside vite config to generate routeTree automatically.Plugin Config:
Now the problem is that the generated routeTree has the following imports:
but inside the esm module the imports should ideally be using the
.js
extension. Expected:Though vite builds the code just fine but I have some server side logic as well where vite is not involved but since the routeTree is being generated using vite and it contains
.tsx
so it is causing issues with my build because it expect.js
imports in esm which is default behaviour.We can probably have another property inside the plugin which allows passing the extension or maybe something similar? Or maybe just always use
.js
in case of esm?Your Example Website or App
No link
Steps to Reproduce the Bug or Issue
Not Required.
Expected behavior
Already shared.
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: