{"id":22523,"library":"unplugin-stencil","title":"unplugin-stencil","description":"An unplugin wrapper around the Stencil compiler for use with Vite, Webpack, Rollup, esbuild, Nuxt, and other build tools. Version 0.4.1 is the current stable release. It provides a unified plugin interface across multiple bundlers, enabling Stencil component compilation in non-Stencil projects. Key differentiators: supports source maps (since 0.4.0), serializes builds to prevent stale output, and works with Astro, rspack, and Vue CLI. Peer dependencies include @stencil/core ^4.29.3 and various build tool versions. Release cadence is irregular; latest fixes address process.exit in writeBundle and Windows path support.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/stencil-community/unplugin-stencil","tags":["javascript","unplugin","vite","webpack","rollup","transform","typescript"],"install":[{"cmd":"npm install unplugin-stencil","lang":"bash","label":"npm"},{"cmd":"yarn add unplugin-stencil","lang":"bash","label":"yarn"},{"cmd":"pnpm add unplugin-stencil","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for Stencil compilation","package":"@stencil/core","optional":false},{"reason":"Required when using Vite plugin (>=3)","package":"vite","optional":true},{"reason":"Required when using webpack plugin (^4 or ^5)","package":"webpack","optional":true},{"reason":"Required when using Rollup plugin (^3)","package":"rollup","optional":true},{"reason":"Required when using Nuxt module (^3)","package":"@nuxt/kit","optional":true},{"reason":"Required when using esbuild plugin","package":"esbuild","optional":true}],"imports":[{"note":"Must use subpath import for specific bundler (e.g., '/vite', '/rollup', '/webpack', '/esbuild').","wrong":"import stencil from 'unplugin-stencil'","symbol":"default (vite plugin)","correct":"import stencil from 'unplugin-stencil/vite'"},{"wrong":"const stencil = require('unplugin-stencil/rollup') (CJS works but TS may need esModuleInterop)","symbol":"default (rollup plugin)","correct":"import stencil from 'unplugin-stencil/rollup'"},{"wrong":"import stencil from 'unplugin-stencil/webpack' (if using ESM webpack config, use dynamic import)","symbol":"default (webpack plugin)","correct":"const stencil = require('unplugin-stencil/webpack')"},{"note":"Not a standard import; used as a module entry in nuxt.config.","wrong":"import stencil from 'unplugin-stencil/nuxt' (used as array in nuxt.config modules)","symbol":"Nuxt module","correct":"['unplugin-stencil/nuxt', { /* options */ }]"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport stencil from 'unplugin-stencil/vite';\n\nexport default defineConfig({\n  plugins: [\n    stencil({\n      // Stencil compiler options (e.g., src: 'src/components', namespace: 'my-lib')\n    }),\n  ],\n});","lang":"typescript","description":"Shows how to integrate unplugin-stencil with Vite using TypeScript. The plugin accepts Stencil compiler options as an argument."},"warnings":[{"fix":"Update any custom build logic to use `getLatestBuild` and adjust for event-driven queue pattern.","message":"In version 0.3.0, `ensureFreshBuild` was renamed to `getLatestBuild` and the build system switched to event-driven queue.","severity":"breaking","affected_versions":">=0.3.0 <0.3.0"},{"fix":"Migrate to Nuxt 3 if possible.","message":"Nuxt 2 support is deprecated and may be removed in future versions.","severity":"deprecated","affected_versions":">=0.2.9"},{"fix":"Upgrade to version 0.3.4 or later.","message":"On Windows, path transformations may fail before version 0.3.4. Ensure you use >=0.3.4 for Windows support.","severity":"gotcha","affected_versions":"<0.3.4"},{"fix":"Upgrade to 0.2.9 or later.","message":"In version 0.2.9, the ESM import issue with @stencil/core was fixed. Users on <0.2.9 may encounter ESM import errors.","severity":"breaking","affected_versions":"<0.2.9"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure you have installed the package: npm install unplugin-stencil and use import stencil from 'unplugin-stencil/vite'.","cause":"Incorrect import path; subpath '/vite' missing.","error":"Error: Cannot find module 'unplugin-stencil/vite'"},{"fix":"Use stencil({ options }) as a function call in your plugins array.","cause":"Importing default export without calling it as a function.","error":"TypeError: stencil is not a function"},{"fix":"Upgrade to 0.4.1 which fixes this issue.","cause":"Bug in version 0.4.0 where process.exit was called incorrectly.","error":"Error: process.exit is not a function in writeBundle hook (v0.4.0)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}