{"id":13495407,"url":"https://github.com/unplugin/unplugin-swc","last_synced_at":"2025-06-21T03:09:58.161Z","repository":{"id":38359866,"uuid":"427356416","full_name":"unplugin/unplugin-swc","owner":"unplugin","description":"SWC plugin for Vite and Rollup","archived":false,"fork":false,"pushed_at":"2025-06-17T15:44:14.000Z","size":1051,"stargazers_count":252,"open_issues_count":6,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T16:47:14.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unplugin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-12T12:43:30.000Z","updated_at":"2025-06-17T10:50:22.000Z","dependencies_parsed_at":"2024-03-31T15:24:01.941Z","dependency_job_id":"622b084f-dcf3-4d56-a47c-0e698f95b53a","html_url":"https://github.com/unplugin/unplugin-swc","commit_stats":null,"previous_names":["hannoeru/unplugin-swc","unplugin/unplugin-swc","egoist/unplugin-swc"],"tags_count":20,"template":false,"template_full_name":"egoist/ts-lib-starter","purl":"pkg:github/unplugin/unplugin-swc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-swc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-swc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-swc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-swc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unplugin","download_url":"https://codeload.github.com/unplugin/unplugin-swc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-swc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260647832,"owners_count":23041704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:34.399Z","updated_at":"2025-06-21T03:09:52.982Z","avatar_url":"https://github.com/unplugin.png","language":"TypeScript","readme":"# unplugin-swc\n\n[![npm version](https://badgen.net/npm/v/unplugin-swc)](https://npm.im/unplugin-swc)\n\n\u003e [SWC](https://swc.rs/) plugin for Vite and Rollup.\n\n## Install\n\n```bash\nnpm i unplugin-swc @swc/core -D\n```\n\n## Usage\n\nVite or Rollup:\n\n```ts\nimport swc from 'unplugin-swc'\n\nexport default {\n  plugins: [\n    // Vite plugin\n    swc.vite(),\n    // Rollup plugin\n    swc.rollup(),\n  ],\n}\n```\n\n### `tsconfig.json`\n\nFollowing SWC options are inferred from `tsconfig.json`:\n\n- `jsc.parser.syntax`: based on file extension\n- `jsc.parser.jsx`, `parser.tsx`: `compilerOptions.jsx`\n- `jsc.parser.decorators`: `compilerOptions.experimentalDecorators`\n- `jsc.transform.react.pragma`: `compilerOptions.jsxFactory`\n- `jsc.transform.react.pragmaFrag`: `compilerOptions.jsxFragmentFactory`\n- `jsc.transform.react.importSource`: `compilerOptions.jsxImportSource`\n- `jsc.transform.legacyDecorator`: `compilerOptions.experimentalDecorators`\n- `jsc.transform.decoratorMetadata`: `compilerOptions.emitDecoratorMetadata`\n- `jsc.keepClassNames`: when decorator is enabled, because original class name is required by libs like `type-graphql` to generate correct graphql type\n\nIf you wish to disable this behavior and use `.swcrc` to control above `jsc` options, you can use `tsconfigFile` option:\n\n```ts\n// Or swc.rollup\nswc.vite({\n  tsconfigFile: false,\n})\n\n// It's also possible to use a custom tsconfig file instead of tsconfig.json\nswc.vite({\n  tsconfigFile: './tsconfig.build.json',\n})\n```\n\n### Minification\n\nUse the `minify: true` option, it only works for Rollup as Vite uses esbuild to minify the code and cannot be changed.\n\nTo have advanced control over the minification process, [use `jsc.minify` option in `.swcrc`](https://swc.rs/docs/configuration/minification).\n\n### Vite\n\n`esbuild` will be automatically disabled if you use this plugin.\n\n## Options\n\nThis plugin accepts all `@swc/core` options, except for `jsc` which should be configured in `.swcrc` instead, and some extra options that are specific to this plugin:\n\n### `options.tsconfigFile`\n\n- Type: `boolean`, `string`\n- Default: `tsconfig.json`\n\nDisable the use of tsconfig file or specify a custom one.\n\n### `options.include`\n\n- Type: `RegExp`\n- Default: `/\\.[jt]sx?$/`\n\nFiles to include in the transpilation process.\n\n### `options.exclude`\n\n- Type: `RegExp`\n- Default: `/node_modules/`\n\nFiles to exclude in the transpilation process.\n\n### `options.jsc`\n\n- Type: `object`\n\nCustom [jsc](https://swc.rs/docs/configuration/compilation) options to merge with the default one.\n\n## License\n\nMIT \u0026copy; [EGOIST](https://github.com/sponsors/egoist)\n","funding_links":["https://github.com/sponsors/egoist"],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funplugin%2Funplugin-swc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funplugin%2Funplugin-swc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funplugin%2Funplugin-swc/lists"}