An esbuild plugin that transforms styled-components during bundling, supporting SSR, minification, display name generation, and file name tracking. Version 3.0.1 is the latest stable release, actively maintained on GitHub. It wraps the styled-components babel plugin for esbuild, offering options like ssr, displayName, fileName, minify, transpileTemplateLiterals, and pure. Differentiators include native esbuild integration for faster builds compared to Babel-only workflows, and seamless TypeScript support with type definitions.
npm install esbuild-plugin-styled-componentsVerified import paths — ran on the pinned version, not inferred.
Bundles a TypeScript entry point with esbuild and styled-components transformation for SSR, display names, file names, and minification.
Use import syntax or upgrade to Node >=12.22, >=14.17, or >=16.0. For CommonJS, use dynamic import: const plugin = (await import('esbuild-plugin-styled-components')).default;Avoid using 'pure' option; it is no longer recommended.
Ensure styled-components template literals are valid CSS after preprocessing; use separate build steps if needed.
Set the filter option to '\.[tj]sx?$' to only process JavaScript/TypeScript files.
Remove the option from your plugin configuration.
Run 'npm install -D esbuild-plugin-styled-components' and ensure import path is correct.
Use default import: import styledComponentsPlugin from 'esbuild-plugin-styled-components'.
Remove the 'pure' option from your plugin configuration.
Use dynamic import: const plugin = (await import('esbuild-plugin-styled-components')).default;Disable fileName: true or use a custom namespace to avoid conflicts.