{"id":13496217,"url":"https://github.com/egoist/rollup-plugin-esbuild","last_synced_at":"2025-05-13T21:07:25.060Z","repository":{"id":38023267,"uuid":"262485912","full_name":"egoist/rollup-plugin-esbuild","owner":"egoist","description":"Use ESBuild with Rollup to transform ESNext and TypeScript code.","archived":false,"fork":false,"pushed_at":"2025-02-27T03:51:08.000Z","size":873,"stargazers_count":637,"open_issues_count":12,"forks_count":40,"subscribers_count":8,"default_branch":"dev","last_synced_at":"2025-04-28T13:59:40.168Z","etag":null,"topics":["esbuild","esnext","rollup","typescript"],"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/egoist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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},"funding":{"github":"egoist"}},"created_at":"2020-05-09T04:06:51.000Z","updated_at":"2025-04-04T07:58:42.000Z","dependencies_parsed_at":"2024-01-06T07:58:03.363Z","dependency_job_id":"a7e4a3e1-0f73-41d9-a61d-9cf718b70778","html_url":"https://github.com/egoist/rollup-plugin-esbuild","commit_stats":{"total_commits":273,"total_committers":33,"mean_commits":8.272727272727273,"dds":"0.41025641025641024","last_synced_commit":"bb2055fd28ed04fec85a6a208b6255af4ec00d50"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Frollup-plugin-esbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Frollup-plugin-esbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Frollup-plugin-esbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Frollup-plugin-esbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/rollup-plugin-esbuild/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254028815,"owners_count":22002279,"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":["esbuild","esnext","rollup","typescript"],"created_at":"2024-07-31T19:01:44.036Z","updated_at":"2025-05-13T21:07:25.017Z","avatar_url":"https://github.com/egoist.png","language":"TypeScript","funding_links":["https://github.com/sponsors/egoist","https://github.com/sponsors/egoist)."],"categories":["TypeScript","Bundle Tool","typescript","JavaScript Ecosystem"],"sub_categories":[],"readme":"**💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).**\n\n---\n\n# rollup-plugin-esbuild\n\n![npm version](https://badgen.net/npm/v/rollup-plugin-esbuild) ![npm downloads](https://badgen.net/npm/dm/rollup-plugin-esbuild)\n\n[esbuild](https://github.com/evanw/esbuild) is by far one of the fastest TS/ESNext to ES6 compilers and minifier, this plugin replaces `rollup-plugin-typescript2`, `@rollup/plugin-typescript` and `rollup-plugin-terser` for you.\n\n## Install\n\n```bash\nyarn add esbuild rollup-plugin-esbuild --dev\n```\n\n## Usage\n\nIn `rollup.config.js`:\n\n```js\nimport esbuild from 'rollup-plugin-esbuild'\n\nexport default {\n  plugins: [\n    esbuild({\n      // All options are optional\n      include: /\\.[jt]sx?$/, // default, inferred from `loaders` option\n      exclude: /node_modules/, // default\n      sourceMap: true, // default\n      minify: process.env.NODE_ENV === 'production',\n      target: 'es2017', // default, or 'es20XX', 'esnext'\n      jsx: 'transform', // default, or 'preserve'\n      jsxFactory: 'React.createElement',\n      jsxFragment: 'React.Fragment',\n      // Like @rollup/plugin-replace\n      define: {\n        __VERSION__: '\"x.y.z\"',\n      },\n      tsconfig: 'tsconfig.json', // default\n      // Add extra loaders\n      loaders: {\n        // Add .json files support\n        // require @rollup/plugin-commonjs\n        '.json': 'json',\n        // Enable JSX in .js files too\n        '.js': 'jsx',\n      },\n    }),\n  ],\n}\n```\n\n- `include` and `exclude` can be `String | RegExp | Array[...String|RegExp]`, when supplied it will override default values.\n- It uses `jsx`, `jsxDev`, `jsxFactory`, `jsxFragmentFactory` and `target` options from your `tsconfig.json` as default values.\n\n### Declaration File\n\nThere are serveral ways to generate declaration file:\n\n- Use `tsc` with `emitDeclarationOnly`, the slowest way but you get type checking, it doesn't bundle the `.d.ts` files.\n- Use [`rollup-plugin-dts`](https://github.com/Swatinem/rollup-plugin-dts) which generates and bundle `.d.ts`, also does type checking.\n- Use [`api-extractor`](https://api-extractor.com/) by Microsoft, looks quite complex to me so I didn't try it, PR welcome to update this section.\n\n### Use with Vue JSX\n\nUse this with [rollup-plugin-vue-jsx](https://github.com/xxholly32/rollup-plugin-vue-jsx):\n\n```js\nimport vueJsx from 'rollup-plugin-vue-jsx-compat'\nimport esbuild from 'rollup-plugin-esbuild'\n\nexport default {\n  // ...\n  plugins: [\n    vueJsx(),\n    esbuild({\n      jsxFactory: 'vueJsxCompat',\n    }),\n  ],\n}\n```\n\n### Standalone Minify Plugin\n\nIf you only want to use this plugin to minify your bundle:\n\n```js\nimport { minify } from 'rollup-plugin-esbuild'\n\nexport default {\n  plugins: [minify()],\n}\n```\n\n### Optimizing Deps\n\nYou can use this plugin to pre-bundle dependencies using esbuild and inline them in the Rollup-generated bundle:\n\n```js\nesbuild({\n  optimizeDeps: {\n    include: ['vue', 'vue-router'],\n  },\n})\n```\n\nThis eliminates the need of `@rollup/plugin-node-modules` and `@rollup/plugin-commonjs`.\n\nNote that this is an **experimental features**, breaking changes might happen across minor version bump.\n\nTODO: Maybe we can scan Rollup input files to get a list of deps to optimize automatically.\n\n## Sponsors\n\n[![sponsors](https://sponsors-images.egoist.sh/sponsors.svg)](https://github.com/sponsors/egoist)\n\n## License\n\nMIT \u0026copy; [EGOIST (Kevin Titor)](https://github.com/sponsors/egoist)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Frollup-plugin-esbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Frollup-plugin-esbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Frollup-plugin-esbuild/lists"}