fix(v2): remove buggy routesLoaded + deprecate routesLoaded lifecycle (#3141)

* remove bad deletion of docs / if conflicting with a page

* deprecate routesLoaded
This commit is contained in:
Sébastien Lorber 2020-07-28 14:28:14 +02:00 committed by GitHub
parent ac757e9dff
commit d25d4b08f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 30 deletions

View file

@ -68,9 +68,6 @@ export default function pluginContentDocs(
context: LoadContext,
options: PluginOptions,
): Plugin<LoadedContent | null, typeof PluginOptionSchema> {
const homePageDocsRoutePath =
options.routeBasePath === '' ? '/' : options.routeBasePath;
if (options.admonitions) {
options.remarkPlugins = options.remarkPlugins.concat([
[admonitions, options.admonitions],
@ -487,23 +484,6 @@ Available document ids=
);
},
async routesLoaded(routes) {
const homeDocsRoutes = routes.filter(
(routeConfig) => routeConfig.path === homePageDocsRoutePath,
);
// Remove the route for docs home page if there is a page with the same path (i.e. docs).
if (homeDocsRoutes.length > 1) {
const docsHomePageRouteIndex = routes.findIndex(
(route) =>
route.component === options.docLayoutComponent &&
route.path === homePageDocsRoutePath,
);
delete routes[docsHomePageRouteIndex!];
}
},
configureWebpack(_config, isServer, utils) {
const {getBabelLoader, getCacheLoader} = utils;
const {rehypePlugins, remarkPlugins} = options;