{"id":16185489,"url":"https://github.com/patrickhulce/rollup-plugin-shim","last_synced_at":"2025-08-03T19:17:56.536Z","repository":{"id":41787041,"uuid":"97263536","full_name":"patrickhulce/rollup-plugin-shim","owner":"patrickhulce","description":"Plugin for rollup to provide a shim implementation for a module.","archived":false,"fork":false,"pushed_at":"2022-12-06T21:50:09.000Z","size":544,"stargazers_count":3,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T00:51:16.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/patrickhulce.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}},"created_at":"2017-07-14T18:46:37.000Z","updated_at":"2021-11-19T06:47:15.000Z","dependencies_parsed_at":"2023-01-23T13:00:38.349Z","dependency_job_id":null,"html_url":"https://github.com/patrickhulce/rollup-plugin-shim","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickhulce%2Frollup-plugin-shim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickhulce%2Frollup-plugin-shim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickhulce%2Frollup-plugin-shim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickhulce%2Frollup-plugin-shim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickhulce","download_url":"https://codeload.github.com/patrickhulce/rollup-plugin-shim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244350560,"owners_count":20439281,"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-10-10T07:14:26.649Z","updated_at":"2025-03-19T03:30:24.608Z","avatar_url":"https://github.com/patrickhulce.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-shim\n[![NPM Package](https://badge.fury.io/js/rollup-plugin-shim.svg)](https://www.npmjs.com/package/rollup-plugin-shim)\n[![Build Status](https://travis-ci.org/patrickhulce/rollup-plugin-shim.svg?branch=master)](https://travis-ci.org/patrickhulce/rollup-plugin-shim)\n[![Coverage Status](https://coveralls.io/repos/github/patrickhulce/rollup-plugin-shim/badge.svg?branch=master)](https://coveralls.io/github/patrickhulce/rollup-plugin-shim?branch=master)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Dependencies](https://david-dm.org/patrickhulce/rollup-plugin-shim.svg)](https://david-dm.org/patrickhulce/rollup-plugin-shim)\n\nPlugin for rollup to provide a shim implementation for a module. Replaces required dependencies with the specified string instead, especially useful for shimming small dev-time APIs with a big footprint you don't want in production (like [debug](https://www.npmjs.com/package/debug)). For larger fully functional implementations that you want to use a file for you might want to consider the [rollup-plugin-alias](https://www.npmjs.com/package/rollup-plugin-alias) package instead.\n\n## Usage\n\n### Install\n\n`yarn add -D rollup-plugin-shim`\n\n### Shim\n\n**src/main.js**\n\n```js\nimport {writeFileSync} from 'fs'\nimport debug from 'debug'\nimport {bigFunction} from './local-dep'\n\nconst log = debug('mypackage:main')\n// ...\n```\n\n**rollup.config.js**\n\n```js\nimport {join} from 'path'\nimport shim from 'rollup-plugin-shim'\n\nexport default {\n  entry: 'src/main.js',\n  plugins: [\n    shim({\n      // replace fs with a noop shim\n      fs: `export function writeFileSync() { }`,\n      // replace debug to return a noop function\n      debug: `export default () =\u003e () =\u003e undefined`,\n      // replace a local dependency with a noop\n      // can also use './local-dep' as the key if that's the only way it's required\n      [join(__dirname, 'src/local-dep')]: `export function bigFunction() { }`,\n    }),\n  ],\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickhulce%2Frollup-plugin-shim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickhulce%2Frollup-plugin-shim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickhulce%2Frollup-plugin-shim/lists"}