Skip to content

Commit

Permalink
fix: lowcoder comp loader fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aqib Mirza committed Sep 4, 2023
1 parent 6ba6bb5 commit a02d547
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions client/packages/lowcoder/src/comps/comps/remoteComp/loaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ async function npmLoader(remoteInfo: RemoteCompInfo): Promise<CompConstructor |
// log.info("load npm plugin:", remoteInfo);
const { packageName, packageVersion = "latest", compName } = remoteInfo;
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${packageName}@${packageVersion}/index.js`;
const module = await import(/* webpackIgnore: true */ entry);
const comp = module.default?.[compName];
if (!comp) {
console.log("Entry", entry);
try {
const module = await import(/* webpackIgnore: true */ entry);
// let module = moduleGlobe;
// if (packageName !== "openblocks-comps-workmeet") {
// module = await import(entry);
// }
console.log("Entry 1", module);
const comp = module.default?.[compName];
if (!comp) {
throw new Error(trans("npm.compNotFound", { compName }));
}
return comp;
} catch (e) {
console.log("eeeee", e);
throw new Error(trans("npm.compNotFound", { compName }));
}
return comp;
}

async function bundleLoader(remoteInfo: RemoteCompInfo): Promise<CompConstructor | null> {
Expand Down

0 comments on commit a02d547

Please sign in to comment.