Skip to content

feat(unplugin): new unplugin package. Run stencil code in most bundlers#6761

Open
johnjenkins wants to merge 1 commit into
v5from
v5-unplugin
Open

feat(unplugin): new unplugin package. Run stencil code in most bundlers#6761
johnjenkins wants to merge 1 commit into
v5from
v5-unplugin

Conversation

@johnjenkins

@johnjenkins johnjenkins commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What is the current behavior?

GitHub Issue Number: N/A

What is the new behavior?

Introduces @stencil/unplugin - a universal bundler plugin that lets you run Stencil code directly in Vite, Rollup, Webpack, esbuild, and Rspack projects without a full Stencil compiler / build pipeline.

Each .tsx component file is transpiled on-the-fly via transpileSync into a self-registering custom element. Only files containing Stencil decorators are transformed; everything else passes through untouched.

Key features:

  • Drop-in plugin for all major bundlers - one line of config
  • CSS pipeline with optional Sass, Less, PostCSS, and lightningcss support (peer deps, silently skipped if absent)
  • HMR support: Vite uses a WebSocket patch strategy; Webpack/Rspack use module.hot prototype patching
  • Optional docs: true mode exposes a Custom Elements Manifest via a virtual module (@stencil/unplugin/docs)

Quick usage (Vite):

// vite.config.ts
import { stencilVite } from '@stencil/unplugin';
export default defineConfig({ plugins: [stencilVite()] });

Quick usage (Webpack):

// webpack.config.js
const { stencilWebpack } = require('@stencil/unplugin');
module.exports = { plugins: [stencilWebpack()] };

Accessing the CEM (docs mode):

import cem from '@stencil/unplugin/docs';
console.log(cem.modules);

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@johnjenkins johnjenkins requested a review from a team as a code owner June 30, 2026 23:18
@johnjenkins johnjenkins changed the title feat(unplugin): new unplugin package. Makes stencil pluggable to most bundlers Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant