Skip to content

Commit

Permalink
fix import problem
Browse files Browse the repository at this point in the history
  • Loading branch information
anshul committed Aug 3, 2020
1 parent b329400 commit 4457a2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 6 additions & 4 deletions packages/docusaurus-mdx-loader/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

const {getOptions} = require('loader-utils');
const {readFile} = require('fs-extra');
const {readFile, existsSync} = require('fs-extra');
const mdx = require('@mdx-js/mdx');
const emoji = require('remark-emoji');
const matter = require('gray-matter');
Expand Down Expand Up @@ -60,9 +60,11 @@ module.exports = async function (fileString) {
if (metadataPath) {
// Add as dependency of this loader result so that we can
// recompile if metadata is changed.
this.addDependency(metadataPath);
const metadata = await readFile(metadataPath, 'utf8');
exportStr += `\nexport const metadata = ${metadata};`;
if (existsSync(metadataPath)) {
this.addDependency(metadataPath);
const metadata = await readFile(metadataPath, 'utf8');
exportStr += `\nexport const metadata = ${metadata};`;
}
}
}

Expand Down
9 changes: 0 additions & 9 deletions packages/docusaurus-plugin-content-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import globby from 'globby';
import fs from 'fs';
import path from 'path';
import minimatch from 'minimatch';
import {
encodePath,
fileToPath,
Expand Down Expand Up @@ -50,11 +49,6 @@ export default function pluginContentPages(
'docusaurus-plugin-content-pages',
);

const excludeRegex = new RegExp(
options.exclude
.map((pattern) => minimatch.makeRe(pattern).source)
.join('|'),
);
return {
name: 'docusaurus-plugin-content-pages',

Expand Down Expand Up @@ -178,9 +172,6 @@ export default function pluginContentPages(
// Note that metadataPath must be the same/in-sync as
// the path from createData for each MDX.
metadataPath: (mdxPath: string) => {
if (excludeRegex.test(mdxPath)) {
return null;
}
const aliasedSource = aliasedSitePath(mdxPath, siteDir);
return path.join(
dataDir,
Expand Down

0 comments on commit 4457a2e

Please sign in to comment.