{"_id":"@btngoc-cmcglobal/vite-plugin-qiankun","_rev":"1-5a0ff4ccad196ea7ca04c7efd7ee1b17","name":"@btngoc-cmcglobal/vite-plugin-qiankun","dist-tags":{"latest":"1.0.17"},"versions":{"1.0.16":{"name":"@btngoc-cmcglobal/vite-plugin-qiankun","version":"1.0.16","description":"vite for qiankun","module":"es/index.js","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c scripts/rollup.config.js","example:install":"cd example/main && npm install && cd ../viteapp && npm install && cd ../vue && npm install && cd ../react18 && npm install && cd ../vue3sub && npm install","example:start":"npm run build && cd example/viteapp && npm run build && cd ../../ && npm-run-all --parallel start:main start:viteapp start:vue start:react18dev start:vue3sub","example:start-vite-dev":"npm run build && npm-run-all --parallel start:main start:vitedev start:vue start:react18dev start:vue3sub","start:main":"cd example/main && npm run start","start:viteapp":"cd example/viteapp && npm run start","start:vitedev":"cd example/viteapp && npm run dev","start:react18dev":"cd example/react18 && npm run dev","start:vue3sub":"cd example/vue3sub && npm run dev","start:vue":"cd example/vue && npm run start","vite:test":"npm run build && cd example/viteapp && npm run dev"},"keywords":["qiankun","vite","esm","esModule"],"homepage":"https://github.com/btngoc-cmcglobal/vite-plugin-qiankun","author":{"name":"btngoc-cmcglobal"},"license":"MIT","dependencies":{"cheerio":"^1.0.0-rc.10"},"devDependencies":{"@types/jsdom":"^16.2.10","@typescript-eslint/eslint-plugin":"^4.29.1","@typescript-eslint/parser":"^4.29.1","eslint":"^7.32.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.24.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","npm-run-all":"^4.1.5","rollup":"^2.73.0","rollup-plugin-typescript2":"^0.30.0","typescript":"^4.6.4","vite":"^2.9.9"},"peerDependencies":{"typescript":">=4","vite":">=2"},"gitHead":"300e1532f0c126a603c87a9d2c635ee10aa5dd36","_id":"@btngoc-cmcglobal/vite-plugin-qiankun@1.0.16","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-CzV757Cb+M8MhgDEMv4DG0y29csgdlYjd7KPM3Fr8N2exjtBaKonKN1GGjfn4xjqGkyh06SPBOAsbbaYpJioOg==","shasum":"7fdcd56d7c095d08945926b41df280b713124c75","tarball":"https://registry.npmjs.org/@btngoc-cmcglobal/vite-plugin-qiankun/-/vite-plugin-qiankun-1.0.16.tgz","fileCount":3,"unpackedSize":5765,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHiScyBgPqyEHmAxrj65g+jIhO7PXdLCG1/8zeVRVgwDAiEA8NFPxeIL+OhpCfAuriQxh2Lw4FLIphQxeABLo4t2HxY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9skJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUOw/+Or9BG898qKOvSiOdFHLkLs0uFDwuc1x8LgPSZCZeHxTOMhLw\r\nDt7pnjR4KbfgqMEQHAkBMe0BRaTOPhhr0HXiZv0fnkMlnja0j5/jRl5aF9rj\r\nibv0JKKcb4Ont6theW4V9wZrf5SGMHJNSyCGP/vO+BpfzyA5mpR9Pt6sAgnh\r\nQl2kYN840OoVKUyToj84PdtkMEBlng4sjBUDp6g+ake278z26a/ohxDA+w6d\r\n5RRCy86KnPzqoQwH1AOmWu3YkbglGMwI2wygMxWtbiJP98pqjvrxfXzNpxur\r\nck+5IHxj5r9Vl+Gp8JCFz50zdt7cgaXE7RFpmfzIwacQWqwz1p/Br3xnEgta\r\nqy3EjLJ3mQGBOgG5S7IRDoZQljlJwqkuUilpwOpYy5qEVnSeehkNIPubK7CD\r\njPjVGwyo6/hmru3Yn7cj0RGSNp2nUmuDBByNMb/4Tx3xHrAZsTRANb5MC9zB\r\n70lgfZtEcHwtHGHwDDi0OFBEGkAANbgkAjV7XSDyMYdnxAoBQF7fmA8GN9QD\r\n0h7z6e3wBEWhgrW7nEhqRleaPAPFTYePMznmZ9BRtJh9Ep/wyv/Owrg6fdru\r\naeEUfCYZG081ZfyZXo0YXwzvtxTFG7AEmjty9EV3C1bLTU1CCEI1Ll5yo86q\r\nhwKZe8fKpxJkVpXUEu8F0S9TdynMqWsMo8I=\r\n=howb\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"btngoc-cmcglobal","email":"btngoc@cmcglobal.vn"},"directories":{},"maintainers":[{"name":"btngoc-cmcglobal","email":"btngoc@cmcglobal.vn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-qiankun_1.0.16_1677117705183_0.9770641265949775"},"_hasShrinkwrap":false},"1.0.17":{"name":"@btngoc-cmcglobal/vite-plugin-qiankun","version":"1.0.17","description":"vite for qiankun","module":"es/index.js","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c scripts/rollup.config.js","example:install":"cd example/main && npm install && cd ../viteapp && npm install && cd ../vue && npm install && cd ../react18 && npm install && cd ../vue3sub && npm install","example:start":"npm run build && cd example/viteapp && npm run build && cd ../../ && npm-run-all --parallel start:main start:viteapp start:vue start:react18dev start:vue3sub","example:start-vite-dev":"npm run build && npm-run-all --parallel start:main start:vitedev start:vue start:react18dev start:vue3sub","start:main":"cd example/main && npm run start","start:viteapp":"cd example/viteapp && npm run start","start:vitedev":"cd example/viteapp && npm run dev","start:react18dev":"cd example/react18 && npm run dev","start:vue3sub":"cd example/vue3sub && npm run dev","start:vue":"cd example/vue && npm run start","vite:test":"npm run build && cd example/viteapp && npm run dev"},"keywords":["qiankun","vite","esm","esModule"],"homepage":"https://github.com/btngoc-cmcglobal/vite-plugin-qiankun","author":{"name":"btngoc-cmcglobal"},"license":"MIT","dependencies":{"cheerio":"^1.0.0-rc.10"},"devDependencies":{"@types/jsdom":"^16.2.10","@typescript-eslint/eslint-plugin":"^4.29.1","@typescript-eslint/parser":"^4.29.1","eslint":"^7.32.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.24.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","npm-run-all":"^4.1.5","rollup":"^2.73.0","rollup-plugin-typescript2":"^0.30.0","typescript":"^4.6.4","vite":"^2.9.9"},"peerDependencies":{"typescript":">=4","vite":">=2"},"gitHead":"300e1532f0c126a603c87a9d2c635ee10aa5dd36","_id":"@btngoc-cmcglobal/vite-plugin-qiankun@1.0.17","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-h5MUzHgNFuOGQFLN9Ht+4me/SbaKlGqrh6zxeUeU1m3nWntQ6veQUAHys8Xne60gj8t5HI5XfUySAJJX02GGuQ==","shasum":"e780bd52de8a646546c87bddb5d7d10bbeb0f500","tarball":"https://registry.npmjs.org/@btngoc-cmcglobal/vite-plugin-qiankun/-/vite-plugin-qiankun-1.0.17.tgz","fileCount":11,"unpackedSize":20145,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuigs+hM6Jy6l85dXncke92mrGS1d6XhI0NzwTMS+MQgIhAM+iwkpAQDc9WCW41Vtcun93dcGNtInwpVMz9EnG1rMX"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9soNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpzkhAAkv88dmtFReTVwBAGQSNsVw9EdJqfVt1hpRTYqfSXnPgMxeaF\r\n4q3vh8/Ku/n9/E8KABOirg1WNjMhdmz/mTxxIL/fZEeaNqlDIUi3ihW3mCJc\r\ncJp7yMwaK6r23ZY7OXD1PxrIhHf0axYRtfKOaRk6depZFrpxpVNrenc9Vpbn\r\nO42R+qMlcHxQZziZT5W1ZqyXTuW8YWV6gT7BQG7yHuYZrGoqLbsRJfhq4C23\r\nVxF1Xx5WiFNJRaLobVS5AU4xnMUo12xAmlGitwoqP6vMiCgL5ejk2U66dnXM\r\nGjTTV7hmTPQVec9QKwP3PaMdYwn8f9ngyOVjXup/ap/S/OUBIWaeSmfRRP/s\r\nu0TtQqf1jmrKcbIMMMKcTD8flnO7R2qs94mQCkGpQ3fCWTTUteMvpv+U8iSp\r\njeO/jXNnMSAO9tKPsUU7Wz9AjNKAwVUJaY+6YHIT1P10XdJWyzp3lEJa0gxP\r\nLTjdgwLUYOnUfec0a/bZDvGNHswjN5h5UYwuTsg0CCi7hZG3M/hSV5NDyvYw\r\nKGoFIIVlByheHdy+KtR3NP+08N7OyWtCQBHb7ZZKwO1zu1D1iVHjm1JEN5Tf\r\nbWR5fYXgXbz+NcUgO0J3NehvOwpZT0RoWUyL5k+5z1cjhyTWORhHKi5nb8V9\r\nHlSIhi5qfar8wjmjRmDamPoBRolvN1Zf8+A=\r\n=ghCu\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"btngoc-cmcglobal","email":"btngoc@cmcglobal.vn"},"directories":{},"maintainers":[{"name":"btngoc-cmcglobal","email":"btngoc@cmcglobal.vn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-qiankun_1.0.17_1677117965672_0.19621359624655477"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-23T02:01:45.085Z","1.0.16":"2023-02-23T02:01:45.335Z","modified":"2023-02-23T02:06:06.017Z","1.0.17":"2023-02-23T02:06:05.868Z"},"maintainers":[{"name":"btngoc-cmcglobal","email":"btngoc@cmcglobal.vn"}],"description":"vite for qiankun","homepage":"https://github.com/btngoc-cmcglobal/vite-plugin-qiankun","keywords":["qiankun","vite","esm","esModule"],"author":{"name":"btngoc-cmcglobal"},"license":"MIT","readme":"#### 简介\n\n> vite-plugin-qiankun: 帮助应用快速接入乾坤的vite插件\n\n- 保留vite构建es模块的优势\n- 一键配置，不影响已有的vite配置\n- 支持vite开发环境\n\n#### 快速开始\n\n###### 1、在 `vite.config.ts` 中安装插件\n```typescript\n// vite.config.ts\n\nimport qiankun from 'vite-plugin-qiankun';\n\nexport default {\n  // 这里的 'myMicroAppName' 是子应用名，主应用注册时AppName需保持一致\n  plugins: [qiankun('myMicroAppName')],\n  // 生产环境需要指定运行域名作为base\n  base: 'http://xxx.com/'\n}\n```\n###### 2、在入口文件里面写入乾坤的生命周期配置\n\n```typescript\n// main.ts\nimport { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';\n\n// some code\nrenderWithQiankun({\n  mount(props) {\n    console.log('mount');\n    render(props);\n  },\n  bootstrap() {\n    console.log('bootstrap');\n  },\n  unmount(props: any) {\n    console.log('unmount');\n    const { container } = props;\n    const mountRoot = container?.querySelector('#root');\n    ReactDOM.unmountComponentAtNode(\n      mountRoot || document.querySelector('#root'),\n    );\n  },\n});\n\nif (!qiankunWindow.__POWERED_BY_QIANKUN__) {\n  render({});\n}\n```\n\n###### 3、dev下作为子应用调试\n\n> 因为开发环境作为子应用时与热更新插件（可能与其他修改html的插件也会存在冲突）有冲突，所以需要额外的调试配置\n\n```typescript\n// useDevMode 开启时与热更新插件冲突,使用变量切换\nconst useDevMode = true\n\nconst baseConfig: UserConfig = {\n  plugins: [\n    ...(\n      useDevMode ? [] : [\n        reactRefresh()\n      ]\n    ),\n    qiankun('viteapp', {\n      useDevMode\n    })\n  ],\n}\n```\n上面例子中 `useDevMode = true` 则不使用热更新插件，`useDevMode = false` 则能使用热更新，但无法作为子应用加载。\n\n###### 4、其它使用注意点 `qiankunWindow`\n\n因为es模块加载与`qiankun`的实现方式有些冲突，所以使用本插件实现的`qiankun`微应用里面没有运行在js沙盒中。所以在不可避免需要设置window上的属性时，尽量显示的操作js沙盒，否则可能会对其它子应用产生副作用。qiankun沙盒使用方式\n```typescript\nimport { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';\n\nqiankunWindow.customxxx = 'ssss'\n\nif (qiankunWindow.__POWERED_BY_QIANKUN__) {\n  console.log('我正在作为子应用运行')\n}\n\n```\n\n#### 例子\n\n详细的信息可以参考例子里面的使用方式\n ```\ngit clone xx\nnpm install\nnpm run example:install\n# 生产环境调试demo\nnpm run example:start\n# vite开发环境demo, demo中热更新已经关闭\nnpm run example:start-vite-dev\n```\n\n\n","readmeFilename":"readme.md"}