(config: BuildConfig)
| 19 | } |
| 20 | |
| 21 | async function submoduleCoreProd(config: BuildConfig) { |
| 22 | const input: InputOptions = { |
| 23 | input: join(config.tscDir, 'packages', 'qwik', 'src', 'core', 'index.js'), |
| 24 | onwarn: rollupOnWarn, |
| 25 | external: ['@builder.io/qwik/build', '@builder.io/qwik/preloader'], |
| 26 | plugins: [ |
| 27 | { |
| 28 | name: 'setVersion', |
| 29 | generateBundle(_, bundles) { |
| 30 | for (const f in bundles) { |
| 31 | const b = bundles[f]; |
| 32 | if (b.type === 'chunk') { |
| 33 | b.code = b.code.replace( |
| 34 | 'globalThis.QWIK_VERSION', |
| 35 | JSON.stringify(config.distVersion) |
| 36 | ); |
| 37 | } |
| 38 | } |
| 39 | }, |
| 40 | }, |
| 41 | ], |
| 42 | }; |
| 43 | |
| 44 | const esmOutput: OutputOptions = { |
| 45 | dir: join(config.distQwikPkgDir), |
| 46 | format: 'es', |
| 47 | entryFileNames: 'core.mjs', |
| 48 | sourcemap: true, |
| 49 | banner: getBanner('@builder.io/qwik', config.distVersion), |
| 50 | }; |
| 51 | |
| 52 | const cjsOutput: OutputOptions = { |
| 53 | dir: join(config.distQwikPkgDir), |
| 54 | format: 'umd', |
| 55 | name: 'qwikCore', |
| 56 | entryFileNames: 'core.cjs', |
| 57 | sourcemap: true, |
| 58 | globals: { |
| 59 | '@builder.io/qwik/build': 'qwikBuild', |
| 60 | // not actually used |
| 61 | '@builder.io/qwik/preloader': 'qwikPreloader', |
| 62 | }, |
| 63 | banner: getBanner('@builder.io/qwik', config.distVersion), |
| 64 | }; |
| 65 | |
| 66 | const build = await rollup(input); |
| 67 | |
| 68 | await Promise.all([build.write(esmOutput), build.write(cjsOutput)]); |
| 69 | |
| 70 | console.log('🦊 core.mjs:', await fileSize(join(config.distQwikPkgDir, 'core.mjs'))); |
| 71 | |
| 72 | const inputCore = join(config.distQwikPkgDir, 'core.mjs'); |
| 73 | const inputMin: InputOptions = { |
| 74 | external: ['@builder.io/qwik/preloader'], |
| 75 | input: inputCore, |
| 76 | onwarn: rollupOnWarn, |
| 77 | plugins: [ |
| 78 | { |
no test coverage detected
searching dependent graphs…