Skip to content

Commit

Permalink
fix(v2): Fix plugin path resolution (#2829)
Browse files Browse the repository at this point in the history
* fix(v2): Fix plugin path resolution

* Import docusaurus.config.js from constant file
  • Loading branch information
SamChou19815 authored May 29, 2020
1 parent 0047db2 commit f2fb2b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/docusaurus/src/server/plugins/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
*/

import Module from 'module';
import {join} from 'path';
import importFresh from 'import-fresh';
import {LoadContext, Plugin, PluginConfig} from '@docusaurus/types';
import {CONFIG_FILE_NAME} from '../../constants';

export function initPlugins({
pluginConfigs,
Expand All @@ -21,7 +23,7 @@ export function initPlugins({
// We need to fallback to createRequireFromPath since createRequire is only available in node v12.
// See: https://nodejs.org/api/modules.html#modules_module_createrequire_filename
const createRequire = Module.createRequire || Module.createRequireFromPath;
const pluginRequire = createRequire(context.siteDir);
const pluginRequire = createRequire(join(context.siteDir, CONFIG_FILE_NAME));

const plugins: Plugin<any>[] = pluginConfigs
.map((pluginItem) => {
Expand Down

0 comments on commit f2fb2b8

Please sign in to comment.