{"id":13774290,"url":"https://github.com/tehvgg/rollup-plugin-force-binding","last_synced_at":"2025-05-06T00:31:51.237Z","repository":{"id":96530752,"uuid":"81480971","full_name":"tehvgg/rollup-plugin-force-binding","owner":"tehvgg","description":"Force all import bindings for a module to come from one absolute source. Useful for bundles with multiple entry points that have shared dependencies at different absolute paths.","archived":false,"fork":false,"pushed_at":"2017-12-15T22:01:24.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T14:57:55.151Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tehvgg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-09T18:23:12.000Z","updated_at":"2020-08-09T10:04:17.000Z","dependencies_parsed_at":"2023-06-09T21:30:34.642Z","dependency_job_id":null,"html_url":"https://github.com/tehvgg/rollup-plugin-force-binding","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"a6bd7d3a868d4720c9ee680b7fdce05e69b8811a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tehvgg%2Frollup-plugin-force-binding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tehvgg%2Frollup-plugin-force-binding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tehvgg%2Frollup-plugin-force-binding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tehvgg%2Frollup-plugin-force-binding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tehvgg","download_url":"https://codeload.github.com/tehvgg/rollup-plugin-force-binding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252598433,"owners_count":21774256,"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-08-03T17:01:25.408Z","updated_at":"2025-05-06T00:31:50.982Z","avatar_url":"https://github.com/tehvgg.png","language":"JavaScript","readme":"# rollup-plugin-force-binding\n\nForce all import bindings for a module to come from one absolute source.\nUseful for bundles with [multiple entry points](https://github.com/rollup/rollup-plugin-multi-entry) that have shared dependencies at different absolute paths.\n\n```js\n// entry A\nimport SomeClass from 'some-dependency/src/SomeClass';\n// resolved path: ~\\path\\to\\A\\node_modules\\some-dependency\\src\\SomeClass\n\n// entry B\nimport SomeClass from 'some-dependency/src/SomeClass';\n// resolved path: ~\\path\\to\\B\\node_modules\\some-dependency\\src\\SomeClass\n\n// resulting in bundled duplicates\nvar SomeClass = (function () {})();\nvar EntryA = (function (_SomeClass) {})(SomeClass);\n\nvar SomeClass$2 = (function () {})();\nvar EntryB = (function (_SomeClass) {})(SomeClass$2);\n```\n\n## Install\n\n```\n$ npm i rollup-plugin-force-binding [--save-dev]\n```\n\n## Usage\n\nIf used in junction with [node-resolve](https://github.com/rollup/rollup-plugin-node-resolve), place force-binding BEFORE in the plugin array.\n\n```js\nimport forceBinding from 'rollup-plugin-force-binding';\n\nrollup.rollup({\n  plugins: [\n    forceBinding([\n      // regular module\n      'some-dependency',\n      // pathed module (some-dependency/src/Asset.js)\n      'Asset' // 'Asset.js' also valid\n    ])\n  ]\n});\n```\n\n## Caveat\nRollup's plugin model does not expose the import names, only the paths.\n```js\nimport { SomeClass, AnotherClass } from 'some-dependency';\n```\nAs such, the above code cannot be deduped. This is why you must path to the source file. I have submitted a [feature request](https://github.com/rollup/rollup/issues/1301) to expose import names.\n\n## License\n\nMIT\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftehvgg%2Frollup-plugin-force-binding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftehvgg%2Frollup-plugin-force-binding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftehvgg%2Frollup-plugin-force-binding/lists"}