From 9a2532e1473c87442eeff2652877e67be1f6cf4e Mon Sep 17 00:00:00 2001 From: avivkeller Date: Wed, 18 Feb 2026 14:46:43 -0500 Subject: [PATCH 1/2] fix(rolldown): dynamic import --- src/generators/web/utils/bundle.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/generators/web/utils/bundle.mjs b/src/generators/web/utils/bundle.mjs index 69780372..28e0c516 100644 --- a/src/generators/web/utils/bundle.mjs +++ b/src/generators/web/utils/bundle.mjs @@ -1,11 +1,11 @@ import { join } from 'node:path'; import virtual from '@rollup/plugin-virtual'; -import { build } from 'rolldown'; import cssLoader from './css.mjs'; import getStaticData from './data.mjs'; import getConfig from '../../../utils/configuration/index.mjs'; +import { lazy } from '../../../utils/misc.mjs'; // Resolve node_modules relative to this package (doc-kit), not cwd. // This ensures modules are found when running from external directories. @@ -14,6 +14,11 @@ const DOC_KIT_NODE_MODULES = join( '../../../../node_modules' ); +// TODO(@avivkeller): Untill we can use Rolldown's bindings in node-core, +// we have to dynamically import it, as to not have it imported in core +// at all. +const rolldown = lazy(() => import('rolldown')); + /** * Asynchronously bundles JavaScript source code (and its CSS imports), * targeting either browser (client) or server (Node.js) environments. @@ -25,6 +30,8 @@ const DOC_KIT_NODE_MODULES = join( export default async function bundleCode(codeMap, { server = false } = {}) { const config = getConfig('web'); + const { build } = await rolldown(); + const result = await build({ // Entry points: array of virtual module names that the virtual plugin provides input: Array.from(codeMap.keys()), From e07fbb74d3d16bacc9d8233a1d1f31e76d6912be Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Wed, 18 Feb 2026 14:53:24 -0500 Subject: [PATCH 2/2] Update src/generators/web/utils/bundle.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/generators/web/utils/bundle.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/web/utils/bundle.mjs b/src/generators/web/utils/bundle.mjs index 28e0c516..541a5b12 100644 --- a/src/generators/web/utils/bundle.mjs +++ b/src/generators/web/utils/bundle.mjs @@ -14,7 +14,7 @@ const DOC_KIT_NODE_MODULES = join( '../../../../node_modules' ); -// TODO(@avivkeller): Untill we can use Rolldown's bindings in node-core, +// TODO(@avivkeller): Until we can use Rolldown's bindings in node-core, // we have to dynamically import it, as to not have it imported in core // at all. const rolldown = lazy(() => import('rolldown'));