MCPcopy Create free account
hub / github.com/6pac/SlickGrid / buildIifeFile

Function buildIifeFile

scripts/builds.mjs:117–136  ·  view source on GitHub ↗
(file, displayLog = true)

Source from the content-addressed store, hash-verified

115
116/** build as iife, every file will be bundled separately */
117export async function buildIifeFile(file, displayLog = true) {
118 // for `slick.core.js` file only, we'll add it to the global Slick variable
119 const globalName = /slick.core.[jt]s/gi.test(file) ? 'Slick' : undefined;
120 const startTime = new Date().getTime();
121 await runBuild({
122 entryPoints: [file],
123 format: 'iife',
124 globalName,
125 define: { IIFE_ONLY: 'true' },
126 outfile: `dist/browser/${file.replace('src', '').replace(/.[j|t]s/, '')}.js`,
127 plugins: [
128 removeImportsPlugin,
129 ],
130 });
131
132 if (displayLog) {
133 const endTime = new Date().getTime();
134 console.log(`[${styleText('yellow', 'esbuild ⚡')}] Built "${file}" to "iife" format in ${endTime - startTime}ms`);
135 }
136}
137
138/**
139 * Run esbuild build with default configs, merge any options provided

Callers 2

executeCommandCallbackFunction · 0.90
buildAllIifeFilesFunction · 0.85

Calls 1

runBuildFunction · 0.85

Tested by

no test coverage detected