MCPcopy
hub / github.com/QwikDev/qwik / bundleIndex

Function bundleIndex

scripts/submodule-build.ts:32–67  ·  view source on GitHub ↗
(config: BuildConfig, entryName: string)

Source from the content-addressed store, hash-verified

30}
31
32export async function bundleIndex(config: BuildConfig, entryName: string) {
33 const submodule = 'build';
34 const buildDestDir = join(config.distQwikPkgDir, submodule);
35
36 ensureDir(buildDestDir);
37
38 const opts: BuildOptions = {
39 entryPoints: [join(config.srcQwikDir, 'build', `${entryName}.ts`)],
40 entryNames: entryName,
41 outdir: buildDestDir,
42 bundle: true,
43 sourcemap: true,
44 target,
45 };
46
47 const esm = build({
48 ...opts,
49 format: 'esm',
50 outExtension: { '.js': '.mjs' },
51 });
52
53 const cjs = build({
54 ...opts,
55 format: 'cjs',
56
57 banner: {
58 js: `globalThis.qwikBuild = (function (module) {`,
59 },
60 footer: {
61 js: `return module.exports; })(typeof module === 'object' && module.exports ? module : { exports: {} });`,
62 },
63 outExtension: { '.js': '.cjs' },
64 });
65
66 await Promise.all([esm, cjs]);
67}

Callers 1

submoduleBuildFunction · 0.85

Calls 3

ensureDirFunction · 0.90
joinFunction · 0.85
buildFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…