@shipengine/connect
Version:
The official developer tooling for building ShipEngine connect apps
17 lines • 729 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadModule = void 0;
const path_1 = require("path");
/** Load a module, handling the default import if it exists */
const loadModule = (path, searchPath) => {
if (searchPath) {
// Specifying the search path lets us load modules from the app's node_modules folder instead of
// the node_modules folder of the CLI
module.paths = [(0, path_1.resolve)(searchPath, 'node_modules'), ...module.paths];
}
const app = require(path);
// TypeScript transpiles default exports as default = object
return app.default ? app.default : app;
};
exports.loadModule = loadModule;
//# sourceMappingURL=load-module.js.map