Files
vencord-plugin-template/build/vencordDep.mjs

32 lines
899 B
JavaScript
Raw Normal View History

2023-04-19 23:58:28 +02:00
import { globalExternalsWithRegExp } from "@fal-works/esbuild-plugin-global-externals";
const names = {
webpack: "Vencord.Webpack",
"webpack/common": "Vencord.Webpack.Common",
utils: "Vencord.Util",
api: "Vencord.Api",
components: "Vencord.Components"
};
export default globalExternalsWithRegExp({
getModuleInfo(modulePath) {
const path = modulePath.replace("@vencord/types/", "");
let varName = names[path];
if (!varName) {
2023-04-20 00:40:21 +02:00
const elements = path.split("/");
varName = names[elements.shift()];
if (!varName) throw new Error("Unknown module path: " + modulePath);
2023-04-19 23:58:28 +02:00
2023-04-20 00:40:21 +02:00
if (varName !== "Vencord.Util" || elements[0] === "types") varName += "." + elements.join(".");
2023-04-19 23:58:28 +02:00
}
2023-04-20 00:01:36 +02:00
2023-04-19 23:58:28 +02:00
return {
varName,
type: "cjs"
};
},
2023-04-20 00:01:36 +02:00
2023-04-19 23:58:28 +02:00
modulePathFilter: /^@vencord\/types.+$/
});