{"id":21144322,"url":"https://github.com/gilbert/rollup-endpoint","last_synced_at":"2025-10-26T13:06:11.734Z","repository":{"id":136581411,"uuid":"66106099","full_name":"gilbert/rollup-endpoint","owner":"gilbert","description":"The easiest way to serve a rollup bundle.","archived":false,"fork":false,"pushed_at":"2016-10-31T17:04:35.000Z","size":7,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-11T21:53:08.603Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gilbert.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-19T19:07:49.000Z","updated_at":"2021-10-11T21:01:36.000Z","dependencies_parsed_at":"2023-04-11T18:53:03.526Z","dependency_job_id":null,"html_url":"https://github.com/gilbert/rollup-endpoint","commit_stats":null,"previous_names":["mindeavor/rollup-endpoint"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbert%2Frollup-endpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbert%2Frollup-endpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbert%2Frollup-endpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbert%2Frollup-endpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilbert","download_url":"https://codeload.github.com/gilbert/rollup-endpoint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225489435,"owners_count":17482378,"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-11-20T08:16:53.862Z","updated_at":"2025-10-26T13:06:11.672Z","avatar_url":"https://github.com/gilbert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-endpoint\n\nEasily serve a JavaScript bundle – bundled with [rollup.js](http://rollupjs.org/) – from an express.js endpoint. No grunt/gulp, no build files, no required configuration – just pure data.\n\n### Installation\n\n    $ npm install rollup-endpoint --save\n\n## Usage - Easy Version\n\nAssuming you have the following directory structure:\n\n```\nclient/\n└── main.js\n\nserver.js\npackage.json\n```\n\nThen you can write the following as your `server.js`:\n\n```javascript\n// server.js\nvar rollup = require('rollup-endpoint');\nvar app  = require('express')();\n\napp.get('/assets/app-bundle.js', rollup.serve({\n  entry: __dirname + '/client/main.js'\n}));\n\nconsole.log(\"Listening on port 5555...\");\napp.listen(5555);\n```\n\nThen run `node server.js`.\n\nNow any GET request to `localhost:5555/assets/app-bundle.js` will compile and rollup the JS file located at `./client/main.js`. Any `import` statements within `main.js` will be included in the final output, too.\n\n## Advanced Usage\n\nrollup-endpoint passes all your options along to rollup itself, so you can specify any option as described in the [rollup JavaScript API](https://github.com/rollup/rollup/wiki/JavaScript-API#rolluprollup-options-).\n\nWhen the `NODE_ENV` environment variable is set to `production`, rollup-endpoint will automatically cache and gzip your bundle output.\n\n### Plugins\n\nPlugins are configured in the same way as [rollup's JavaScript API](https://github.com/rollup/rollup/wiki/JavaScript-API#plugins).\n\nHere's a useful example. In production, you might want to transpile your code to ES5, as well as minify it. However, you probably don't want waste CPU cycles doing the same in development. Here's how you can do that:\n\n```js\nvar rollupOptions = { entry: 'my-file.js' };\n\nif ( process.env.NODE_ENV === 'production' ) {\n  rollupOptions.plugins = [\n    require('rollup-plugin-buble')(),\n    require('rollup-plugin-uglify')(),\n  ]\n}\n\napp.get('/app-bundle.js', rollup.serve(rollupOptions))\n```\n\n### Generate Options\n\nIf you need to configure the [rollup generate options](https://github.com/rollup/rollup/wiki/JavaScript-API#bundlegenerate-options-), you can pass them as `generateOptions`:\n\n```js\napp.get('/assets/app-bundle.js', rollup.serve({\n  entry: __dirname + '/client/main.js',\n  generateOptions: {\n    format: 'amd',\n    sourceMap: true, // defaults to `false` in production\n  }\n}));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbert%2Frollup-endpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilbert%2Frollup-endpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbert%2Frollup-endpoint/lists"}