mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 02:12:36 +02:00
fix(core): inject docusaurus version into SSR as local (#7329)
* Revert "fix(core): handle case where package.json is not available at CWD (#7187)"
This reverts commit 3b32a41f22
.
* properly fix
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
78400541cb
commit
d3f526fd8a
3 changed files with 8 additions and 2 deletions
|
@ -26,7 +26,6 @@ import logger from '@docusaurus/logger';
|
|||
// eslint-disable-next-line no-restricted-imports
|
||||
import _ from 'lodash';
|
||||
import type {Locals} from '@slorber/static-site-generator-webpack-plugin';
|
||||
import {DOCUSAURUS_VERSION} from '@docusaurus/utils';
|
||||
|
||||
const getCompiledSSRTemplate = _.memoize((template: string) =>
|
||||
eta.compile(template.trim(), {
|
||||
|
@ -72,6 +71,7 @@ async function doRender(locals: Locals & {path: string}) {
|
|||
baseUrl,
|
||||
ssrTemplate,
|
||||
noIndex,
|
||||
DOCUSAURUS_VERSION,
|
||||
} = locals;
|
||||
const location = routesLocation[locals.path]!;
|
||||
await preload(location);
|
||||
|
|
1
packages/docusaurus/src/deps.d.ts
vendored
1
packages/docusaurus/src/deps.d.ts
vendored
|
@ -52,6 +52,7 @@ declare module '@slorber/static-site-generator-webpack-plugin' {
|
|||
baseUrl: string;
|
||||
ssrTemplate: string;
|
||||
noIndex: boolean;
|
||||
DOCUSAURUS_VERSION: string;
|
||||
};
|
||||
|
||||
export default class StaticSiteGeneratorPlugin
|
||||
|
|
|
@ -13,7 +13,11 @@ import type {Props} from '@docusaurus/types';
|
|||
import {createBaseConfig} from './base';
|
||||
import WaitPlugin from './plugins/WaitPlugin';
|
||||
import LogPlugin from './plugins/LogPlugin';
|
||||
import {NODE_MAJOR_VERSION, NODE_MINOR_VERSION} from '@docusaurus/utils';
|
||||
import {
|
||||
NODE_MAJOR_VERSION,
|
||||
NODE_MINOR_VERSION,
|
||||
DOCUSAURUS_VERSION,
|
||||
} from '@docusaurus/utils';
|
||||
import ssrDefaultTemplate from './templates/ssr.html.template';
|
||||
|
||||
// Forked for Docusaurus: https://github.com/slorber/static-site-generator-webpack-plugin
|
||||
|
@ -78,6 +82,7 @@ export default async function createServerConfig({
|
|||
onHeadTagsCollected,
|
||||
ssrTemplate: ssrTemplate ?? ssrDefaultTemplate,
|
||||
noIndex,
|
||||
DOCUSAURUS_VERSION,
|
||||
},
|
||||
paths: ssgPaths,
|
||||
preferFoldersOutput: trailingSlash,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue