MCPcopy Index your code
hub / github.com/QwikDev/qwik / submoduleCoreDev

Function submoduleCoreDev

scripts/submodule-core.ts:212–271  ·  view source on GitHub ↗
(config: BuildConfig)

Source from the content-addressed store, hash-verified

210}
211
212async function submoduleCoreDev(config: BuildConfig) {
213 const submodule = 'core';
214
215 const opts: BuildOptions = {
216 entryPoints: [join(config.srcQwikDir, submodule, 'index.ts')],
217 entryNames: submodule,
218 outdir: config.distQwikPkgDir,
219 bundle: true,
220 sourcemap: 'external',
221 target,
222 define: {
223 'globalThis.QWIK_VERSION': JSON.stringify(config.distVersion),
224 },
225 };
226
227 const esm = await build({
228 ...opts,
229 external: ['@builder.io/qwik/build', '@builder.io/qwik/preloader'],
230 format: 'esm',
231 outExtension: { '.js': '.mjs' },
232 });
233
234 // We do a CJS build, only for the repl service worker
235 const cjs = build({
236 ...opts,
237 // we don't externalize qwik build because then the repl service worker sees require()
238 define: {
239 ...opts.define,
240 // We need to get rid of the import.meta.env values
241 // Vite's base url
242 'import.meta.env.BASE_URL': '"globalThis.BASE_URL||\'/\'"',
243 // Vite's devserver mode
244 'import.meta.env.DEV': 'false',
245 },
246 format: 'cjs',
247 outExtension: { '.js': '.cjs' },
248 banner: {
249 js: `globalThis.qwikCore = (function (module) {`,
250 },
251 footer: {
252 js: `return module.exports; })(typeof module === 'object' && module.exports ? module : { exports: {} });`,
253 },
254 });
255
256 await Promise.all([esm, cjs]);
257
258 // Point the minified and prod versions to the dev versions
259 await writeFile(join(config.distQwikPkgDir, 'core.prod.mjs'), `export * from './core.mjs';\n`);
260 await writeFile(
261 join(config.distQwikPkgDir, 'core.prod.cjs'),
262 `module.exports = require('./core.cjs');\n`
263 );
264 await writeFile(join(config.distQwikPkgDir, 'core.min.mjs'), `export * from './core.mjs';\n`);
265 await writeFile(
266 join(config.distQwikPkgDir, 'core.min.cjs'),
267 `module.exports = require('./core.cjs');\n`
268 );
269

Callers 1

submoduleCoreFunction · 0.85

Calls 2

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…