wxt
Version:
⚡ Next-gen Web Extension Framework
17 lines (16 loc) • 620 B
JavaScript
import { getEntrypointGlobals } from "../../../utils/globals.mjs";
//#region src/core/builders/vite/plugins/entrypointGroupGlobals.ts
/** Define a set of global variables specific to an entrypoint. */
function entrypointGroupGlobals(entrypointGroup) {
return {
name: "wxt:entrypoint-group-globals",
config() {
const define = {};
let name = Array.isArray(entrypointGroup) ? "html" : entrypointGroup.name;
for (const global of getEntrypointGlobals(name)) define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
return { define };
}
};
}
//#endregion
export { entrypointGroupGlobals };