{"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,"search_vec":"'/building-rollup':79 '0.3.3':27 '2023':31 'ago':41 'altern':73 'build':16 'bundl':58 'cadenc':35 'compil':22 'compon':72,105 'current':23 'custom':68,101 'custom-el':100 'differenti':61 'earli':30 'element':69,99,102 'exist':82 'fast':65 'html':13,48 'inlin':51 'integr':92 'javascript':93 'key':60 'last':36 'like':75 'lit':4,12,47,96,98 'lit-el':97 'lit-html':11,46 'lit/context':81 'litel':44 'low':33 'open':77 'open-wc':76 'optim':43 'overhead':56 'part':53 'plugin':3,8,85 'reduc':54 'releas':28,34 'rollup':2,7,89 'rollup-plugin-lit-transform':1 'runtim':55 'size':59 'specif':87 'speedi':20 'stabl':24 'static':52 'support':67 'swc':19,63,91,94 'templat':14,49 'time':17 'tool':74 'transform':5,10,66 'transpil':95 'typescript':106 'updat':37 'use':18,62 'version':25 'wc':78 'web':21,71,104 'web-compon':103 'year':40","created_at":"2026-05-01T13:49:26.395848+00:00","updated_at":"2026-05-01T13:49:26.395848+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-lit-transformer","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}