{"id":18742420,"url":"https://github.com/oyuyue/grafeo","last_synced_at":"2025-11-21T01:30:17.907Z","repository":{"id":57114101,"uuid":"320546281","full_name":"oyuyue/grafeo","owner":"oyuyue","description":"简单、方便、功能强大的微前端解决方案。","archived":false,"fork":false,"pushed_at":"2021-01-08T10:28:28.000Z","size":1190,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-08T05:41:09.772Z","etag":null,"topics":["mfe","microfrontend"],"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/oyuyue.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":"2020-12-11T10:49:48.000Z","updated_at":"2021-04-24T03:47:41.000Z","dependencies_parsed_at":"2022-08-31T22:11:37.305Z","dependency_job_id":null,"html_url":"https://github.com/oyuyue/grafeo","commit_stats":null,"previous_names":["woopen/grafeo","woopen/mfes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyuyue%2Fgrafeo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyuyue%2Fgrafeo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyuyue%2Fgrafeo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyuyue%2Fgrafeo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oyuyue","download_url":"https://codeload.github.com/oyuyue/grafeo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239621911,"owners_count":19669993,"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":["mfe","microfrontend"],"created_at":"2024-11-07T16:07:46.351Z","updated_at":"2025-11-21T01:30:17.855Z","avatar_url":"https://github.com/oyuyue.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# (WIP) Grafeo\n\n简单、功能强大的微前端解决方案。\n\n## 快速入门\n\n```\nyarn add -D @grafeo/webpack-plugin\n```\n\n该插件将微前端项目打包成 @grafeo/loader 可以加载的模块。\n\n```js\nconst GrafeoPlugin = require('@grafeo/webpack-plugin')\n\nmodule.exports = {\n  devServer: GrafeoPlugin.devServerConfig(8090),\n  configureWebpack: {\n    plugins: [\n      new GrafeoPlugin({\n        name: '@vue2/shell',\n        shared: { // 共享依赖，其他项目可以共享这些模块，无需重复下载\n          vue: 'https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.runtime.js',\n          vuex: 'https://cdn.jsdelivr.net/npm/vuex@3.6.0/dist/vuex.js',\n          'vue-router': 'https://cdn.jsdelivr.net/npm/vue-router@3.4.9/dist/vue-router.js',\n          '@vue2/module1': 'http://localhost:8091/remoteEntry.js',\n          '@vue2/utils1': 'http://localhost:8092/remoteEntry.js'\n        },\n        // filename: 'remoteEntry.js' // 最终的入口文件名，默认叫 remoteEntry.js\n      })\n    ]\n  }\n}\n```\n\n其中输出的 `remoteEntry.js` 文件为入口文件，体积很小，**不应该缓存这个文件**，否则可能不能加载正确的项目文件。\n\n项目入口文件中一般都为如下内容\n\n```js\n__webpack_public_path__ ='http://localhost:8090/' // 设置 public path\nimport('./boot') // 动态加载主代码\n```\n\n在 HTML 文件中需要加载 loader 代码。\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@grafeo/loader@0.0.1/dist/index.js\"\u003e\u003c/script\u003e\n```\n\n最后在项目中动态加载其他微前端项目。\n\n```js\n// 第二个参数是获取，项目中导出的字段名，如果为 true 将会导出 default 字段\nSystem.import('@vue2/module1', true).then((m) =\u003e {\n  m('#module1') // m 为其他项目\n})\n```\n\n## 例子\n\n详细例子请看 [examples](https://github.com/woopen/grafeo/tree/main/examples) 文件夹\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foyuyue%2Fgrafeo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foyuyue%2Fgrafeo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foyuyue%2Fgrafeo/lists"}