Create a better bundle (math only)

This commit is contained in:
Adria Navarro 2024-01-16 17:32:23 +01:00
parent 807e9f1687
commit 2c9165d1be
1 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,35 @@
const { getHelperList } = require("./helpers")
// import { addedHelpers } from "./helpers/external"
const helpers = getHelperList()
// https://github.com/evanw/esbuild/issues/56
const externalCollections = {
math: require("@budibase/handlebars-helpers/lib/math"),
// array: require("@budibase/handlebars-helpers/lib/array"),
// number: require("@budibase/handlebars-helpers/lib/number"),
// url: require("@budibase/handlebars-helpers/lib/url"),
// string: require("@budibase/handlebars-helpers/lib/string"),
// comparison: require("@budibase/handlebars-helpers/lib/comparison"),
// object: require("@budibase/handlebars-helpers/lib/object"),
// regex: require("@budibase/handlebars-helpers/lib/regex"),
// uuid: require("@budibase/handlebars-helpers/lib/uuid"),
}
module.exports = { helpers }
let helpers = undefined
const getHelperList = () => {
if (helpers) {
return helpers
}
helpers = {}
for (let collection of Object.values(externalCollections)) {
for (let [key, func] of Object.entries(collection)) {
helpers[key] = func
}
}
// for (let key of Object.keys(addedHelpers)) {
// helpers[key] = addedHelpers[key]
// }
return helpers
}
export default getHelperList()