{"id":18802388,"url":"https://github.com/jd-opensource/jmodule","last_synced_at":"2025-10-07T14:32:30.369Z","repository":{"id":37931464,"uuid":"478546760","full_name":"jd-opensource/jmodule","owner":"jd-opensource","description":"一个微前端框架，用于帮助前端项目进行融合与拆解，适用于大型应用的拆分、插件系统实现、多应用融合场景。","archived":false,"fork":false,"pushed_at":"2025-05-15T08:27:56.000Z","size":1727,"stargazers_count":20,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-26T09:43:07.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/jd-opensource.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":"2022-04-06T12:19:19.000Z","updated_at":"2025-05-15T08:28:02.000Z","dependencies_parsed_at":"2024-01-19T12:47:01.412Z","dependency_job_id":"f8726606-65a0-4c61-9308-3bb898bb95f5","html_url":"https://github.com/jd-opensource/jmodule","commit_stats":{"total_commits":119,"total_committers":5,"mean_commits":23.8,"dds":0.07563025210084029,"last_synced_commit":"f879ea74af10a830f8a8274beaa8b8a417a5a35d"},"previous_names":["jd-opensource/jmodule","jdtdevops/jmodule"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jd-opensource/jmodule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-opensource%2Fjmodule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-opensource%2Fjmodule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-opensource%2Fjmodule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-opensource%2Fjmodule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jd-opensource","download_url":"https://codeload.github.com/jd-opensource/jmodule/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jd-opensource%2Fjmodule/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259594280,"owners_count":22881635,"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-07T22:27:48.023Z","updated_at":"2025-10-07T14:32:25.344Z","avatar_url":"https://github.com/jd-opensource.png","language":"TypeScript","readme":"# JModule \n\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/jd-opensource/jmodule)\n\n\n一个微前端框架，用于帮助前端项目进行融合与拆解，适用于大型应用的拆分、插件系统实现、多应用融合场景。\n\n\n## 特性\n### 支持项目集成开发\n提供webpack插件，满足子应用在开发过程中与宿主应用集成调试的需求。\n\n### 多种接入模式\n可以扩展应用接入模式，比如可以用于插件系统实现、动态路由集成，或者是一个完整的前端应用。常用的接入模式支持已通过 @jmodule/helper 提供支持。\n\n### 多级应用结构\n支持子应用嵌套，子应用本身也可以是宿主应用，但仍以自应用的方式接入其它宿主应用。\n\n## 安装\n\n```bash\nnpm install @jmodule/client\n\n# 开发插件安装\nnpm install @jmodule/plugin-webpack\n```\n### SCENE: 作为子应用接入宿主应用\n```javascript\n// 在 webpack 配置中增加\nimport WebpackJmodulePlugin from '@jmodule/plugin-webpack';\n\nmodule.exports = {\n  plugins: [\n    new WebpackJmodulePlugin({\n      mode: 'modules',\n      devConfig: { // 开发联调时配置\n        currentServer: 'http://localhost:8084', // 子应用 server\n        platformServer: 'http://platformServer.com', // 主应用 server\n        platformLocalPort: 8088, // 本地联调端口\n        onAllServerReady: () =\u003e { // 所有服务就绪\n            console.log('ALL SERVER READY!');\n            opn('http://localhost:8088');\n        },\n      },\n    }),\n  ];\n}\n\n// 在入口文件中添加\nJModule.define(moduleKey, { mount() {} })\n```\n\n### SCENE: 作为宿主应用加载子应用\n```javascript\nnpm i @jmodule/client\n\nimport { JModule } from '@jmodule/client'\n\nJModule.registerModules([\n    key: 'childApp',\n    url: 'http://localhost:8080',\n]).then(modules =\u003e modules.forEach(module =\u003e module.load()));\n\n// 通过 afterInit hook 注入子应用路由进行其它操作\nJModule.registerHook('afterInit', (module, options) =\u003e {\n  const { routes } = options || {};\n  router.addRoutes(routes);\n});\n\n```\n\n## Example\n```bash\n# 源码项目采用 pnpm 进行管理，需要先安装 pnpm\nnpm i -g pnpm@6\n\n# Demo 代码位于 packages/demo\n\n# 安装项目依赖\npnpm i\n\n# 构建 client\\helper包\npnpm --filter \"*client\" run build\npnpm --filter \"*helper\" run build\n\n#### 完整示例\n# 启动所有子项目\npnpm --filter \"*child*\" run serve\n\n# 启动宿主应用并自动加载以上子应用\npnpm --filter \"*host*\" run serve:modules\n\n#### 单应用调试\n# 以纯净模式启动宿主应用（与前面含子应用的启动的示例相区别）\npnpm --filter \"@jmodule-demo/host-vue2\" run serve\n# 启动指定的子应用，并在宿主应用中进行集成调试\npnpm --filter \"@jmodule-demo/child-app-react\" run serve\n```\n\n## 文档  \n[文档](https://jmodule.jd.com)\n\n\n## 浏览器插件\n\n查看应用基本信息、资源信息，以及从注册到加载过程的事件触发时间信息。\n\n### 安装地址\n[chrome 应用商店](https://chrome.google.com/webstore/detail/jmodule-devtool/egoehonhiiogmmcdjaaakbpmnahcjgpd?hl=zh-CN)\n\n[firefox 应用商店](https://addons.mozilla.org/zh-CN/firefox/addon/jmodule-devtool/?utm_source=addons.mozilla.org\u0026utm_medium=referral\u0026utm_content=search)\n\n### 预览\nDashboard\n![Dashboard](./packages/devtool/media/preview1@2x.png)\n资源信息\n![资源信息](./packages/devtool/media/preview2@2x.png)\n事件\n![事件](./packages/devtool/media/preview3@2x.png)\n\n\n## License\n[License](LICENSE)\n\n## 微信交流群\n![京东行云开源交流群](./assets/weixin-group.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd-opensource%2Fjmodule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjd-opensource%2Fjmodule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd-opensource%2Fjmodule/lists"}