{"id":15641735,"url":"https://github.com/trygve-lie/rollup-plugin-esm-http-resolver","last_synced_at":"2025-04-30T09:13:02.537Z","repository":{"id":44917549,"uuid":"193867561","full_name":"trygve-lie/rollup-plugin-esm-http-resolver","owner":"trygve-lie","description":"Rollup plugin for resolving ES modules over http(s) like a browser does.","archived":false,"fork":false,"pushed_at":"2022-08-01T08:48:03.000Z","size":104,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T09:12:56.962Z","etag":null,"topics":["esm","esmodules","http","javascript","resolver","rollup","rollup-plugin"],"latest_commit_sha":null,"homepage":"","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/trygve-lie.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":"2019-06-26T08:54:57.000Z","updated_at":"2022-11-27T19:20:47.000Z","dependencies_parsed_at":"2022-09-26T21:40:21.535Z","dependency_job_id":null,"html_url":"https://github.com/trygve-lie/rollup-plugin-esm-http-resolver","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Frollup-plugin-esm-http-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Frollup-plugin-esm-http-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Frollup-plugin-esm-http-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Frollup-plugin-esm-http-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trygve-lie","download_url":"https://codeload.github.com/trygve-lie/rollup-plugin-esm-http-resolver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251674585,"owners_count":21625645,"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":["esm","esmodules","http","javascript","resolver","rollup","rollup-plugin"],"created_at":"2024-10-03T11:44:57.402Z","updated_at":"2025-04-30T09:13:02.512Z","avatar_url":"https://github.com/trygve-lie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-esm-http-resolver\n\nRollup plugin for resolving ES modules over http(s).\n\n[![Dependencies](https://img.shields.io/david/trygve-lie/rollup-plugin-esm-http-resolver.svg?style=flat-square)](https://david-dm.org/trygve-lie/rollup-plugin-esm-http-resolver)\n[![Build Status](http://img.shields.io/travis/trygve-lie/rollup-plugin-esm-http-resolver/master.svg?style=flat-square)](https://travis-ci.org/trygve-lie/rollup-plugin-esm-http-resolver)\n[![Known Vulnerabilities](https://snyk.io/test/github/trygve-lie/rollup-plugin-esm-http-resolver/badge.svg?targetFile=package.json\u0026style=flat-square)](https://snyk.io/test/github/trygve-lie/rollup-plugin-esm-http-resolver?targetFile=package.json) [![Greenkeeper badge](https://badges.greenkeeper.io/trygve-lie/rollup-plugin-esm-http-resolver.svg)](https://greenkeeper.io/)\n\n## Installation\n\n```bash\n$ npm install rollup-plugin-esm-http-resolver\n```\n\n## Usage\n\n```js\nimport esmHttpResolver from 'rollup-plugin-esm-http-resolver';\n\nexport default {\n    input: 'http://localhost:9000/assets/main.js',\n    plugins: [esmHttpResolver({\n        timeout: 5000,\n    })],\n    output: {\n        file: 'build.js',\n        format: 'cjs'\n    }\n};\n```\n\n## Description\n\nThis module can resolve ES modules from a http endpoint. It will more or less\nload ES modules the same way as a browser will resolve them.\n\nLets say one have the following structure of ES modules on a http server:\n\n```sh\n/assets/utils/parse.js\n/assets/modules/module-a.js\n/assets/modules/module-b.js\n/assets/main.js\n```\n\nBoth `modules/module-a.js` and `modules/module-b.js` imports `utils/parse.js`\nand `/assets/main.js` is the main file importing `modules/module-a.js` and\n`modules/module-b.js`.\n\nOne can now simply make a bundle out of these by passing the URL to\nthe main file (`http://cdn.mysite.com/assets/main.js`) to Rollups\n`input` property.\n\nThis module will then resolve the relative imports and request each module\nfrom the http server.\n\nThis module will only load ES modules.\n\n### Caching\n\nIn the above example both `modules/module-a.js` and `modules/module-b.js`\nimports `utils/parse.js`. This module will cache the first request to\n`utils/parse.js` when its resolve in `modules/module-a.js` and when\n`modules/module-b.js` resolves it, it will be read from cache.\n\n## Options\n\nThis plugin take the following options:\n\n| option             | default  | type      | required | details                                                                                                  |\n| ------------------ | -------- | --------- | -------- | -------------------------------------------------------------------------------------------------------- |\n| ignoreContentType  | `false`  | `boolean` | `false`  | Ignore checking content type of each requested file.                                                     |\n| ignoreStatus       | `false`  | `boolean` | `false`  | Ignore checking the http status code of each requested file. If false, only http status 200 is loaded.   |\n| timeout            | `10000`  | `number`  | `false`  | How long, in millisecondsm before a request to a file should be canceled if the server does not respond. |\n| follow             | `10`     | `number`  | `false`  | How many redirects jumps a request to a file should follow before canceling the request.                 |\n\n\n## License\n\nCopyright (c) 2019 Trygve Lie\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrygve-lie%2Frollup-plugin-esm-http-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrygve-lie%2Frollup-plugin-esm-http-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrygve-lie%2Frollup-plugin-esm-http-resolver/lists"}