oedotme / generouted

Generated file-based routes for Vite
https://stackblitz.com/github.com/oedotme/generouted/tree/main/explorer
MIT License
1.02k stars 47 forks source link

feat: add transpile option #158

Closed ferretwithaberet closed 5 months ago

ferretwithaberet commented 6 months ago

Description Add transpile option to transpile the code inside of generated router.ts to ESNext javascript code.

Motivation Fixes #156, as this will allow the generouted plugin to be used in vanilla javascript codebases. This feature is meant to be used in combination with the output option to generate a router.js file.

oedotme commented 5 months ago

@ferretwithaberet Thanks for opening the PR.

I've commented on the original issue, disabling the router.ts generation can be acheived easily by skipping the plugin usage at the vite.config.js — the exports can be used instead directly from react-router-dom. It's not recommended as you still can benefit from the generated types in JavaScript project with jsconfig.json or specific editor integration.

Removing the types from the file generated specifically for types would be unnecessary option.

Hope you find that helpful, thanks!