mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
fix(v2): Fix plugin path resolution (#2829)
* fix(v2): Fix plugin path resolution * Import docusaurus.config.js from constant file
This commit is contained in:
parent
0047db2896
commit
f2fb2b8e0f
1 changed files with 3 additions and 1 deletions
|
@ -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,
|
||||
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue