File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/@aws-cdk/toolkit-lib/lib/api/plugin Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,19 @@ export class PluginHost implements IPluginHost {
36
36
* @param ioHost - the I/O host to use for printing progress information
37
37
*/
38
38
public async load ( moduleSpec : string , ioHost ?: IIoHost ) {
39
+ const resolved = this . _doResolve ( moduleSpec ) ;
40
+ if ( ioHost ) {
41
+ await IoHelper . fromIoHost ( ioHost , 'init' ) . defaults . debug ( `Loading plug-in: ${ resolved } from ${ moduleSpec } ` ) ;
42
+ }
43
+ return this . _doLoad ( resolved ) ;
44
+ }
45
+
46
+ /**
47
+ * Do the resolving of a module string to an actual path
48
+ */
49
+ private _doResolve ( moduleSpec : string ) {
39
50
try {
40
- const resolved = require . resolve ( moduleSpec ) ;
41
- if ( ioHost ) {
42
- await IoHelper . fromIoHost ( ioHost , 'init' ) . defaults . debug ( `Loading plug-in: ${ resolved } from ${ moduleSpec } ` ) ;
43
- }
44
- return this . _doLoad ( resolved ) ;
51
+ return require . resolve ( moduleSpec ) ;
45
52
} catch ( e : any ) {
46
53
// according to Node.js docs `MODULE_NOT_FOUND` is the only possible error here
47
54
// @see https://nodejs.org/api/modules.html#requireresolverequest-options
You can’t perform that action at this time.
0 commit comments