mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): avoid vue-router
warning with routeRule redirect (#25391)
This commit is contained in:
parent
034d1aaa6f
commit
b5853c977e
@ -1,6 +1,6 @@
|
|||||||
import { existsSync, readdirSync } from 'node:fs'
|
import { existsSync, readdirSync } from 'node:fs'
|
||||||
import { mkdir, readFile } from 'node:fs/promises'
|
import { mkdir, readFile } from 'node:fs/promises'
|
||||||
import { addBuildPlugin, addComponent, addPlugin, addTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, findPath, logger, updateTemplates } from '@nuxt/kit'
|
import { addBuildPlugin, addComponent, addPlugin, addTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, findPath, logger, updateTemplates, useNitro } from '@nuxt/kit'
|
||||||
import { dirname, join, relative, resolve } from 'pathe'
|
import { dirname, join, relative, resolve } from 'pathe'
|
||||||
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
|
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
@ -337,6 +337,22 @@ export default defineNuxtModule({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nuxt.options.experimental.appManifest) {
|
||||||
|
// Add all redirect paths as valid routes to router; we will handle these in a client-side middleware
|
||||||
|
// when the app manifest is enabled.
|
||||||
|
nuxt.hook('pages:extend', routes => {
|
||||||
|
const nitro = useNitro()
|
||||||
|
for (const path in nitro.options.routeRules) {
|
||||||
|
const rule = nitro.options.routeRules[path]
|
||||||
|
if (!rule.redirect) { continue }
|
||||||
|
routes.push({
|
||||||
|
path: path.replace(/\/[^/]*\*\*/, '/:pathMatch(.*)'),
|
||||||
|
file: resolve(runtimeDir, 'component-stub'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Extract macros from pages
|
// Extract macros from pages
|
||||||
const pageMetaOptions: PageMetaPluginOptions = {
|
const pageMetaOptions: PageMetaPluginOptions = {
|
||||||
dev: nuxt.options.dev,
|
dev: nuxt.options.dev,
|
||||||
|
1
packages/nuxt/src/pages/runtime/component-stub.ts
Normal file
1
packages/nuxt/src/pages/runtime/component-stub.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default {}
|
Loading…
Reference in New Issue
Block a user