Skip to content

Commit 628134a

Browse files
committed
fix
1 parent 05eb218 commit 628134a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

libs/wingsdk/src/core/plugin-manager.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ export class PluginManager {
5454
);
5555
}
5656

57-
// eslint-disable-next-line @typescript-eslint/no-require-imports
58-
this.hooks.push(require(pluginAbsolutePath));
57+
try {
58+
// eslint-disable-next-line @typescript-eslint/no-require-imports
59+
this.hooks.push(require(pluginAbsolutePath));
60+
} catch (err) {
61+
throw new Error(
62+
`Failed to load plugin from "${pluginAbsolutePath}":\n${err}`
63+
);
64+
}
5965
}
6066

6167
/**

libs/wingsdk/test/core/plugin-manager.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import * as tfaws from "../../src/target-tf-aws";
77
import { tfResourcesOfCount, mkdtemp } from "../util";
88

99
const PLUGIN_CODE = `
10-
var s3_bucket = require("../.gen/providers/aws/s3-bucket");
10+
var s3_bucket = require("${require.resolve(
11+
"../../src/.gen/providers/aws/s3-bucket"
12+
)}");
1113
1214
exports.preSynth = function(app) {
1315
new s3_bucket.S3Bucket(app, "PluginBucket", {bucket: "plugin-bucket"})

0 commit comments

Comments
 (0)