Stencil 5 RC adds signals and cross-runtime SSR
Published
Ionic published the Stencil 5 Release Candidate on 2026-11-30. The release candidate brings a new CLI and bundler. It adds CSS-only components and signals, together with reactive controllers. Server rendering also changes. Vitest and Playwright move into separate packages. The documentation gains browser playgrounds (Ionic, 2026-11-30).
Stencil remains a compiler that accepts TypeScript and JSX and emits standard custom elements. Its extracted component metadata can drive lazy-loading and cherry-picking bundles. It also feeds server-rendering output and documentation for IDEs and agents. The same metadata produces JSON manifests and framework wrappers (Ionic, 2026-11-30).
A CLI for creating and extending projects
Section titled “A CLI for creating and extending projects”stencil init now scaffolds a project through prompts for output targets and a React/Vue/Angular integration. It also asks for a test runner and CSS preprocessor. The command then installs and configures the selected choices. This makes the requested project shape an explicit input to generation (Ionic, 2026-11-30).
Run the initializer in a directory where you want the new project (Ionic, 2026-11-30):
npx stencil initThe expected observation is an interactive wizard containing the choices named by the announcement. Complete the prompts, then inspect the installed packages and generated configuration. Verify the selected framework integration and test runner. Check the preprocessor and output targets too (Ionic, 2026-11-30).
stencil add handles a later addition. Ionic says it shows the same choices as init and works with packages that ship their own setup wizard. Its example installs the Stencil Vitest integration, guides the reader through the package’s wizard, and writes the configuration (Ionic, 2026-11-30):
npx stencil add @stencil/vitestThe expected result is a dependency entry plus a working @stencil/vitest configuration. If the wizard does not complete, return to the project state before the partial addition and rerun it after resolving the reported package or environment error; the announcement assigns both installation and configuration to this command (Ionic, 2026-11-30).
Component forms and styling
Section titled “Component forms and styling”Stencil 5 documents four component archetypes. They cover CSS-only and progressively enhanced components as well as custom elements using light DOM or shadow DOM. A CSS-only component begins with a /** @component */ comment on a rule; Stencil includes it in JSX types and generated documentation and ships its CSS with global styles, but does not register it as a custom element or load a JavaScript runtime for it (Ionic, 2026-11-30).
JavaScript components move encapsulation settings into an encapsulation object. The announcement shows 'shadow' and 'scoped' as type values; 'none' is the third. Omitting the object renders into light DOM with no encapsulation, while components without shadow DOM can still receive slots (Ionic, 2026-11-30).
The component definition also gains globalStyle and globalStyleUrl. Ionic’s example uses local style for component internals and globalStyle for rules that apply to the component or its contents before load. The post connects that earlier styling to FOUC and CLS. It also links the behavior to progressive enhancement (Ionic, 2026-11-30).
Global styles have a global-style output target, with multiple outputs allowed and an inject option controlling whether each output is added to shadow-DOM components. Importing stencil-hydrate into a global stylesheet asks Stencil to write its FOUC-prevention CSS at build time instead of having the loader inject a runtime style element (Ionic, 2026-11-30).
Signals and reactive controllers
Section titled “Signals and reactive controllers”Stencil 5 includes Preact Signals through @stencil/core/signals. A signal can hold a value outside a single component so several components share it. When JSX contains a signal, Stencil updates the corresponding text node when its value changes without rendering the component again (Ionic, 2026-11-30; Stencil Signals documentation).
The announcement’s smallest shared signal has this shape (Ionic, 2026-11-30):
import { signal } from '@stencil/core/signals';
export const count = signal(0);A component imports count and renders it inside a button. The click handler increments count.value. The displayed value should change while Stencil updates only that text node and skips a component rerender, as described in the example (Ionic, 2026-11-30).
@Effect() runs a method again when a signal read by that method changes. A separate signalBacking configuration stores each @Prop() and @State() in a signal. Ionic says this makes component props subscribable outside the component. Other components and Preact Signals code can react without listening for events or watching attributes; frameworks can do the same (Ionic, 2026-11-30).
Reactive controllers receive a host integration through ReactiveControllerHost. A component mixes in that host and adds controller objects. Their hooks include hostConnected and hostWillRender; hostDidUpdate is also available. The example controller subscribes to mousemove on connection and removes the listener on disconnection. It requests a host update after changing its position state (Ionic, 2026-11-30).
Server rendering across runtimes
Section titled “Server rendering across runtimes”The former dist-hydrate-script output target is named ssr in Stencil 5. Ionic links example setups for Next.js and React Router; TanStack Start and Nuxt; SvelteKit and SolidStart; Astro and Angular; and Eleventy. These give component-library authors concrete integrations to inspect (Ionic, 2026-11-30; Stencil rendering strategies).
Streaming SSR uses streamToString(), which returns a web-standard ReadableStream. Ionic says this permits the stream to run in Node.js and Cloudflare Workers as well as Deno and Bun. The post also names other edge runtimes. The standard stream contract provides that portability. It is independent of a framework-specific response object (Ionic, 2026-11-30).
The release candidate also introduces an experimental ssr-wasm output target. It compiles the server renderer to WebAssembly so a PHP/Java/Go/.NET server or another non-Node.js server can render the components. Ionic labels the target experimental and links a separate examples repository (Ionic, 2026-11-30).
Testing and build internals
Section titled “Testing and build internals”Stencil no longer includes the built-in stencil test --spec and --e2e runner based on Jest and Puppeteer. @stencil/vitest handles unit and component testing in Node.js or real browsers, while @stencil/playwright handles end-to-end tests across browsers. Both packages have migration guides, and existing newSpecPage() tests can remain during migration (Ionic, 2026-11-30).
Ionic reports builds around 1.5 to 2 times faster than Stencil 4 and links its benchmarks. Stencil 5 replaces Rollup with Rolldown. The related configuration names change from rollupConfig and rollupPlugins to rolldownConfig and rolldownPlugins. Lightning CSS takes over CSS autoprefixing and minification, while OXC minifies JavaScript by default and jsMinifier: 'terser' retains Terser (Ionic, 2026-11-30).
Stencil now uses the project’s TypeScript 5.x or 6.x instead of shipping its own copy. Its packages are pure ESM. The loader-bundle and ssr outputs no longer generate CommonJS by default. Output target names also change. dist becomes loader-bundle, and dist-custom-elements becomes standalone. The former dist-hydrate-script name becomes ssr (Ionic, 2026-11-30).
Migrating a Stencil 4 project
Section titled “Migrating a Stencil 4 project”Start from the latest Stencil 4 version, then install the release candidate and inspect the proposed edits (Ionic, 2026-11-30):
npm install @stencil/core@rc --save-devnpx stencil migrate --dry-run--dry-run shows what the migration would change. Remove that option only after reviewing the output and committing or otherwise preserving the current project state. Ionic says most configuration and decorator changes are automatic, while its upgrade guide and breaking-change list cover the remaining work (Ionic, 2026-11-30).
Run the migration after that review (Ionic, 2026-11-30):
npx stencil migrateThe migration requires Node.js 22 or later. Confirm the runtime with node --version before changing the project. Stencil 5’s browser floor is ES2022. The listed minimums are Chrome and Edge 94 or later; Firefox 93 or later; and Safari 16.4 or later (Ionic, 2026-11-30).
The breaking changes include HTML boolean semantics: <my-cmp disabled="false"> now makes disabled true, so remove the attribute to represent false. TypeScript 6 rejects "moduleResolution": "node" and enables strict mode when Stencil installs TypeScript because a project has not pinned 5.x. CommonJS require('@stencil/core/...') no longer works because the packages are ESM-only (Ionic, 2026-11-30).
If migration blocks the application, restore the preserved Stencil 4 project and rerun npx stencil migrate --dry-run. Address the reported item against the upgrade guide before applying it again. This recovery loop keeps the dry run and automated migrator together with the source’s documented manual guidance (Ionic, 2026-11-30).
Impact on component-library releases
Section titled “Impact on component-library releases”Stencil 5 changes both generated artifacts and the tools surrounding them. Library maintainers need to identify renamed output targets and ESM consumers. They must also identify the selected testing packages and browser floor before publishing an RC-based build. An application consuming custom elements can then test the actual output it uses; the new CLI is only one migration surface (Ionic, 2026-11-30).
The release candidate also broadens the ways consumers can use one component source. Framework types cover React 19 and Vue; Solid and Svelte; Preact and Astro. @stencil/unplugin compiles Stencil components inside Vite or webpack and inside Rspack or Rollup. It also supports esbuild. Server outputs cover JavaScript runtimes plus the experimental WebAssembly route (Ionic, 2026-11-30).
Related entries
Section titled “Related entries”- Workbox: follow this entry for Workbox modules and service-worker build tooling.
- Debugging service workers: follow this entry for inspecting and updating a service worker, including bypass steps.
- Lighthouse: follow this entry for Lighthouse audits and interpreting their results.
Open and unverified
Section titled “Open and unverified”- Which benchmark hardware and project shape reproduce the reported build-speed range remains open.
- When the final Stencil 5 release will ship remains open.
- Whether the release candidate’s package and output contracts will remain unchanged in the final release remains open.
- What threshold will mark the experimental
ssr-wasmtarget as production-stable remains open. - What bundle-size changes result from the new bundler and minifiers remains an open measurement question.
- What browser-by-browser results apply to every new component archetype remains open.
Sources
Section titled “Sources”- Community Spotlight: Stencil 5 Release Candidate (Ionic)
- Signals (Stencil Documentation)
- Rendering strategies (Stencil Documentation)