mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
fix(v2): fix multi-instance mdx loaders not sandboxed correctly (#3970)
* another attempt to fix the multi-instance conflicts * try to fix windows build * cleanup + improve comment
This commit is contained in:
parent
9fdac1a0dc
commit
1e1860681b
4 changed files with 15 additions and 3 deletions
|
@ -15,6 +15,7 @@ import {
|
||||||
getPluginI18nPath,
|
getPluginI18nPath,
|
||||||
reportMessage,
|
reportMessage,
|
||||||
posixPath,
|
posixPath,
|
||||||
|
addTrailingPathSeparator,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {
|
import {
|
||||||
STATIC_DIR_NAME,
|
STATIC_DIR_NAME,
|
||||||
|
@ -436,7 +437,9 @@ export default function pluginContentBlog(
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /(\.mdx?)$/,
|
test: /(\.mdx?)$/,
|
||||||
include: getContentPathList(contentPaths),
|
include: getContentPathList(contentPaths)
|
||||||
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
||||||
|
.map(addTrailingPathSeparator),
|
||||||
use: [
|
use: [
|
||||||
getCacheLoader(isServer),
|
getCacheLoader(isServer),
|
||||||
getBabelLoader(isServer),
|
getBabelLoader(isServer),
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
aliasedSitePath,
|
aliasedSitePath,
|
||||||
reportMessage,
|
reportMessage,
|
||||||
posixPath,
|
posixPath,
|
||||||
|
addTrailingPathSeparator,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {LoadContext, Plugin, RouteConfig} from '@docusaurus/types';
|
import {LoadContext, Plugin, RouteConfig} from '@docusaurus/types';
|
||||||
|
|
||||||
|
@ -345,7 +346,9 @@ export default function pluginContentDocs(
|
||||||
function createMDXLoaderRule(): RuleSetRule {
|
function createMDXLoaderRule(): RuleSetRule {
|
||||||
return {
|
return {
|
||||||
test: /(\.mdx?)$/,
|
test: /(\.mdx?)$/,
|
||||||
include: flatten(versionsMetadata.map(getDocsDirPaths)),
|
include: flatten(versionsMetadata.map(getDocsDirPaths))
|
||||||
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
||||||
|
.map(addTrailingPathSeparator),
|
||||||
use: compact([
|
use: compact([
|
||||||
getCacheLoader(isServer),
|
getCacheLoader(isServer),
|
||||||
getBabelLoader(isServer),
|
getBabelLoader(isServer),
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
docuHash,
|
docuHash,
|
||||||
getPluginI18nPath,
|
getPluginI18nPath,
|
||||||
getFolderContainingFile,
|
getFolderContainingFile,
|
||||||
|
addTrailingPathSeparator,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {
|
import {
|
||||||
LoadContext,
|
LoadContext,
|
||||||
|
@ -210,7 +211,9 @@ export default function pluginContentPages(
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /(\.mdx?)$/,
|
test: /(\.mdx?)$/,
|
||||||
include: getContentPathList(contentPaths),
|
include: getContentPathList(contentPaths)
|
||||||
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
||||||
|
.map(addTrailingPathSeparator),
|
||||||
use: [
|
use: [
|
||||||
getCacheLoader(isServer),
|
getCacheLoader(isServer),
|
||||||
getBabelLoader(isServer),
|
getBabelLoader(isServer),
|
||||||
|
|
|
@ -414,6 +414,9 @@ export function addLeadingSlash(str: string): string {
|
||||||
export function addTrailingSlash(str: string): string {
|
export function addTrailingSlash(str: string): string {
|
||||||
return str.endsWith('/') ? str : `${str}/`;
|
return str.endsWith('/') ? str : `${str}/`;
|
||||||
}
|
}
|
||||||
|
export function addTrailingPathSeparator(str: string): string {
|
||||||
|
return str.endsWith(path.sep) ? str : `${str}${path.sep}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function removeTrailingSlash(str: string): string {
|
export function removeTrailingSlash(str: string): string {
|
||||||
return removeSuffix(str, '/');
|
return removeSuffix(str, '/');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue