budibase/packages/builder/src/builderStore/loadComponentLibraries.js

16 lines
405 B
JavaScript
Raw Normal View History

2019-08-19 22:18:23 +02:00
import { map } from "lodash/fp";
export const loadLibs = async (appName, appPackage) => {
const makeUrl = l =>
`/_builder/api/${appName}/componentlibrary?lib=${encodeURI(l)}`
const allLibraries = {};
for(let lib of appPackage.pages.componentLibraries) {
const libModule = await import(makeUrl(lib));
allLibraries[lib] = libModule;
}
return allLibraries;
}