{"id":26333,"library":"rollup-plugin-lit-transformer","title":"rollup-plugin-lit-transformer","description":"A Rollup plugin that transforms lit-html templates at build time using SWC (Speedy Web Compiler). Current stable version is 0.3.3, released in early 2023, with low release cadence (last update over a year ago). It optimizes LitElement and lit-html templates by inlining static parts, reducing runtime overhead and bundle size. Key differentiators: uses SWC for fast transformation, supports custom elements and web components. Alternative tools like @open-wc/building-rollup or @lit/context exist, but this plugin is specifically for Rollup and SWC integration.","status":"active","version":"0.3.3","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","swc","transpiler","lit","lit-element","custom-elements","web-components","typescript"],"install":[{"cmd":"npm install rollup-plugin-lit-transformer","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-lit-transformer","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-lit-transformer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"SWC transpiler for code transformation at build time","package":"@swc/core","optional":false},{"reason":"Lit library for which templates are transformed; must be present in project","package":"lit","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require() will not work unless dynamic import is used.","wrong":"const litTransformer = require('rollup-plugin-lit-transformer')","symbol":"default","correct":"import litTransformer from 'rollup-plugin-lit-transformer'"},{"note":"Default export, same as the plugin function.","symbol":"litTransformer","correct":"import litTransformer from 'rollup-plugin-lit-transformer'"},{"note":"TypeScript users should use `import type` for Options interface.","wrong":"import { Options } from 'rollup-plugin-lit-transformer' (value import, but it's a type)","symbol":"Plugin options (TypeScript)","correct":"import type { Options } from 'rollup-plugin-lit-transformer'"}],"quickstart":{"code":"// rollup.config.js\nimport litTransformer from 'rollup-plugin-lit-transformer';\nimport { swcPlugin } from 'rollup-plugin-swc3'; // or similar SWC plugin\n\nexport default {\n  input: 'src/index.js',\n  output: { dir: 'dist', format: 'es' },\n  plugins: [\n    litTransformer(), // must be before SWC or other transform plugins\n    swcPlugin({\n      jsc: {\n        parser: { syntax: 'typescript' },\n        transform: {}, // any transforms needed\n      }\n    })\n  ]\n};","lang":"javascript","description":"Shows basic Rollup config using litTransformer plugin with SWC for transforming Lit templates in a TypeScript project."},"warnings":[{"fix":"Switch to @lit/rollup-plugin-lit-html or @open-wc/building-rollup for better maintenance.","message":"Package has not been updated since early 2023; consider using official Lit build tools like @lit/rollup-plugin-lit-html.","severity":"deprecated","affected_versions":"all"},{"fix":"Order plugins: litTransformer() first, then transpilers (e.g., swcPlugin).","message":"Plugin must be placed before other transform plugins (like SWC) in the Rollup plugins array.","severity":"gotcha","affected_versions":"all"},{"fix":"Use default import `import litTransformer from 'rollup-plugin-lit-transformer'`.","message":"Breaking change: In version 0.3.0, the export changed from named to default. Previously used `import { litTransformer }` now throws.","severity":"breaking","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install @swc/core with `npm install @swc/core`.","cause":"Missing peer dependency @swc/core.","error":"Error: Cannot find module '@swc/core'"},{"fix":"Switch to ESM (use import) or dynamic import: `const litTransformer = (await import('rollup-plugin-lit-transformer')).default`.","cause":"Using require() on an ESM-only package.","error":"SyntaxError: Unexpected token 'export' (or import)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}