Skip to content

Commit

Permalink
kit-routes: add exportConsts config option (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwennlbh authored Nov 23, 2024
1 parent adb0a7e commit 64415c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/vite-plugin-kit-routes/src/lib/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export type Options<T extends RouteMappings = RouteMappings> = {
*/
stats?: boolean
}

/**
* Export ROUTES, LINKS, SERVERS and ACTIONS constants in the generated file
* Does nothing when the format is "variables", as exporting is required then.
* @default false
*/
exportObjects?: boolean

/**
* @default 'src/lib/ROUTES.ts'
Expand Down Expand Up @@ -915,7 +922,7 @@ ${c.files
.map((c) => {
return (
`/**\n * ${c.type}\n */
${options?.format?.includes('object') ? `export ` : ``}` +
${options?.exportObjects || options?.format?.includes('object') ? `export ` : ``}` +
`const ${c.type} = {
${c.files
.map((key) => {
Expand Down

0 comments on commit 64415c5

Please sign in to comment.