{"id":13724812,"url":"https://github.com/lukeed/loadr","last_synced_at":"2025-10-09T18:23:54.046Z","repository":{"id":66007844,"uuid":"397145030","full_name":"lukeed/loadr","owner":"lukeed","description":"Quickly attach multiple ESM Loaders and/or Require Hooks together but without the repetitive `--experimental-loader` and/or `--require` Node flags","archived":false,"fork":false,"pushed_at":"2021-08-28T00:02:57.000Z","size":31,"stargazers_count":49,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-08T08:08:18.368Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukeed.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license","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},"funding":{"github":"lukeed"}},"created_at":"2021-08-17T07:04:54.000Z","updated_at":"2022-09-17T00:21:11.000Z","dependencies_parsed_at":"2023-04-21T08:36:27.945Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/loadr","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"1256b0ad525ddff7998985dee802da57da45f9aa"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Floadr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Floadr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Floadr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Floadr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/loadr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224636938,"owners_count":17344643,"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-03T01:02:03.804Z","updated_at":"2025-10-09T18:23:49.023Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lukeed"],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"loadr\" width=\"320\" /\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/loadr\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/v/loadr\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- \u003ca href=\"https://github.com/lukeed/loadr/actions\"\u003e\n    \u003cimg src=\"https://github.com/lukeed/loadr/workflows/CI/badge.svg\" alt=\"CI\" /\u003e\n  \u003c/a\u003e --\u003e\n  \u003ca href=\"https://npmjs.org/package/loadr\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/dm/loadr\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://packagephobia.now.sh/result?p=loadr\"\u003e\n    \u003cimg src=\"https://packagephobia.now.sh/badge?p=loadr\" alt=\"install size\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  Quickly attach \u003cem\u003emultiple\u003c/em\u003e ESM Loaders and/or Require Hooks together \u003cbr\u003e\n  but without the repetitive `--experimental-loader` and/or `--require` Node flags\n\u003c/div\u003e\n\n\n## Features\n\n* Extremely lightweight\n* Easily chain multiple [ESM Loaders](https://nodejs.org/api/esm.html#esm_loaders) together\u003csup\u003e†\u003c/sup\u003e\n* Interleave additional [`--require` hooks](https://nodejs.org/api/cli.html#cli_r_require_module) at the same time\n* Command spawns as a `ChildProcess`, forwarding the current `process.env` context\n\n\u003e \u003csup\u003e†\u003c/sup\u003e The ESM Loader API is still **experimental** and will change in the future.\n\n## Install\n\n```\n$ npm install --save-dev loadr\n```\n\n## Example\n\n***Before***\n\n```sh\n$ node --require dotenv/config \\\n  --experimental-loader ts-node/esm \\\n  --experimental-loader ./tests/loader.mjs \\\n  server/index.mjs\n```\n\n***After***\n\n```sh\n$ loadr -- node server/index.mjs\n```\n\n```js\n// loadr.mjs\nexport const loaders = [\n  'ts-node/esm',\n  './tests/loader.mjs',\n]\nexport const registers = [\n  'dotenv/config',\n]\n```\n\n## Usage\n\n```sh\n# Run `npm test` using the `loadr.mjs` configuration file\n$ loadr -- npm test\n\n# Run `npm test` using custom `loadr.custom.js` file\n$ loadr -c loadr.custom.js -- npm test\n\n# Run `node server.mjs` w/o system bell\n$ loadr -q -- node server.mjs\n```\n\n\n## CLI\n\nThe `loadr` binary expects the following usage:\n\n```sh\n$ loadr [options] -- \u003ccommand\u003e\n```\n\n\u003e **Important:** The `--` is required! It separates your `command` from your `loadr` arguments.\n\nPlease run `loadr --help` for additional information.\n\n## Configuration\n\nUnless specified via the `-c` or `--config` CLI arguments, `loadr` looks for a `loadr.mjs` configuration file in the current working directory – aka `process.cwd()`.\n\n### loaders\nType: `string[]`\n\nA list of files and/or modules to be added as an `--experimental-loader` hook.\n\n\u003e **Important:** Any relative file paths will be resolved from the current working directory.\n\n```js\n// loadr.mjs\nexport const loaders = [\n  \"ts-node/esm\", // third-party module\n  \"./tests/loader.mjs\", // local file\n];\n```\n\n### requires\nType: `string[]`\n\nA list of files and/or modules to be added as a `--require` hook. Please note that ESM files cannot be loaded via a `require()` statement.\n\n\u003e **Important:** Any relative file paths will be resolved from the current working directory.\n\n```js\n// loadr.mjs\nexport const requires = [\n  \"esm\", // third-party module\n  \"dotenv/register\", // third-party module\n  \"./tests/setup.js\", // local file\n];\n```\n\n### quiet\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nBy default, `loadr` invokes the system bell when your `command` process terminates with a non-zero exit code.\n\n\u003e **Note:** If defined, the `-q` or `--quiet` CLI argument takes precedence over the configuation file.\n\n```js\n// loader.mjs\nexport const quiet = true;\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Floadr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Floadr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Floadr/lists"}