{"id":13533104,"url":"https://github.com/solidjs-community/rollup-preset-solid","last_synced_at":"2025-07-27T06:15:36.117Z","repository":{"id":39616684,"uuid":"347483914","full_name":"solidjs-community/rollup-preset-solid","owner":"solidjs-community","description":"A small opinionated preset for rollup to bundle your solid libraries with rollup.","archived":false,"fork":false,"pushed_at":"2025-02-10T21:17:33.000Z","size":117,"stargazers_count":41,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-17T21:55:50.669Z","etag":null,"topics":["preset","rollup","solid-js"],"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/solidjs-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-03-13T21:35:40.000Z","updated_at":"2025-07-03T03:50:10.000Z","dependencies_parsed_at":"2024-04-17T17:24:03.542Z","dependency_job_id":"29827716-1b83-4a7e-a0b2-0c8ca7138a86","html_url":"https://github.com/solidjs-community/rollup-preset-solid","commit_stats":{"total_commits":37,"total_committers":5,"mean_commits":7.4,"dds":0.1351351351351351,"last_synced_commit":"8444ac1b6c16ca1dd7082e3da226d997bfe1c249"},"previous_names":["amoutonbrady/rollup-preset-solid"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/solidjs-community/rollup-preset-solid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidjs-community%2Frollup-preset-solid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidjs-community%2Frollup-preset-solid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidjs-community%2Frollup-preset-solid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidjs-community%2Frollup-preset-solid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidjs-community","download_url":"https://codeload.github.com/solidjs-community/rollup-preset-solid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidjs-community%2Frollup-preset-solid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267206643,"owners_count":24052770,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["preset","rollup","solid-js"],"created_at":"2024-08-01T07:01:16.582Z","updated_at":"2025-07-27T06:15:36.074Z","avatar_url":"https://github.com/solidjs-community.png","language":"TypeScript","funding_links":[],"categories":["📦 Components \u0026 Libraries"],"sub_categories":["DX"],"readme":"\u003cp\u003e\n  \u003cimg width=\"100%\" src=\"https://assets.solidjs.com/banner?type=Rollup%20Preset\u0026background=tiles\u0026project=%20\" alt=\"Solid Rollup Preset\"\u003e\n\u003c/p\u003e\n\n# Solid Rollup Preset\n\nA small opinionated preset for rollup to bundle your [solid](https://github.com/ryansolid/solid) libraries with rollup.\n\nFeatures out of the box:\n\n- Automatic TypeScript\n- Minimal - two lines config\n- No lock-in - you are in total control of the rollup config\n- Best practices for publishing solid libraries by compiling for `esm`, `cjs`, `jsx`, `umd` and `tsc`\n- Automatically clean `dist` folder on build\n\n## Usage\n\n1. Install with your favorite package manager:\n\n```sh\nnpm install -D rollup-preset-solid rollup\npnpm add -D rollup-preset-solid rollup\nyarn add -D rollup-preset-solid rollup\n```\n\n2. Import `withConfig` in your `rollup.config.js`. The first and only argument is (optionally) your rollup config:\n\n```js\n// rollup.config.js\nimport withSolid from \"rollup-preset-solid\";\n\nexport default withSolid();\n```\n\n3. Configure your package.json\n\n```json\n{\n  \"name\": \"my-lib\",\n\n  \"// This is optional but this remove the need to manually configure the source input for rollup\": \"\",\n  \"source\": \"src/my-lib.tsx\",\n\n  \"// All the following properties will be hinted during build\": \"\",\n  \"// You will just have to copy paste them\": \"\",\n\n  \"main\": \"dist/cjs/my-lib.js\",\n  \"module\": \"dist/esm/my-lib.js\",\n  \"types\": \"dist/types/my-lib.d.ts\",\n  \"files\": [\"dist\"],\n  \"exports\": {\n    \".\": {\n      \"solid\": \"./dist/source/my-lib.jsx\",\n      \"import\": \"./dist/esm/my-lib.js\",\n      \"browser\": \"./dist/esm/my-lib.js\",\n      \"require\": \"./dist/cjs/my-lib.js\",\n      \"node\": \"./dist/cjs/my-lib.js\"\n    }\n  }\n}\n```\n\n## API\n\n### withSolid(options?: Options | Options[]): RollupOptions | RollupOptions[]\n\nThe default export. A wrapper function that accepts all of the rollup options and a few extra to configure what to generate.\n\n### Options\n\nThe options are the exact same as Rollup with a few extra that are\nspecific to the wrapper\n\n#### Interface\n\n```ts\ninterface Options extends RollupOptions {\n  /**\n   * Defines which target you want\n   * @default ['esm']\n   */\n  targets?: ModuleFormat[];\n  /**\n   * Whether to generate a package.json or not\n   * This is useful for sub packages\n   * @default false\n   */\n  writePackageJson?: boolean;\n  /**\n   * Whether to hint what to put in your package.json or not\n   * @default false\n   */\n  printInstructions?: boolean;\n}\n```\n\n#### Example\n\n```js\n// rollup.config.js\nimport withSolid from \"rollup-preset-solid\";\n\nexport default withSolid([\n  { input: \"browser.ts\", targets: [\"esm\"] },\n  { input: \"server.ts\", targets: [\"esm\", \"cjs\"], writePackageJson: true },\n]);\n```\n\n#### IIFE Builds\n\nWhen building with the IIFE format, the preset marks certain Solid packages (such as `\"solid-js\"`, `\"solid-js/web\"`, and `\"solid-js/store\"`) as external by default. This means they are not bundled into your output and instead are expected to be provided as globals. You have two options:\n\n1. **Bundle the Solid Modules**  \n   Override the external list so that these modules are included in your IIFE bundle. For example:\n\n   ```js\n   // rollup.config.js\n   import withSolid from \"rollup-preset-solid\";\n\n   export default withSolid({\n     input: \"App.tsx\",\n     external: [], // Override default externals to bundle everything\n     output: {\n       dir: \"dist\",\n       format: \"iife\",\n       sourcemap: false,\n     },\n   });\n   ```\n\n2. **Provide Global Mappings**  \n   Keep the modules external and specify globals by using the `globals` option. For example:\n\n   ```js\n   // rollup.config.js\n   import withSolid from \"rollup-preset-solid\";\n\n   export default withSolid({\n     input: \"App.tsx\",\n     output: {\n       dir: \"dist\",\n       format: \"iife\",\n       sourcemap: false,\n       globals: {\n         \"solid-js/web\": \"SolidWeb\",\n         // add mappings for \"solid-js\" and \"solid-js/store\" if needed\n       },\n     },\n   });\n   ```\n\nInternally the preset adds these packages to the default `external` array by reading your package's dependencies and peerDependencies. For IIFE builds you must either bundle them or provide the expected globals. This ensures that your browser bundle works as intended.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidjs-community%2Frollup-preset-solid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidjs-community%2Frollup-preset-solid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidjs-community%2Frollup-preset-solid/lists"}