{"id":15659561,"url":"https://github.com/suchipi/require-browser","last_synced_at":"2025-05-05T19:35:07.566Z","repository":{"id":51663152,"uuid":"155152228","full_name":"suchipi/require-browser","owner":"suchipi","description":"Easy-to-use require function for your browser","archived":false,"fork":false,"pushed_at":"2021-05-10T20:34:24.000Z","size":784,"stargazers_count":21,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T05:04:55.382Z","etag":null,"topics":["beginner-friendly","browser","commonjs","commonjs-modules","javascript","modules","require"],"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/suchipi.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":"2018-10-29T04:30:46.000Z","updated_at":"2023-08-26T13:48:20.000Z","dependencies_parsed_at":"2022-08-22T03:20:24.822Z","dependency_job_id":null,"html_url":"https://github.com/suchipi/require-browser","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/suchipi%2Frequire-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchipi%2Frequire-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchipi%2Frequire-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchipi%2Frequire-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suchipi","download_url":"https://codeload.github.com/suchipi/require-browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252563030,"owners_count":21768390,"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":["beginner-friendly","browser","commonjs","commonjs-modules","javascript","modules","require"],"created_at":"2024-10-03T13:17:30.287Z","updated_at":"2025-05-05T19:35:07.543Z","avatar_url":"https://github.com/suchipi.png","language":"JavaScript","readme":"# `require-browser`\n\nThe `require-browser` package gives you an easy-to-use `require` function for your browser that behaves the same as the one in [Node.js](https://nodejs.org/).\n\n![Screenshot showing require function in use in Chrome's DevTools console](https://user-images.githubusercontent.com/1341513/48318342-6ec7cb80-e5bc-11e8-8c73-b488439503b9.png)\n\n## Features\n\n- Works without installation via `npx`\n- Makes it easy to get started developing with modules now\n- Works on Windows, Linux, and macOS\n- Can later be replaced with [Webpack](https://webpack.js.org/) or [browserify](http://browserify.org/) with few or no code changes\n- `require(\"fs\")` works the same as in Node (via [`fs-remote`](https://www.npmjs.com/package/fs-remote))\n- `require(\"os\")`, `require(\"buffer\")`, and other Node builtin modules will be automatically replaced with browser-compatible shims\n- Supports lookup via `node_modules`, so you can use `npm` to manage your dependencies\n\n`require-browser` is not suitable for use in production (**it's insecure**), but makes it easy to get started developing in the browser. Once you want to run your code in production, I suggest using [Webpack](https://webpack.js.org/) to bundle your application.\n\n## Usage\n\nYou must have [Node.js](https://nodejs.org/) 8.12.0 or higher installed, then run the following in your terminal or command prompt:\n\n```\nnpx require-browser\n```\n\nA server will start and further instructions will be printed in your terminal/command prompt:\n\n![Screenshot of terminal output](https://user-images.githubusercontent.com/1341513/48318304-e34e3a80-e5bb-11e8-99be-6973471c33df.png)\n\n## Installation\n\nIf you want to install `require-browser` globally so you don't need to use `npx`, run the following in your terminal or command prompt:\n\n```\nnpm install -g require-browser\n```\n\nThen you can run it without npx:\n\n```\nrequire-browser\n```\n\n## CLI Options\n\n```\n$ require-browser --help\nOptions:\n  --help       Show help                                               [boolean]\n  --version    Show version number                                     [boolean]\n  --fs-port    Port to run the fs-remote server on\n                                             [number] [required] [default: 3001]\n  --http-port  Port to host files over http from\n                                             [number] [required] [default: 3002]\n  --root-dir   Directory where index.html can be found and the global require\n               function will resolve relative to\n                                              [string] [required] [default: \".\"]\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuchipi%2Frequire-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuchipi%2Frequire-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuchipi%2Frequire-browser/lists"}