{"id":23108574,"url":"https://github.com/venryx/webpack-runtime-require","last_synced_at":"2025-08-16T17:32:44.776Z","repository":{"id":49416958,"uuid":"86373766","full_name":"Venryx/webpack-runtime-require","owner":"Venryx","description":"Exposes a way to require module exports at runtime. (eg. in browser consoles)","archived":false,"fork":false,"pushed_at":"2024-04-03T03:54:43.000Z","size":173,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T09:43:36.669Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Venryx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-27T19:07:03.000Z","updated_at":"2024-04-09T01:59:07.000Z","dependencies_parsed_at":"2024-06-18T20:12:03.649Z","dependency_job_id":null,"html_url":"https://github.com/Venryx/webpack-runtime-require","commit_stats":{"total_commits":50,"total_committers":2,"mean_commits":25.0,"dds":"0.040000000000000036","last_synced_commit":"57a008f2bd0a088eed614d33840cfe00cd3b776d"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Venryx/webpack-runtime-require","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwebpack-runtime-require","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwebpack-runtime-require/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwebpack-runtime-require/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwebpack-runtime-require/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Venryx","download_url":"https://codeload.github.com/Venryx/webpack-runtime-require/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwebpack-runtime-require/sbom","scorecard":{"id":147632,"data":{"date":"2025-08-11","repo":{"name":"github.com/Venryx/webpack-runtime-require","commit":"57a008f2bd0a088eed614d33840cfe00cd3b776d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T09:43:06.965Z","repository_id":49416958,"created_at":"2025-08-16T09:43:06.966Z","updated_at":"2025-08-16T09:43:06.966Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270746670,"owners_count":24638390,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-17T01:28:03.472Z","updated_at":"2025-08-16T17:32:44.492Z","avatar_url":"https://github.com/Venryx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Runtime Require\n\nExposes a way to require module exports at runtime. (eg. in browser consoles)\n\nSupports Webpack versions 1, 2, 3?, 4, and 5.\n\n### Install\n\n```\nnpm install --save webpack-runtime-require\n```\n\n### Usage\n\n* 1\\) Tweak your `webpack.config.js` file, to expose the information necessary for \"runtime module requiring/importing\".\n\t* 1.1\\) Ensure that one of the following are set, to have webpack provide module path info: (otherwise this library falls back to guessing the module's name from the variables where it's imported)\n\t\t* 1.1.A) Set `config.optimization.moduleIds: \"named\"` (in wp \u003c=4: `config.optimization.namedModules: true`). [this is the cleanest way; and it's enabled by default when `config.mode == \"development\"`]\n\t\t* 1.1.B) Set `config.output.pathinfo: true`. [not as clean, since relies on regular-expressions, but should work]\n\t* 1.2\\) The setting tweaks below are only relevant for prod builds, and only if you're using a recent webpack version. (where prod builds have these optimizations enabled by default; ie. no need to tweak these if WRR usage is undesired in prod)\n\t\t* 1.2.1\\) Recommended config, if you want WRR usable in prod:\n\t\t\t```js\n\t\t\t// disable concatenation/merging of modules, even in prod\n\t\t\t// (otherwise webpack merges many modules, causing exports between them to be removed/privatized)\n\t\t\tconfig.optimization.concatenateModules = false;\n\t\t\t```\n\t\t* 1.2.2\\) You *may* also want to tell webpack prod-builds to never remove unused exports -- for example, if there's a class that is only used in a single file, but you still want runtime access to inspect static variables or the like. To do so:\n\t\t\t```js\n\t\t\t// disable removal/privatizing of unused exports, even in prod\n\t\t\t// (otherwise webpack-runtime-require can't access unused-from-other-module exports)\n\t\t\tconfig.optimization.usedExports = false;\n\t\t\t```\n\t\t* Note: These two tweaks will likely increase the size of your builds slightly (in my project, by ~10%). So weigh whether the slight size increase is worth it relative to improved inspection/debugging in your prod builds.\n\n* 2\\) Add some way for the library to access the webpack data.\n\n\tThis is generally as simple as importing it from one of the files in your main project/chunk:\n\t```\n\timport \"webpack-runtime-require\";\n\t```\n\tIf that fails, try the following: (make sure the below runs before any uses of the `wrr` fields/functions)\n\t```\n\timport {Init} from \"webpack-runtime-require\";\n\n\t// if you're using typescript, uncomment the line below\n\t//declare var __webpack_require__, __webpack_modules__, __webpack_module_cache__;\n\n\tInit({\n\t\t__webpack_require__,\n\t\t// omit the two below if on Webpack 4 or below\n\t\t__webpack_modules__: __webpack_modules__, // don't collapse this; can confuse babel/webpack\n\t\t__webpack_module_cache__,\n\t});\n\t```\n\t(If even that fails, try using one of the older versions of webpack-runtime-require [0.3.3 or older], which has a couple other approaches for finding/supplying the data.)\n\n\tAfter importing/initialization, the library will create a `window.wrr` object. This object exposes structures and functions for accessing the contents of any module within the Webpack bundle.\n\n* 3\\) Use the `window.wrr` object in dev-tools (or the `wrr` export in compile-time code) to access module contents.\n\t* 3.A\\) A dev-tools example, of importing based on module/file name:\n\t\t```\n\t\t// for libraries, you can usually just use the library name\n\t\t// (replacing any non-variable-safe characters with underscores)\n\t\t// (in some cases, the name's more complicated; can inspect first, as seen in \"Additional usage\" section)\n\t\tlet React = wrr.Module(\"react\");\n\t\tconsole.log(\"Retrieved Component class from react:\", React.Component);\n\n\t\t// if path was \"./Path/To/MyComponent.js\", specify just the file-name\n\t\t// (replacing any non-variable-safe characters with underscores)\n\t\tlet MyComponent = wrr.Module(\"MyComponent_js\");\n\t\tconsole.log(\"Retrieved MyComponent:\", MyComponent);\n\n\t\t// if you want to import by path instead of file-name, see here:\n\t\t//   https://github.com/Venryx/webpack-runtime-require/issues/3#issuecomment-864035793\n\t\t```\n\t* 3.B\\) A dev-tools example, of importing based on export name:\n\t\t```\n\t\twrr.Start();\n\t\tlet Component = wrr.Export(\"Component\"); // retrieved from the \"react\" library\n\t\tconsole.log(\"Retrieved Component class from react:\", Component);\n\t\t```\n\t* 3.C\\) A compile-time code example, of doing some of the operations above:\n\t\t```\n\t\timport {wrr} from \"webpack-runtime-require\";\n\t\tconsole.log(\"Retrieved Component class from react:\", wrr.Export(\"Component\"));\n\t\tconsole.log(\"All react exports:\", Object.entries(wrr.Module(\"react\")));\n\t\t```\n\n### Additional usage\n\nIf you're using the dev-tools console, you can see autocomplete for the modules:\n\n* 1\\) Type and run: `wrr.Start()` (this triggers the module finding/processing)\n* 2\\) Type: `wrr.moduleExports.` (or `wrr.moduleExports_byShortName.`)\n\nYou should then see all the modules in your app displayed in the autocomplete dropdown.\n\nOther useful contents of the `window.wrr` structure:\n* `wrr.moduleExports_flat`: Contains the exports from every module, stored by *export name* rather than module name.\n* `wrr.webpackData`: The raw data-structures retrieved from webpack.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenryx%2Fwebpack-runtime-require","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvenryx%2Fwebpack-runtime-require","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenryx%2Fwebpack-runtime-require/lists"}