fix: remove useless js-loader in front of mdx-loader (#8972)

This commit is contained in:
Sébastien Lorber 2023-05-12 16:31:39 +02:00 committed by GitHub
parent 905fe7f4b4
commit d746f689ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 9 deletions

View file

@ -359,7 +359,7 @@ export default async function pluginContentBlog(
return translateContent(content, translationFiles);
},
configureWebpack(_config, isServer, {getJSLoader}, content) {
configureWebpack(_config, isServer, utils, content) {
const {
admonitions,
rehypePlugins,
@ -399,7 +399,6 @@ export default async function pluginContentBlog(
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator),
use: [
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {

View file

@ -228,7 +228,6 @@ export default async function pluginContentDocs(
},
configureWebpack(_config, isServer, utils, content) {
const {getJSLoader} = utils;
const {
rehypePlugins,
remarkPlugins,
@ -263,7 +262,6 @@ export default async function pluginContentDocs(
test: /\.mdx?$/i,
include: contentDirs,
use: [
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {

View file

@ -186,7 +186,7 @@ export default function pluginContentPages(
);
},
configureWebpack(config, isServer, {getJSLoader}) {
configureWebpack() {
const {
admonitions,
rehypePlugins,
@ -209,7 +209,6 @@ export default function pluginContentPages(
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator),
use: [
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: {

View file

@ -85,7 +85,7 @@ export function createMDXFallbackPlugin({
version: {type: 'synthetic'},
// Synthetic, the path doesn't matter much
path: '.',
configureWebpack(config, isServer, {getJSLoader}) {
configureWebpack(config) {
// We need the mdx fallback loader to exclude files that were already
// processed by content plugins mdx loaders. This works, but a bit
// hacky... Not sure there's a way to handle that differently in webpack
@ -117,7 +117,6 @@ export function createMDXFallbackPlugin({
test: /\.mdx?$/i,
exclude: getMDXFallbackExcludedPaths(),
use: [
getJSLoader({isServer}),
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: mdxLoaderOptions,

View file

@ -138,7 +138,8 @@ async function ChangelogPlugin(context, options) {
'default',
);
// Redirect the metadata path to our folder
config.module.rules[0].use[1].options.metadataPath = (mdxPath) => {
const mdxLoader = config.module.rules[0].use[0];
mdxLoader.options.metadataPath = (mdxPath) => {
// Note that metadataPath must be the same/in-sync as
// the path from createData for each MDX.
const aliasedPath = aliasedSitePath(mdxPath, context.siteDir);