(config: BuildConfig, entryName: string)
| 30 | } |
| 31 | |
| 32 | export 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 | } |
no test coverage detected
searching dependent graphs…