Skip to content

Commit

Permalink
Merge branch 'node-loader' of https://github.com/boenrobot/nest-cli i…
Browse files Browse the repository at this point in the history
…nto boenrobot-node-loader
  • Loading branch information
kamilmysliwiec committed Jan 24, 2020
2 parents 394e13a + 142af07 commit 56d1dfd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/compiler/plugins-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ export class PluginsLoader {
...module.paths,
];
const pluginRefs: NestCompilerPlugin[] = pluginNames.map(item => {
for (const path of nodeModulePaths) {
const binaryPath = resolve(path, item);
if (existsSync(binaryPath + '.js')) {
return require(binaryPath);
}
try {
const binaryPath = require.resolve(item, {paths: nodeModulePaths});
return require(binaryPath);
} catch (e) {
throw new Error(`"${item}" plugin could not be found!`);
}
throw new Error(`"${item}" plugin could not be found!`);
});
const beforeHooks: MultiNestCompilerPlugins['afterHooks'] = [];
const afterHooks: MultiNestCompilerPlugins['beforeHooks'] = [];
Expand Down

0 comments on commit 56d1dfd

Please sign in to comment.