Skip to content

Commit

Permalink
feat: support for custom meta file naming
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Sep 18, 2024
1 parent d505fe9 commit bfdc440
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { processRouteManifest, stringifyRoutes, validateRouteDir } from './utils
import { invalidateVirtualModule, resolvedVirtualModuleId, virtualModuleId } from './virtual'

function remixFlatRoutes(options: Options = {}): Vite.PluginOption {
const { appDirectory = 'app', flatRoutesOptions, legacy } = options
const { appDirectory = 'app', flatRoutesOptions, legacy, meta } = options

const routeDir = flatRoutesOptions?.routeDir || 'routes'
const routeDirs = Array.isArray(routeDir) ? routeDir : [routeDir]
Expand All @@ -33,7 +33,7 @@ function remixFlatRoutes(options: Options = {}): Vite.PluginOption {
rootDirectory: process.cwd(),
routeManifest: {},
remixOptions: { appDirectory, flatRoutesOptions },
meta: 'meta',
meta: meta || 'meta',
isLegacyMode,
}

Expand Down
4 changes: 4 additions & 0 deletions src/node/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export type Options = SetOptional<RemixOptions, 'appDirectory'> & {
* 插件默认会探测 react-router-dom 版本,如果版本小于等于 6.3.0,则使用legacy模式
*/
legacy?: boolean
/**
* @description 自定义meta文件命名
*/
meta?: string
}

export type RouteExports<T> = AddHasPrefix<T>
Expand Down

0 comments on commit bfdc440

Please sign in to comment.