solidjs/solid
Getting started
This page is for people who want to build, test, and hack on solidjs/solid itself. If you want to build an app with Solid, the official docs at https://docs.solidjs.com are the better starting point.
Prerequisites
- Node.js: the version pinned in
.nvmrc(currently22).nvm usereads it automatically. - pnpm: this repository uses pnpm workspaces. The exact version is pinned in
package.jsonvia"packageManager": "pnpm@9.15.0".corepack enableis the supported way to get it (CONTRIBUTING.md):corepack enable - A POSIX-ish shell. The build chains npm scripts via
npm-run-alland usesrimraf,ncp,symlink-dir, etc. — no platform-specific tooling beyond Node.
The root package.json enforces pnpm via "preinstall": "npx only-allow pnpm", so attempts to run npm install or yarn will abort.
Install
From the repo root:
pnpm installThis installs all workspace dependencies (pnpm-workspace.yaml declares packages/*) and runs simple-git-hooks to wire up the pre-commit hook that formats staged files with Prettier (see package.json).
Build
pnpm buildThe root script delegates to turbo run build, which walks the topologically-sorted package graph defined in turbo.json:
solid-js#buildruns Rollup usingpackages/solid/rollup.config.js. This emits bundles for each entry point (solid-js,solid-js/web,solid-js/store,solid-js/web/storage,solid-js/h,solid-js/html,solid-js/universal) in three flavors (browser, dev, server) intodist/,web/dist/,store/dist/, etc.solid-js#typesthen runstscfor each entry point and copies handwritten JSX type definitions out of thedom-expressionspackage.solid-element#builddepends onsolid-js#typesandsolid-js#linkso thatsolid-elementcan resolvesolid-jstypes.
To rebuild a single package:
pnpm --filter solid-js build
pnpm --filter solid-element buildRun the test suite
pnpm testThis delegates to turbo run test test-types. Each package defines its own test script:
packages/solid/package.jsonrunsvitest run(config inpackages/solid/vite.config.mjs). The vitest setup usesjsdomand resolvessolid-js,solid-js/web, and therxcorealias to the in-repo source so that tests exercisesrc/, not the builtdist/.packages/solid/test-typesrunstsc --project tsconfig.test.jsonontest/*.type-tests.tsfiles (seepackages/solid/test/signals.type-tests.ts,component.type-tests.ts,resource.type-tests.ts).packages/babel-preset-solidruns a tinynode test.jsthat snapshots Babel output (packages/babel-preset-solid/test.js).packages/test-integrationrunsnode test-imports.mjsagainst the freshly builtdist/(packages/test-integration/test-imports.mjs).
To run a single suite while iterating:
cd packages/solid && pnpm test signals.spec.tsFor a coverage report:
pnpm coverageThis runs vitest run --coverage per package. Coverage thresholds and includes are configured in packages/solid/vite.config.mjs.
Format
Prettier is the formatter; the config lives in .prettierrc. To format the entire repo:
pnpm formatThe pre-commit hook installed by simple-git-hooks runs this automatically on staged JS/TS files.
Run the SSR examples
packages/solid-ssr/ ships four example servers (async, ssr, ssg, stream). After pnpm build:
cd packages/solid-ssr
pnpm build:example:ssr && pnpm start:example:ssr # synchronous SSR
pnpm build:example:async && pnpm start:example:async # async SSR
pnpm build:example:stream && pnpm start:example:stream # streaming SSR
pnpm build:example:ssg && pnpm start:example:ssg # static-site generationEach example serves on http://localhost:8080. They share packages/solid-ssr/examples/shared/ and differ only in the rollup config / server entry. See packages/solid-ssr/README.md for the comparison table.
Link a local Solid into another project
The solid-js#link script (packages/solid/package.json) creates node_modules/solid-js as a symlink to the package root using symlink-dir, which is what every other package in the workspace consumes. To use this build in an external app:
cd packages/solid
pnpm link
# then in your other repo:
pnpm link --global solid-jsFor the file layout and what each package contains, jump to Packages.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.