{"id":21311680,"url":"https://github.com/georgwittberger/vite-plugin-entrypoints","last_synced_at":"2026-01-15T23:09:43.459Z","repository":{"id":65423327,"uuid":"591729821","full_name":"georgwittberger/vite-plugin-entrypoints","owner":"georgwittberger","description":"Vite plugin to generate additional entry points for files matching glob patterns","archived":false,"fork":false,"pushed_at":"2025-03-12T19:13:57.000Z","size":169,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T12:12:25.531Z","etag":null,"topics":["code-splitting","library","plugin","tree-shaking","vite"],"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/georgwittberger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-01-21T17:25:06.000Z","updated_at":"2025-03-22T18:56:33.000Z","dependencies_parsed_at":"2023-12-22T11:57:50.316Z","dependency_job_id":"67fbaa0b-d7ff-43d0-b008-d39bdff768f6","html_url":"https://github.com/georgwittberger/vite-plugin-entrypoints","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"0fadd9afa27df85b153f5b287c20826aa84f03a5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/georgwittberger/vite-plugin-entrypoints","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgwittberger%2Fvite-plugin-entrypoints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgwittberger%2Fvite-plugin-entrypoints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgwittberger%2Fvite-plugin-entrypoints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgwittberger%2Fvite-plugin-entrypoints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georgwittberger","download_url":"https://codeload.github.com/georgwittberger/vite-plugin-entrypoints/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgwittberger%2Fvite-plugin-entrypoints/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28473974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:27:41.514Z","status":"ssl_error","status_checked_at":"2026-01-15T21:54:47.910Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["code-splitting","library","plugin","tree-shaking","vite"],"created_at":"2024-11-21T17:19:18.656Z","updated_at":"2026-01-15T23:09:43.440Z","avatar_url":"https://github.com/georgwittberger.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-entrypoints\n\n[![GitHub Release Workflow Status](https://img.shields.io/github/actions/workflow/status/georgwittberger/vite-plugin-entrypoints/release.yml?branch=main)](https://github.com/georgwittberger/vite-plugin-entrypoints/actions/workflows/release.yml)\n[![npm Version](https://img.shields.io/npm/v/vite-plugin-entrypoints)](https://www.npmjs.com/package/vite-plugin-entrypoints)\n[![npm Downloads](https://img.shields.io/npm/dw/vite-plugin-entrypoints)](https://www.npmjs.com/package/vite-plugin-entrypoints)\n[![License](https://img.shields.io/github/license/georgwittberger/vite-plugin-entrypoints)](https://github.com/georgwittberger/vite-plugin-entrypoints?tab=MIT-1-ov-file#readme)\n[![GitHub Repo Stars](https://img.shields.io/github/stars/georgwittberger/vite-plugin-entrypoints?style=social)](https://github.com/georgwittberger/vite-plugin-entrypoints)\n\nVite plugin to generate additional entry points for files matching glob patterns.\n\n## Purpose\n\nModern JavaScript libraries should be built with tree-shaking and code splitting in mind. It allows applications to eliminate unused code, thus reducing the amount of JavaScript code sent to clients.\n\nFor a library which exposes a single main module it is important to split code exported from that module into separate chunks.\n\nAn example for tree-shakable library looks like this:\n\n```js\n// main.js (assuming this is the main module in package.json)\nexport { a } from './module-a';\nexport { b } from './module-b';\n\n// module-a.js\nexport const a = 'a';\n\n// module-b.js\nexport const b = 'b';\n```\n\nWhen building a library using [Vite library mode](https://vitejs.dev/guide/build.html#library-mode) the built distribution is usually one single JavaScript file. In order to create a tree-shakable output we have to apply one of the [code splitting techniques](https://rollupjs.org/guide/en/#code-splitting) supported by rollup.js.\n\nOne common practice is to define multiple entry points to force rollup.js to split code into chunks. In the example above we would not only define `main.js` as our single entry point but also `module-a.js` and `module-b.js`, even if their bundle output is never meant to be used directly by library consumers.\n\nIn a Vite configuration file it would look like this:\n\n```js\n// vite.config.js\nimport { resolve } from 'path';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  build: {\n    lib: {\n      entry: {\n        main: resolve(__dirname, 'main.js'),\n        'module-a': resolve(__dirname, 'module-a.js'),\n        'module-b': resolve(__dirname, 'module-b.js'),\n      },\n      name: 'MyLib',\n      fileName: 'my-lib',\n    },\n  },\n});\n```\n\nBut what if we have a huge library with lots of components or modules exported from the main entry point? It becomes annoying to list every relevant entry file into our Vite configuration file.\n\nThis plugin solves our problem by generating entry points for all files matching given glob patterns.\n\n## Installation\n\n```bash\n# npm\nnpm install vite-plugin-entrypoints --save-dev\n\n# Yarn\nyarn add vite-plugin-entrypoints --dev\n\n# pnpm\npnpm add vite-plugin-entrypoints --save-dev\n```\n\n## Usage\n\nImport the plugin in your Vite configuration file and add it to the `plugins` array.\n\n```js\nimport { resolve } from 'node:path';\nimport { defineConfig } from 'vite';\nimport entrypoints from 'vite-plugin-entrypoints';\n\nexport default defineConfig({\n  plugins: [\n    entrypoints({\n      entryFilePatterns: ['modules/**/*.js'],\n      // more optional settings\n    }),\n  ],\n  build: {\n    lib: {\n      entry: { main: resolve(__dirname, 'main.js') },\n    },\n  },\n});\n```\n\n\u003e **Important:** The value of the `entry` property in your `build.lib` options must be an object! Usage of just a string or an array is not supported yet.\n\n## Configuration\n\n| Option              | Type       | Required | Default                                  | Description                                                                                                                                                             |\n| ------------------- | ---------- | -------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `entryFilePatterns` | `string[]` | yes      | -                                        | Glob patterns to match entry files in base directory. A separate entry chunk is created for each matching file.\u003cbr/\u003eExample: `['modules/**/*.js']`                      |\n| `baseDir`           | `string`   | no       | `process.cwd()`                          | Base directory to resolve entry file patterns from. This path is stripped from entry file names.\u003cbr/\u003eExample: `'src'`                                                   |\n| `entryNameMapper`   | `function` | no       | Matched file name with extension removed | Mapping function to generate entry names for entry files. Receives matched file name as argument and must return new file name.\u003cbr/\u003eExample: `name =\u003e 'prefix/' + name` |\n\n## Contributing\n\n1. Fork this Git repository.\n2. Create a new feature/bugfix branch and make your changes.\n3. Add a changeset to your branch by running `pnpm changeset` and pick a suitable version increment for your change according to semantic versioning. Enter a brief description of your change.\n4. Create a pull request targeting our `main` branch.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgwittberger%2Fvite-plugin-entrypoints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgwittberger%2Fvite-plugin-entrypoints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgwittberger%2Fvite-plugin-entrypoints/lists"}