{"id":19423730,"url":"https://github.com/xiaocongdong/webpack-resolve-config-plugin","last_synced_at":"2026-03-07T14:02:33.049Z","repository":{"id":119592484,"uuid":"161303664","full_name":"XiaocongDong/webpack-resolve-config-plugin","owner":"XiaocongDong","description":"Take package's webpack resolve configuration into consideration when bundling it with Webpack.","archived":false,"fork":false,"pushed_at":"2018-12-12T02:31:43.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T07:03:24.070Z","etag":null,"topics":["configuration","dependency","plugin","resolver","webpack"],"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/XiaocongDong.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":"2018-12-11T08:41:49.000Z","updated_at":"2024-01-05T13:09:41.000Z","dependencies_parsed_at":"2023-03-26T16:39:04.499Z","dependency_job_id":null,"html_url":"https://github.com/XiaocongDong/webpack-resolve-config-plugin","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.5,"last_synced_commit":"e970ad1809913cd290d97a135f1d59e25090eaa8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/XiaocongDong/webpack-resolve-config-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XiaocongDong%2Fwebpack-resolve-config-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XiaocongDong%2Fwebpack-resolve-config-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XiaocongDong%2Fwebpack-resolve-config-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XiaocongDong%2Fwebpack-resolve-config-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XiaocongDong","download_url":"https://codeload.github.com/XiaocongDong/webpack-resolve-config-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XiaocongDong%2Fwebpack-resolve-config-plugin/sbom","scorecard":{"id":153324,"data":{"date":"2025-08-11","repo":{"name":"github.com/XiaocongDong/webpack-resolve-config-plugin","commit":"e970ad1809913cd290d97a135f1d59e25090eaa8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/8 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":"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":"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":"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":"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":"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":"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":"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"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T11:12:23.976Z","repository_id":119592484,"created_at":"2025-08-16T11:12:23.976Z","updated_at":"2025-08-16T11:12:23.976Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000988,"owners_count":26082971,"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-10-09T02:00:07.460Z","response_time":59,"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":["configuration","dependency","plugin","resolver","webpack"],"created_at":"2024-11-10T13:40:33.019Z","updated_at":"2025-10-09T07:06:50.761Z","avatar_url":"https://github.com/XiaocongDong.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-resolve-config-plugin\nTake dependency's webpack resolve configuration into consideration when bundling it with Webpack.\n\n## What is It For?\nIn some cases, you may want to resolve the code under node_modules with its own webpack resolve configuration. Assumes that you have the following project structure:\n```\napp\n├── node_modules\n|   └── dependency\n|       ├── src\n|       |   ├── containers\n|       |   |   └── index.js\n|       |   └── index.js\n|       ├── index.js\n|       └── webpack.resolve.config.js\n├── src\n├── index.js\n└── webpack.config.js\n```\nHere is the example code of each file:\n```javascript\n// app/node_modules/dependency/src/containers/index.js\nexport default \"containers in dependency\"\n\n// app/node_modules/dependency/src/index.js\nimport containers from \"containers\"\n...\n\n// app/node_modules/dependency/index.js\nimport app from \"./src/index.js\"\n...\n\n// app/node_modules/dependency/webpack.resolve.config.js\nmodule.exports = {\n  resolve: {\n    modules: [\n      \"node_modules\",\n      path.resolve(__dirname, \"src\")\n    ]\n  }\n}\n\n// app/index.js\nimport \"dependency\"\n...\n\n// app/webpack.config.js\nmodule.exports = {\n  resolve: {\n    modules: [\n      \"node_modules\",\n      path.resolve(__dirname, \"src\")\n    ]\n  }\n}\n```\nIf you run the app directly, webpack will fail with `Cannot resolve \"containers\" in \"app/node_modules/dependency/index.js\"` error because webpack resolve the code under dependency with the resolve options in app/webpack.config.js. In this case, you can use WebpackResolveConfigPlugin to make webpack resolve the dependency code with dependency's webpack resolve configuration.\n\n## How does It Work?\nWhen webpack try to resolve a dependency in a file, it will pass a context to the resolver. Context is the current directory of the file. For instance, context will be `app/node_modules/dependency/src` when webpack try to resolve `containers` dependency in `app/node_modules/dependency/src/index.js` file. WebpackResolveConfigPlugin hook into normalModuleFactory.beforeResolve to add dependency's own resolve confgurations to the resolveOptions passed to the resolver to make it resolve dependency based on current resolve config.\n\n## How to Use It?\n### Installation\nFirst things first, install it with npm/yarn:\n```shell\n// via npm\nnpm install --save-dev webpack-resolve-config-plugin\n\n// via yarn\nyarn add -D webpack-resolve-config-plugin\n```\n\n### Put It in Your webpack.config.js\n```javascript\nconst WebpackResolveConfigPlugin = require(\"webpack-resolve-config-plugin\")\n\nmodule.exports = {\n  ...\n  plugins: [\n    new WebpackResolveConfigPlugin(options)\n  ]\n}\n```\n\n### Options\nYou can pass a hash of configuration options to WebpackResolveConfigPlugin. Allowed values are as follows:\n* [`include`]. Only the context matched with the regex in `include` attribute will be resolved with its own configuration. The `include` attribute can be one of the following types:\n  * Regex. A regex to test the resolve context.\n  * Object. The options object must have a `match` key which is a regex. Beside this, you can also provides the resolve configuration file name of the dependency(Default value for this is `webpack.resolve.config.js`) with `file` key.\n  * Array. It can be either an array of regex or an array of the above options object.\n* [`exclude`]. Context matched with the regex in exclude will be ignored by WebpackResolveConfigPlugin. The `exlcude` attribute can be one of the following types:\n  * Regex. A regex to test the resolve context.\n  * Array. An array of regex.\n\n**Notes** Exclude attribute has higher priority than the include attribute.\n\n#### Example of Options\n```javascript\n{\n  include: /dependency/,\n  exlcude: /anotherdependency/\n}\n\n{\n  include: {\n    match: /dependency/,\n    file: 'webpack.resolve.config.js'\n  }\n}\n\n{\n  include: [\n    {\n      match: /dependency1/,\n      file: 'webpack.resolve.js'\n    },\n    {\n       match: /dependency2/,\n       file: 'webpack.resolve.config.js'\n    }\n  ],\n  exlcude: [\n    /dependency1/,\n    /dependency2/\n  ]\n }\n```\n### Webpack.resolve.config.js\nThe best practice to use WebpackResolveConfigPlugin is using a seperate configuration file for the resolve configuration(So the default webpack resolve configuration file is `webpack.resolve.config.js` instead of `webpack.config.js`). The reason for that is if you use a whole webpack configuration for the dependency, some dev dependencies of this package may needed to be installed to make it work.\n\nThe content of webpack.resolve.config.js is the exact same one documented in [Webpack DOC](https://webpack.js.org/configuration/resolve/).\n\nExample:\n```javascript\nconst path = require('path')\n\nmodule.exports = {\n  resolve: {\n    modules: [\n      'node_modules',\n      path.resolve(__dirname, 'src')\n    ]\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaocongdong%2Fwebpack-resolve-config-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaocongdong%2Fwebpack-resolve-config-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaocongdong%2Fwebpack-resolve-config-plugin/lists"}