Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/router-plugin/src/core/router-generator-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export const unpluginRouterGeneratorFactory: UnpluginFactory<
userConfig = getConfig(options, ROOT)

if (compiler.options.mode === 'production') {
await run(generate)
compiler.hooks.beforeRun.tapPromise(PLUGIN_NAME, async () => {
await run(generate)
})
} else {
// rspack watcher doesn't register newly created files
const routesDirectoryPath = getRoutesDirectoryPath()
Expand All @@ -117,7 +119,9 @@ export const unpluginRouterGeneratorFactory: UnpluginFactory<
userConfig = getConfig(options, ROOT)

if (compiler.options.mode === 'production') {
await run(generate)
compiler.hooks.beforeRun.tapPromise(PLUGIN_NAME, async () => {
await run(generate)
})
} else {
// webpack watcher doesn't register newly created files
const routesDirectoryPath = getRoutesDirectoryPath()
Expand Down