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

Function handler

packages/qwik/src/optimizer/src/plugins/vite.ts:496–561  ·  view source on GitHub ↗
(_, rollupBundle)

Source from the content-addressed store, hash-verified

494 generateBundle: {
495 order: 'post',
496 async handler(_, rollupBundle) {
497 const opts = qwikPlugin.getOptions();
498
499 if (opts.target === 'client') {
500 // client build
501
502 for (const [fileName, b] of Object.entries(rollupBundle)) {
503 if (b.type === 'asset') {
504 const baseFilename = basePathname + fileName;
505 if (STYLING.some((ext) => fileName.endsWith(ext))) {
506 if (typeof b.source === 'string' && b.source.length < opts.inlineStylesUpToBytes) {
507 injections.push({
508 tag: 'style',
509 location: 'head',
510 attributes: {
511 'data-src': baseFilename,
512 dangerouslySetInnerHTML: b.source,
513 },
514 });
515 } else {
516 injections.push({
517 tag: 'link',
518 location: 'head',
519 attributes: {
520 rel: 'stylesheet',
521 href: baseFilename,
522 },
523 });
524 }
525 } else {
526 const selectedFont = FONTS.find((ext) => fileName.endsWith(ext));
527 if (selectedFont && !disableFontPreload) {
528 injections.unshift({
529 tag: 'link',
530 location: 'head',
531 attributes: {
532 rel: 'preload',
533 href: baseFilename,
534 as: 'font',
535 type: `font/${selectedFont.slice(1)}`,
536 crossorigin: '',
537 },
538 });
539 }
540 }
541 }
542 }
543
544 const clientManifestStr = await qwikPlugin.generateManifest(
545 this,
546 rollupBundle,
547 bundleGraphAdders,
548 {
549 injections,
550 platform: { vite: '' },
551 }
552 );
553

Callers 1

dispatchFunction · 0.50

Calls 1

hasNodeCompatFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…