ProtectedcommandProtectedcoreProtectedevaluatorProtected ReadonlyformatProtectedmodelProtected ReadonlyoptionsProtectedoutputProtectedpolyfillsProtectedrootStatic ReadonlyREQUIRE_The line scripts/build-esm.ts adds to ESM files of Cell packages that call require.
ProtectedcomponentComponents of the project other than itself.
ProtectedexternalsProtectedhtmlProtectedsingle--single with a frontend and a backend: the frontend goes into the server bundle.
ProtectedbuildBuilds the targets of the project (the frontend first, as a single server embeds it), then writes the files around the bundles.
ProtectedconfigProtecteddevcell dev: the client environment serves the frontend with HMR, the server environment runs the
backend in a module runner. Cell packages go through the plugin in both (they must see the
generated container and configuration, and share one @celljs/core); other dependencies stay
in node_modules: pre-bundled for the browser, loaded by Node for the server.
A file of the public directory that is copied, not built (favicon, component assets); see OutputWriter.frontendFile.
ProtectedisProtectedisProtectedloadThe page of the frontend: the project's index.html or the built-in one, with the frontend configuration applied.
ProtectedresolveProtectedresolveProtectedresolveProtectedserverCommonJS dependencies inlined into an ES module bundle still reference the free __dirname and
__filename; point them at the bundle file, as a CommonJS bundle would.
StaticcommonCommonJS files of the project (generated clients like prisma's) cannot run as ES modules in the
module runner of cell dev. Node loads them instead, in the same process, and the module
re-exports what they export.
StaticimportHow the server bundle refers to its own location: import.meta on Node.js; fixed paths under
/bundle on workerd, which leaves import.meta.url undefined (createRequire then throws).
StaticisStaticwithCommonJS libraries bundled into the ESM server expect what a CommonJS server gives them: a
require in scope (prisma loads its engine with eval('require')) and require.main (app-root-path,
used by typeorm, reads require.main.filename). Expose the bundle's __require as require, with
the bundle itself as the main module.
Staticwithimport.meta.dirname / filename exist from Node.js 20.11; the Node.js of FC (20.10) and SCF (18)
lack them, so the bundle sets them from import.meta.url when they are missing.
StaticwithoutCell packages built as ES modules keep node-only require('x') calls working in Node through a
local const require = createRequire(import.meta.url). The bundler cannot see through that local
binding, so the required packages would stay outside the bundle and be missing next to it. Drop
the shim in the bundle: require('x') is then bundled like any other dependency.
StaticwithThe module runner of cell dev evaluates sources as ES modules, which have no require; the
bundler of cell build accepts require('x') next to import. Give TypeScript and JavaScript
sources outside node_modules that call require( a module-local one, as the ESM builds of
Cell packages have.
Turns the component graph into the DI container and configuration of each target and builds the
clientenvironment (frontend →<outDir>/public) and theserverenvironment (backend, one file →<outDir>/server). Exposed to Vite through cell.