-
Notifications
You must be signed in to change notification settings - Fork 12k
Cannot pre-render wildcard routes when using outputMode: 'server'
#30035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This behavior is expected. Based on the error, it looks like you're using the new dev-preview APIs. Note that the "prerender" option is no longer applicable with these APIs, and the "outputMode" setting is now required. For more details, refer to the documentation: https://angular.dev/guide/hybrid-rendering#customizing-build-time-prerendering-ssg |
What is the recommended way to prerender wildcard routes? Does |
Yes, that’s the point of it. |
Well it doesn't seem to:
but I'll just convert them to parameterized routes, they're functionally equivalent in this context. |
You need to provide the route parameters as described in the docs: https://angular.dev/guide/hybrid-rendering#parameterized-routes |
As I stated above, Angular disallows How can I prerender wildcard routes? Parameterized routes do not work because the route can be nested deeply, e.g. {
path: 'docs/api/**',
component: DocViewerComponent
} |
Instead of using a catch-all route, you can define it as a parameterized path: |
The routes can be nested arbitrarily deep. |
routesFile
when using outputMode: 'server'
outputMode: 'server'
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes. This enables more flexible prerendering configurations in server routes. Example: ```ts { path: '/product/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [['category', '1'], ['category', '2']]; } } ``` Closes angular#30035
…ined routes Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': '/laptop/123' }, { id: '2', '**': '/laptop/456' } ]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': '/laptop/123' }, { id: '2', '**': '/laptop/456' } ]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': 'laptop/123' }, { id: '2', '**': 'laptop/456' } ]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': 'laptop/123' }, { id: '2', '**': 'laptop/456' } ]; } } ``` Closes angular#30035
Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': 'laptop/123' }, { id: '2', '**': 'laptop/456' } ]; } } ``` Closes angular#30035 (cherry picked from commit cb3446e)
Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`. Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes. This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`. Example: ```ts { path: '/product/:id/**', renderMode: RenderMode.Prerender, async getPrerenderParams() { return [ { id: '1', '**': 'laptop/123' }, { id: '2', '**': 'laptop/456' } ]; } } ``` Closes #30035 (cherry picked from commit cb3446e)
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I have a few wildcard routes in my app. There are a large number of routes which will match these wildcard routes and they are all listed in a route file as described in the docs.
However when I build, I get the warning
The "prerender" option is not considered when "outputMode" is specified.
and the routes specified inrenderableRoutes.txt
are not prerendered. RemovingoutputMode
causes the routes to be prerendered, but I get the errorError: Angular app engine manifest is not set. Please ensure you are using the '@angular/build:application' builder to build your server application.
when running the server.Minimal Reproduction
routesFile
toangular.json
outputMode
fromangular.json
Exception or Error
Your Environment
Anything else relevant?
I am using the
@angular-devkit/build-angular:application
builder.The text was updated successfully, but these errors were encountered: