Skip to content

Commit

Permalink
fix(v2): emit error if valid type of plugin is not found (#3934)
Browse files Browse the repository at this point in the history
  • Loading branch information
9oelM committed Dec 31, 2020
1 parent fa71a66 commit 6505865
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/docusaurus/src/server/plugins/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ export default function initPlugins({
pluginModuleImport = pluginItem;
} else if (Array.isArray(pluginItem)) {
[pluginModuleImport, pluginOptions = {}] = pluginItem;
} else {
throw new TypeError(`You supplied a wrong type of plugin.
A plugin should be either string or [importPath: string, options?: object].
For more information, visit https://v2.docusaurus.io/docs/using-plugins.`);
}

if (!pluginModuleImport) {
return null;
throw new Error('The path to the plugin is either undefined or null.');
}

// The pluginModuleImport value is any valid
Expand Down

0 comments on commit 6505865

Please sign in to comment.