Skip to content

Commit

Permalink
fix(plugin): prevent require.resolve paths arguments undefined (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahziheng authored Feb 21, 2023
1 parent c86b7b5 commit 5ece688
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugin/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class PluginFactory {
`Plugin ${pluginName} config can't have both package and path at ${manifestItem?.path ?? 'UNKNOWN_PATH'}`,
);
}
pluginConfigItem.path = getPackagePath(pluginConfigItem.package, [loaderState?.baseDir]);
const requirePaths = loaderState?.baseDir ? [loaderState.baseDir] : undefined;
pluginConfigItem.path = getPackagePath(pluginConfigItem.package, requirePaths);
delete pluginConfigItem.package;
} else if (pluginConfigItem.path && await exists(path.resolve(pluginConfigItem.path, 'package.json'))) {
// plugin path is a npm package, need resolve main file
Expand Down

0 comments on commit 5ece688

Please sign in to comment.