From 6a0a2601a47dd17e78a2720097339251c6718d7a Mon Sep 17 00:00:00 2001 From: gh-pages-bot <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 02:47:23 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20main=20from=20@=20web-infra-de?= =?UTF-8?q?v/modern.js@ac053281cf40078bf503e4ab6d278208d4463ef0=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module-tools/api/config/build-config.html | 2 +- .../module-tools/api/config/build-preset.html | 2 +- modern-js/module-tools/api/config/dev.html | 2 +- .../module-tools/api/config/plugins.html | 2 +- .../module-tools/api/config/testing.html | 2 +- modern-js/module-tools/api/index.html | 2 +- .../api/plugin-api/plugin-hooks.html | 2 +- .../components/faq-build-exception.html | 2 +- .../components/faq-build-other.html | 2 +- .../components/faq-build-product.html | 2 +- .../components/faq-storybook.html | 2 +- .../module-tools/components/faq-test.html | 2 +- .../module-tools/components/publish-emo.html | 2 +- .../components/register-esbuild-plugin.html | 2 +- .../components/release-module-doc.html | 2 +- .../en/api/config/build-config.html | 2 +- .../en/api/config/build-preset.html | 2 +- modern-js/module-tools/en/api/config/dev.html | 2 +- .../module-tools/en/api/config/plugins.html | 2 +- .../module-tools/en/api/config/testing.html | 2 +- modern-js/module-tools/en/api/index.html | 2 +- .../en/api/plugin-api/plugin-hooks.html | 2 +- .../en/components/faq-build-exception.html | 2 +- .../en/components/faq-build-other.html | 2 +- .../en/components/faq-build-product.html | 2 +- .../en/components/faq-storybook.html | 2 +- .../module-tools/en/components/faq-test.html | 2 +- .../en/components/publish-emo.html | 2 +- .../components/register-esbuild-plugin.html | 2 +- .../en/components/release-module-doc.html | 2 +- .../module-tools/en/guide/advance/asset.html | 2 +- .../en/guide/advance/build-umd.html | 2 +- .../module-tools/en/guide/advance/copy.html | 2 +- .../en/guide/advance/external-dependency.html | 2 +- .../guide/advance/in-depth-about-build.html | 2 +- .../advance/in-depth-about-dev-command.html | 2 +- .../guide/basic/before-getting-started.html | 2 +- .../en/guide/basic/command-preview.html | 2 +- .../en/guide/basic/modify-output-product.html | 2 +- .../en/guide/basic/publish-your-project.html | 2 +- .../en/guide/basic/use-micro-generator.html | 2 +- .../en/guide/basic/use-module-doc.html | 2 +- .../en/guide/basic/using-storybook.html | 2 +- .../en/guide/best-practices/components.html | 2 +- .../guide/best-practices/use-tailwindcss.html | 2 +- .../module-tools/en/guide/faq/basic.html | 2 +- .../module-tools/en/guide/faq/build.html | 6 +- .../module-tools/en/guide/faq/index.html | 2 +- .../module-tools/en/guide/faq/storybook.html | 6 +- modern-js/module-tools/en/guide/faq/test.html | 2 +- .../en/guide/intro/getting-started.html | 2 +- .../module-tools/en/guide/intro/welcome.html | 2 +- .../why-module-engineering-solution.html | 2 +- modern-js/module-tools/en/index.html | 2 +- .../en/plugins/guide/getting-started.html | 2 +- .../en/plugins/guide/plugin-object.html | 2 +- .../en/plugins/guide/setup-function.html | 2 +- .../en/plugins/official-list/overview.html | 2 +- .../plugins/official-list/plugin-babel.html | 2 +- .../plugins/official-list/plugin-banner.html | 2 +- .../plugins/official-list/plugin-import.html | 2 +- .../official-list/plugin-node-polyfill.html | 2 +- .../official-list/plugin-polyfill.html | 2 +- .../en/plugins/official-list/plugin-vue.html | 2 +- .../module-tools/guide/advance/asset.html | 2 +- .../module-tools/guide/advance/build-umd.html | 2 +- .../module-tools/guide/advance/copy.html | 2 +- .../guide/advance/external-dependency.html | 2 +- .../guide/advance/in-depth-about-build.html | 2 +- .../advance/in-depth-about-dev-command.html | 2 +- .../guide/basic/before-getting-started.html | 2 +- .../guide/basic/command-preview.html | 2 +- .../guide/basic/modify-output-product.html | 10 +- .../guide/basic/publish-your-project.html | 2 +- .../guide/basic/use-micro-generator.html | 2 +- .../guide/basic/use-module-doc.html | 2 +- .../guide/basic/using-storybook.html | 2 +- .../guide/best-practices/components.html | 2 +- .../guide/best-practices/use-tailwindcss.html | 2 +- modern-js/module-tools/guide/faq/basic.html | 2 +- modern-js/module-tools/guide/faq/build.html | 6 +- modern-js/module-tools/guide/faq/index.html | 2 +- .../module-tools/guide/faq/storybook.html | 6 +- modern-js/module-tools/guide/faq/test.html | 2 +- .../guide/intro/getting-started.html | 2 +- .../module-tools/guide/intro/welcome.html | 2 +- .../why-module-engineering-solution.html | 2 +- modern-js/module-tools/index.html | 2 +- .../plugins/guide/getting-started.html | 2 +- .../plugins/guide/plugin-object.html | 2 +- .../plugins/guide/setup-function.html | 2 +- .../plugins/official-list/overview.html | 2 +- .../plugins/official-list/plugin-babel.html | 2 +- .../plugins/official-list/plugin-banner.html | 2 +- .../plugins/official-list/plugin-import.html | 2 +- .../official-list/plugin-node-polyfill.html | 2 +- .../official-list/plugin-polyfill.html | 2 +- .../plugins/official-list/plugin-vue.html | 2 +- .../module-tools/static/js/1362.3be3fc30.js | 2 + ...CENSE.txt => 1362.3be3fc30.js.LICENSE.txt} | 914 +++++++++--------- .../module-tools/static/js/333.7fcb1a81.js | 2 - .../static/js/async/1005.8757a931.js | 2 + ...CENSE.txt => 1005.8757a931.js.LICENSE.txt} | 0 .../{4159.3e9cf225.js => 1095.ab4639f9.js} | 4 +- ...CENSE.txt => 1095.ab4639f9.js.LICENSE.txt} | 0 .../static/js/async/1166.fadfc0d7.js | 2 + ...CENSE.txt => 1166.fadfc0d7.js.LICENSE.txt} | 0 .../{5977.c60808b6.js => 1297.5bb5922c.js} | 4 +- ...CENSE.txt => 1297.5bb5922c.js.LICENSE.txt} | 0 .../static/js/async/131.7e780f65.js | 2 + ...ICENSE.txt => 131.7e780f65.js.LICENSE.txt} | 0 .../static/js/async/1310.d1270024.js | 2 + ...CENSE.txt => 1310.d1270024.js.LICENSE.txt} | 0 .../static/js/async/1342.6f7bd018.js | 2 - .../{1276.e7748929.js => 1563.bf6e86c1.js} | 4 +- ...CENSE.txt => 1563.bf6e86c1.js.LICENSE.txt} | 0 .../{301.c0705076.js => 1586.aa3224bf.js} | 4 +- ...CENSE.txt => 1586.aa3224bf.js.LICENSE.txt} | 0 .../static/js/async/1600.854a5d28.js | 2 + ...CENSE.txt => 1600.854a5d28.js.LICENSE.txt} | 0 .../{3934.38c21141.js => 1684.f3977b44.js} | 4 +- ...CENSE.txt => 1684.f3977b44.js.LICENSE.txt} | 0 .../{6148.214fdab7.js => 1711.1e576c94.js} | 4 +- ...CENSE.txt => 1711.1e576c94.js.LICENSE.txt} | 0 .../{6458.2d6a7f4e.js => 1800.6e537275.js} | 4 +- ...CENSE.txt => 1800.6e537275.js.LICENSE.txt} | 0 .../static/js/async/1819.ba3c2c1e.js | 2 + ...CENSE.txt => 1819.ba3c2c1e.js.LICENSE.txt} | 0 .../{1881.32ba02bd.js => 1867.578d6a53.js} | 4 +- ...CENSE.txt => 1867.578d6a53.js.LICENSE.txt} | 0 .../static/js/async/187.5dd663d0.js | 2 + ...ICENSE.txt => 187.5dd663d0.js.LICENSE.txt} | 0 .../{1671.3ac95ef0.js => 1877.d5f98786.js} | 4 +- ...CENSE.txt => 1877.d5f98786.js.LICENSE.txt} | 0 .../static/js/async/19.bb39e9ef.js | 2 + ...LICENSE.txt => 19.bb39e9ef.js.LICENSE.txt} | 0 .../{4521.5a2181e6.js => 1960.b65fe81c.js} | 4 +- ...CENSE.txt => 1960.b65fe81c.js.LICENSE.txt} | 0 .../static/js/async/21.a800b490.js | 2 - .../static/js/async/2217.ff1da134.js | 2 - .../static/js/async/2232.e0ecfc6e.js | 2 - .../static/js/async/2259.dd01802f.js | 2 + ...CENSE.txt => 2259.dd01802f.js.LICENSE.txt} | 0 .../static/js/async/2263.7762b818.js | 2 + ...CENSE.txt => 2263.7762b818.js.LICENSE.txt} | 0 .../static/js/async/2326.b310ad1d.js | 2 - .../static/js/async/240.756b04db.js | 2 - .../{5575.ce4d4add.js => 2414.362edd76.js} | 4 +- ...CENSE.txt => 2414.362edd76.js.LICENSE.txt} | 0 .../static/js/async/2509.0fc92784.js | 2 - .../{7767.b9556903.js => 2551.a606f1c1.js} | 4 +- ...CENSE.txt => 2551.a606f1c1.js.LICENSE.txt} | 0 .../static/js/async/270.312ebb2e.js | 2 + ...ICENSE.txt => 270.312ebb2e.js.LICENSE.txt} | 0 .../static/js/async/28.2444362f.js | 2 - .../static/js/async/281.ed5dacc6.js | 2 - .../{8175.9fda3d57.js => 2814.23f25c63.js} | 4 +- ...CENSE.txt => 2814.23f25c63.js.LICENSE.txt} | 0 .../{4248.63967d39.js => 2913.2b145c76.js} | 4 +- ...CENSE.txt => 2913.2b145c76.js.LICENSE.txt} | 0 .../static/js/async/2974.159183a5.js | 2 - .../static/js/async/310.4253327a.js | 2 + ...ICENSE.txt => 310.4253327a.js.LICENSE.txt} | 0 .../{6760.5df82a32.js => 3104.877feaa0.js} | 4 +- ...CENSE.txt => 3104.877feaa0.js.LICENSE.txt} | 0 .../static/js/async/330.0937e30f.js | 2 + ...ICENSE.txt => 330.0937e30f.js.LICENSE.txt} | 0 .../static/js/async/3351.9d189162.js | 2 - .../static/js/async/347.49ac8f09.js | 2 + ...ICENSE.txt => 347.49ac8f09.js.LICENSE.txt} | 0 .../{5102.71057cf8.js => 3535.ebab774e.js} | 4 +- ...CENSE.txt => 3535.ebab774e.js.LICENSE.txt} | 0 .../static/js/async/358.5fbfed29.js | 2 - .../static/js/async/3635.7f1cd7bc.js | 2 + ...CENSE.txt => 3635.7f1cd7bc.js.LICENSE.txt} | 0 .../{5608.806e6a1b.js => 3691.8143e3bf.js} | 4 +- ...CENSE.txt => 3691.8143e3bf.js.LICENSE.txt} | 0 .../static/js/async/3718.73adc53d.js | 2 - .../static/js/async/3747.04231f3b.js | 2 - .../static/js/async/3760.a3abbc2c.js | 2 - .../{4053.30624338.js => 3900.4969da18.js} | 4 +- ...CENSE.txt => 3900.4969da18.js.LICENSE.txt} | 0 .../{6356.53c422e3.js => 3937.df16bfbb.js} | 4 +- ...CENSE.txt => 3937.df16bfbb.js.LICENSE.txt} | 0 .../{3637.128b81a4.js => 3969.12bd3b87.js} | 4 +- ...CENSE.txt => 3969.12bd3b87.js.LICENSE.txt} | 0 .../static/js/async/4131.e7c23464.js | 2 + ...CENSE.txt => 4131.e7c23464.js.LICENSE.txt} | 0 .../{5055.7000603c.js => 4191.ec0c85d1.js} | 4 +- ...CENSE.txt => 4191.ec0c85d1.js.LICENSE.txt} | 0 .../{7524.842b2e3f.js => 4306.aa23082a.js} | 4 +- ...CENSE.txt => 4306.aa23082a.js.LICENSE.txt} | 0 .../static/js/async/4327.89e5ba97.js | 2 - .../static/js/async/433.b3f966b6.js | 2 - .../{8200.2c9b573e.js => 4344.57789f12.js} | 4 +- ...CENSE.txt => 4344.57789f12.js.LICENSE.txt} | 0 .../{2454.1092ba62.js => 4523.5b0b69f9.js} | 4 +- ...CENSE.txt => 4523.5b0b69f9.js.LICENSE.txt} | 0 .../static/js/async/4575.0ddcba6d.js | 2 + ...CENSE.txt => 4575.0ddcba6d.js.LICENSE.txt} | 0 .../{6955.09d1828c.js => 4607.a515024b.js} | 4 +- ...CENSE.txt => 4607.a515024b.js.LICENSE.txt} | 0 .../static/js/async/4699.75859fc3.js | 2 + ...CENSE.txt => 4699.75859fc3.js.LICENSE.txt} | 0 .../{2377.66c1b3fa.js => 4764.26a6f511.js} | 4 +- ...CENSE.txt => 4764.26a6f511.js.LICENSE.txt} | 0 .../{7626.2302d513.js => 4887.e31f697b.js} | 4 +- ...CENSE.txt => 4887.e31f697b.js.LICENSE.txt} | 0 .../static/js/async/5185.b039a3f1.js | 2 - .../{3016.83cb912e.js => 5188.3f3d6165.js} | 4 +- ...CENSE.txt => 5188.3f3d6165.js.LICENSE.txt} | 0 .../{9983.fc4a3f3f.js => 5269.379402a1.js} | 4 +- ...CENSE.txt => 5269.379402a1.js.LICENSE.txt} | 0 .../{4273.fb3f085a.js => 5305.1ac532a7.js} | 4 +- ...CENSE.txt => 5305.1ac532a7.js.LICENSE.txt} | 0 .../static/js/async/538.b354267e.js | 2 + ...ICENSE.txt => 538.b354267e.js.LICENSE.txt} | 0 .../static/js/async/5605.f19af8e6.js | 2 - .../static/js/async/5800.88e53b08.js | 2 + ...CENSE.txt => 5800.88e53b08.js.LICENSE.txt} | 0 .../static/js/async/5898.258bd4d1.js | 2 + ...CENSE.txt => 5898.258bd4d1.js.LICENSE.txt} | 0 .../{3253.c0c5fd3c.js => 6051.9006d708.js} | 4 +- ...CENSE.txt => 6051.9006d708.js.LICENSE.txt} | 0 .../static/js/async/6111.89a3f56e.js | 2 - .../{6844.b821cee1.js => 6167.59abe9e8.js} | 4 +- ...CENSE.txt => 6167.59abe9e8.js.LICENSE.txt} | 0 .../{5037.155e45d9.js => 6201.18880672.js} | 4 +- ...CENSE.txt => 6201.18880672.js.LICENSE.txt} | 0 .../static/js/async/6275.ceb5ba13.js | 2 + ...CENSE.txt => 6275.ceb5ba13.js.LICENSE.txt} | 0 .../static/js/async/638.36ecfdbd.js | 2 - .../static/js/async/6408.2dffc699.js | 2 - .../{8842.64147a1b.js => 6512.35d7bc4d.js} | 4 +- ...CENSE.txt => 6512.35d7bc4d.js.LICENSE.txt} | 0 .../{2458.bd7972f4.js => 6566.3ab6b5d9.js} | 4 +- ...CENSE.txt => 6566.3ab6b5d9.js.LICENSE.txt} | 0 .../{9343.2fa74d1e.js => 6573.8c6b5e09.js} | 4 +- ...CENSE.txt => 6573.8c6b5e09.js.LICENSE.txt} | 0 .../static/js/async/6658.aeef8790.js | 2 + ...CENSE.txt => 6658.aeef8790.js.LICENSE.txt} | 0 .../static/js/async/679.dad5d5aa.js | 2 - .../{4888.aefed6d6.js => 6800.b1b81661.js} | 4 +- ...CENSE.txt => 6800.b1b81661.js.LICENSE.txt} | 0 .../{7836.7593d13f.js => 705.8b38f041.js} | 4 +- ...ICENSE.txt => 705.8b38f041.js.LICENSE.txt} | 0 .../{1980.79b63473.js => 7115.001bfea1.js} | 4 +- ...CENSE.txt => 7115.001bfea1.js.LICENSE.txt} | 0 .../static/js/async/721.4493e1c6.js | 2 - .../static/js/async/7227.47916665.js | 2 - .../{4465.3480ef34.js => 7287.f2f905cd.js} | 4 +- ...CENSE.txt => 7287.f2f905cd.js.LICENSE.txt} | 0 .../static/js/async/7321.63e4af77.js | 2 + ...CENSE.txt => 7321.63e4af77.js.LICENSE.txt} | 0 .../{8738.736ed031.js => 7334.2b4d109f.js} | 4 +- ...CENSE.txt => 7334.2b4d109f.js.LICENSE.txt} | 0 .../{978.a32834bd.js => 737.8eedae12.js} | 4 +- ...ICENSE.txt => 737.8eedae12.js.LICENSE.txt} | 0 .../{5994.b1a304bb.js => 7426.32bc11b9.js} | 4 +- ...CENSE.txt => 7426.32bc11b9.js.LICENSE.txt} | 0 .../{5110.6bd38ea0.js => 7534.4139a31a.js} | 4 +- ...CENSE.txt => 7534.4139a31a.js.LICENSE.txt} | 0 .../{2436.ca618e73.js => 7565.d04bd6d3.js} | 4 +- ...CENSE.txt => 7565.d04bd6d3.js.LICENSE.txt} | 0 .../static/js/async/7664.c654123f.js | 2 + ...CENSE.txt => 7664.c654123f.js.LICENSE.txt} | 0 .../static/js/async/7698.3cc8e11f.js | 2 + ...CENSE.txt => 7698.3cc8e11f.js.LICENSE.txt} | 0 .../{1831.f3a83f13.js => 7782.70e3e8e1.js} | 4 +- ...CENSE.txt => 7782.70e3e8e1.js.LICENSE.txt} | 0 .../{9092.35775ebb.js => 7929.5d0e4c1f.js} | 4 +- ...CENSE.txt => 7929.5d0e4c1f.js.LICENSE.txt} | 0 .../{5562.ad6aae96.js => 7947.1bc4e2fe.js} | 4 +- ...CENSE.txt => 7947.1bc4e2fe.js.LICENSE.txt} | 0 .../static/js/async/803.9bccdc9e.js | 2 + ...ICENSE.txt => 803.9bccdc9e.js.LICENSE.txt} | 0 .../{9602.5e9dd124.js => 8058.a1f19999.js} | 4 +- ...CENSE.txt => 8058.a1f19999.js.LICENSE.txt} | 0 .../{9826.e8ebb4aa.js => 8067.3cf6d68d.js} | 4 +- ...CENSE.txt => 8067.3cf6d68d.js.LICENSE.txt} | 0 .../static/js/async/81.129c306f.js | 2 - .../static/js/async/8104.66e49f69.js | 2 + .../js/async/8104.66e49f69.js.LICENSE.txt | 5 + .../{5388.a629059c.js => 8269.4ed5a426.js} | 4 +- ...CENSE.txt => 8269.4ed5a426.js.LICENSE.txt} | 0 .../static/js/async/840.17ce598b.js | 2 - .../{8439.74d8f520.js => 8409.1be93ad7.js} | 4 +- ...CENSE.txt => 8409.1be93ad7.js.LICENSE.txt} | 0 .../static/js/async/8484.8075cc5a.js | 2 - .../static/js/async/8506.886cd5ae.js | 2 - .../static/js/async/8528.1ccd4f8d.js | 2 + .../js/async/8528.1ccd4f8d.js.LICENSE.txt | 5 + .../{7948.f52b62fa.js => 8571.1705338e.js} | 4 +- ...CENSE.txt => 8571.1705338e.js.LICENSE.txt} | 0 .../static/js/async/8580.1a78ef5f.js | 2 + ...CENSE.txt => 8580.1a78ef5f.js.LICENSE.txt} | 0 .../{5567.90015958.js => 8612.6fdbde84.js} | 4 +- ...CENSE.txt => 8612.6fdbde84.js.LICENSE.txt} | 0 .../static/js/async/865.6bb1555b.js | 2 - .../{3293.8c6de277.js => 8741.507fd5f7.js} | 4 +- ...CENSE.txt => 8741.507fd5f7.js.LICENSE.txt} | 0 .../{3777.44838359.js => 8746.f85b2010.js} | 4 +- ...CENSE.txt => 8746.f85b2010.js.LICENSE.txt} | 0 .../{8773.66b5f0c8.js => 8914.a2a0b7b9.js} | 4 +- .../js/async/8914.a2a0b7b9.js.LICENSE.txt | 5 + .../static/js/async/8954.12a56f9d.js | 2 - .../{7371.40bbf968.js => 8975.5404cc56.js} | 4 +- ...CENSE.txt => 8975.5404cc56.js.LICENSE.txt} | 0 .../static/js/async/8993.14d2528b.js | 2 - .../{9001.2aa57bcd.js => 9016.43a2da2a.js} | 4 +- ...CENSE.txt => 9016.43a2da2a.js.LICENSE.txt} | 0 .../{3497.4327456e.js => 9176.d1a045a2.js} | 4 +- ...CENSE.txt => 9176.d1a045a2.js.LICENSE.txt} | 0 .../static/js/async/9460.40dea9c9.js | 2 + ...CENSE.txt => 9460.40dea9c9.js.LICENSE.txt} | 0 .../static/js/async/9475.6320e3be.js | 2 + ...CENSE.txt => 9475.6320e3be.js.LICENSE.txt} | 0 .../static/js/async/9492.5b48b04b.js | 2 - .../js/async/9492.5b48b04b.js.LICENSE.txt | 3 - .../static/js/async/9549.c3191d68.js | 2 + ...CENSE.txt => 9549.c3191d68.js.LICENSE.txt} | 0 .../{952.6c5ac17e.js => 958.55859902.js} | 4 +- ...ICENSE.txt => 958.55859902.js.LICENSE.txt} | 2 - .../static/js/async/9587.54a19c07.js | 2 - .../js/async/9587.54a19c07.js.LICENSE.txt | 3 - .../{8683.7396e81f.js => 9675.0d4f59ca.js} | 4 +- ...CENSE.txt => 9675.0d4f59ca.js.LICENSE.txt} | 0 .../{7586.184e82bf.js => 9697.411c4dcd.js} | 4 +- ...CENSE.txt => 9697.411c4dcd.js.LICENSE.txt} | 2 - .../static/js/async/972.16544374.js | 2 + ...ICENSE.txt => 972.16544374.js.LICENSE.txt} | 2 - .../js/async/9826.e8ebb4aa.js.LICENSE.txt | 3 - .../{6917.5162bac3.js => 9931.b2327126.js} | 4 +- ...CENSE.txt => 9931.b2327126.js.LICENSE.txt} | 0 .../module-tools/static/js/index.5a5eef94.js | 2 + ...ENSE.txt => index.5a5eef94.js.LICENSE.txt} | 0 .../module-tools/static/js/index.89b31f62.js | 2 - ...l.7aec7d99.js => lib-polyfill.d1077309.js} | 4 +- ...t => lib-polyfill.d1077309.js.LICENSE.txt} | 46 +- ...a42.json => search_index.en.ea8d594a.json} | 2 +- ...30e.json => search_index.zh.10a5690c.json} | 2 +- 341 files changed, 809 insertions(+), 809 deletions(-) create mode 100644 modern-js/module-tools/static/js/1362.3be3fc30.js rename modern-js/module-tools/static/js/{333.7fcb1a81.js.LICENSE.txt => 1362.3be3fc30.js.LICENSE.txt} (99%) delete mode 100644 modern-js/module-tools/static/js/333.7fcb1a81.js create mode 100644 modern-js/module-tools/static/js/async/1005.8757a931.js rename modern-js/module-tools/static/js/async/{240.756b04db.js.LICENSE.txt => 1005.8757a931.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{4159.3e9cf225.js => 1095.ab4639f9.js} (96%) rename modern-js/module-tools/static/js/async/{1342.6f7bd018.js.LICENSE.txt => 1095.ab4639f9.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/1166.fadfc0d7.js rename modern-js/module-tools/static/js/async/{1671.3ac95ef0.js.LICENSE.txt => 1166.fadfc0d7.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5977.c60808b6.js => 1297.5bb5922c.js} (97%) rename modern-js/module-tools/static/js/async/{1831.f3a83f13.js.LICENSE.txt => 1297.5bb5922c.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/131.7e780f65.js rename modern-js/module-tools/static/js/async/{2454.1092ba62.js.LICENSE.txt => 131.7e780f65.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/1310.d1270024.js rename modern-js/module-tools/static/js/async/{1881.32ba02bd.js.LICENSE.txt => 1310.d1270024.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/1342.6f7bd018.js rename modern-js/module-tools/static/js/async/{1276.e7748929.js => 1563.bf6e86c1.js} (97%) rename modern-js/module-tools/static/js/async/{1276.e7748929.js.LICENSE.txt => 1563.bf6e86c1.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{301.c0705076.js => 1586.aa3224bf.js} (78%) rename modern-js/module-tools/static/js/async/{2974.159183a5.js.LICENSE.txt => 1586.aa3224bf.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/1600.854a5d28.js rename modern-js/module-tools/static/js/async/{2377.66c1b3fa.js.LICENSE.txt => 1600.854a5d28.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{3934.38c21141.js => 1684.f3977b44.js} (99%) rename modern-js/module-tools/static/js/async/{1980.79b63473.js.LICENSE.txt => 1684.f3977b44.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{6148.214fdab7.js => 1711.1e576c94.js} (98%) rename modern-js/module-tools/static/js/async/{6148.214fdab7.js.LICENSE.txt => 1711.1e576c94.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{6458.2d6a7f4e.js => 1800.6e537275.js} (97%) rename modern-js/module-tools/static/js/async/{21.a800b490.js.LICENSE.txt => 1800.6e537275.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/1819.ba3c2c1e.js rename modern-js/module-tools/static/js/async/{2217.ff1da134.js.LICENSE.txt => 1819.ba3c2c1e.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{1881.32ba02bd.js => 1867.578d6a53.js} (97%) rename modern-js/module-tools/static/js/async/{2232.e0ecfc6e.js.LICENSE.txt => 1867.578d6a53.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/187.5dd663d0.js rename modern-js/module-tools/static/js/async/{301.c0705076.js.LICENSE.txt => 187.5dd663d0.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{1671.3ac95ef0.js => 1877.d5f98786.js} (98%) rename modern-js/module-tools/static/js/async/{2326.b310ad1d.js.LICENSE.txt => 1877.d5f98786.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/19.bb39e9ef.js rename modern-js/module-tools/static/js/async/{2436.ca618e73.js.LICENSE.txt => 19.bb39e9ef.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{4521.5a2181e6.js => 1960.b65fe81c.js} (97%) rename modern-js/module-tools/static/js/async/{3253.c0c5fd3c.js.LICENSE.txt => 1960.b65fe81c.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/21.a800b490.js delete mode 100644 modern-js/module-tools/static/js/async/2217.ff1da134.js delete mode 100644 modern-js/module-tools/static/js/async/2232.e0ecfc6e.js create mode 100644 modern-js/module-tools/static/js/async/2259.dd01802f.js rename modern-js/module-tools/static/js/async/{2458.bd7972f4.js.LICENSE.txt => 2259.dd01802f.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/2263.7762b818.js rename modern-js/module-tools/static/js/async/{2509.0fc92784.js.LICENSE.txt => 2263.7762b818.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/2326.b310ad1d.js delete mode 100644 modern-js/module-tools/static/js/async/240.756b04db.js rename modern-js/module-tools/static/js/async/{5575.ce4d4add.js => 2414.362edd76.js} (98%) rename modern-js/module-tools/static/js/async/{28.2444362f.js.LICENSE.txt => 2414.362edd76.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/2509.0fc92784.js rename modern-js/module-tools/static/js/async/{7767.b9556903.js => 2551.a606f1c1.js} (71%) rename modern-js/module-tools/static/js/async/{3016.83cb912e.js.LICENSE.txt => 2551.a606f1c1.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/270.312ebb2e.js rename modern-js/module-tools/static/js/async/{358.5fbfed29.js.LICENSE.txt => 270.312ebb2e.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/28.2444362f.js delete mode 100644 modern-js/module-tools/static/js/async/281.ed5dacc6.js rename modern-js/module-tools/static/js/async/{8175.9fda3d57.js => 2814.23f25c63.js} (79%) rename modern-js/module-tools/static/js/async/{3351.9d189162.js.LICENSE.txt => 2814.23f25c63.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{4248.63967d39.js => 2913.2b145c76.js} (99%) rename modern-js/module-tools/static/js/async/{3718.73adc53d.js.LICENSE.txt => 2913.2b145c76.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/2974.159183a5.js create mode 100644 modern-js/module-tools/static/js/async/310.4253327a.js rename modern-js/module-tools/static/js/async/{3747.04231f3b.js.LICENSE.txt => 310.4253327a.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{6760.5df82a32.js => 3104.877feaa0.js} (98%) rename modern-js/module-tools/static/js/async/{3497.4327456e.js.LICENSE.txt => 3104.877feaa0.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/330.0937e30f.js rename modern-js/module-tools/static/js/async/{3760.a3abbc2c.js.LICENSE.txt => 330.0937e30f.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/3351.9d189162.js create mode 100644 modern-js/module-tools/static/js/async/347.49ac8f09.js rename modern-js/module-tools/static/js/async/{281.ed5dacc6.js.LICENSE.txt => 347.49ac8f09.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5102.71057cf8.js => 3535.ebab774e.js} (97%) rename modern-js/module-tools/static/js/async/{3637.128b81a4.js.LICENSE.txt => 3535.ebab774e.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/358.5fbfed29.js create mode 100644 modern-js/module-tools/static/js/async/3635.7f1cd7bc.js rename modern-js/module-tools/static/js/async/{4248.63967d39.js.LICENSE.txt => 3635.7f1cd7bc.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5608.806e6a1b.js => 3691.8143e3bf.js} (97%) rename modern-js/module-tools/static/js/async/{3777.44838359.js.LICENSE.txt => 3691.8143e3bf.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/3718.73adc53d.js delete mode 100644 modern-js/module-tools/static/js/async/3747.04231f3b.js delete mode 100644 modern-js/module-tools/static/js/async/3760.a3abbc2c.js rename modern-js/module-tools/static/js/async/{4053.30624338.js => 3900.4969da18.js} (93%) rename modern-js/module-tools/static/js/async/{3934.38c21141.js.LICENSE.txt => 3900.4969da18.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{6356.53c422e3.js => 3937.df16bfbb.js} (99%) rename modern-js/module-tools/static/js/async/{4053.30624338.js.LICENSE.txt => 3937.df16bfbb.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{3637.128b81a4.js => 3969.12bd3b87.js} (95%) rename modern-js/module-tools/static/js/async/{4159.3e9cf225.js.LICENSE.txt => 3969.12bd3b87.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/4131.e7c23464.js rename modern-js/module-tools/static/js/async/{5185.b039a3f1.js.LICENSE.txt => 4131.e7c23464.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5055.7000603c.js => 4191.ec0c85d1.js} (98%) rename modern-js/module-tools/static/js/async/{4273.fb3f085a.js.LICENSE.txt => 4191.ec0c85d1.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{7524.842b2e3f.js => 4306.aa23082a.js} (98%) rename modern-js/module-tools/static/js/async/{6917.5162bac3.js.LICENSE.txt => 4306.aa23082a.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/4327.89e5ba97.js delete mode 100644 modern-js/module-tools/static/js/async/433.b3f966b6.js rename modern-js/module-tools/static/js/async/{8200.2c9b573e.js => 4344.57789f12.js} (79%) rename modern-js/module-tools/static/js/async/{4327.89e5ba97.js.LICENSE.txt => 4344.57789f12.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{2454.1092ba62.js => 4523.5b0b69f9.js} (99%) rename modern-js/module-tools/static/js/async/{638.36ecfdbd.js.LICENSE.txt => 4523.5b0b69f9.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/4575.0ddcba6d.js rename modern-js/module-tools/static/js/async/{679.dad5d5aa.js.LICENSE.txt => 4575.0ddcba6d.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{6955.09d1828c.js => 4607.a515024b.js} (98%) rename modern-js/module-tools/static/js/async/{4465.3480ef34.js.LICENSE.txt => 4607.a515024b.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/4699.75859fc3.js rename modern-js/module-tools/static/js/async/{4888.aefed6d6.js.LICENSE.txt => 4699.75859fc3.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{2377.66c1b3fa.js => 4764.26a6f511.js} (97%) rename modern-js/module-tools/static/js/async/{4521.5a2181e6.js.LICENSE.txt => 4764.26a6f511.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{7626.2302d513.js => 4887.e31f697b.js} (61%) rename modern-js/module-tools/static/js/async/{721.4493e1c6.js.LICENSE.txt => 4887.e31f697b.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/5185.b039a3f1.js rename modern-js/module-tools/static/js/async/{3016.83cb912e.js => 5188.3f3d6165.js} (94%) rename modern-js/module-tools/static/js/async/{5037.155e45d9.js.LICENSE.txt => 5188.3f3d6165.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{9983.fc4a3f3f.js => 5269.379402a1.js} (99%) rename modern-js/module-tools/static/js/async/{7586.184e82bf.js.LICENSE.txt => 5269.379402a1.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{4273.fb3f085a.js => 5305.1ac532a7.js} (79%) rename modern-js/module-tools/static/js/async/{5055.7000603c.js.LICENSE.txt => 5305.1ac532a7.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/538.b354267e.js rename modern-js/module-tools/static/js/async/{7626.2302d513.js.LICENSE.txt => 538.b354267e.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/5605.f19af8e6.js create mode 100644 modern-js/module-tools/static/js/async/5800.88e53b08.js rename modern-js/module-tools/static/js/async/{5102.71057cf8.js.LICENSE.txt => 5800.88e53b08.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/5898.258bd4d1.js rename modern-js/module-tools/static/js/async/{5110.6bd38ea0.js.LICENSE.txt => 5898.258bd4d1.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{3253.c0c5fd3c.js => 6051.9006d708.js} (97%) rename modern-js/module-tools/static/js/async/{8773.66b5f0c8.js.LICENSE.txt => 6051.9006d708.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/6111.89a3f56e.js rename modern-js/module-tools/static/js/async/{6844.b821cee1.js => 6167.59abe9e8.js} (97%) rename modern-js/module-tools/static/js/async/{5388.a629059c.js.LICENSE.txt => 6167.59abe9e8.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5037.155e45d9.js => 6201.18880672.js} (90%) rename modern-js/module-tools/static/js/async/{5562.ad6aae96.js.LICENSE.txt => 6201.18880672.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/6275.ceb5ba13.js rename modern-js/module-tools/static/js/async/{5567.90015958.js.LICENSE.txt => 6275.ceb5ba13.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/638.36ecfdbd.js delete mode 100644 modern-js/module-tools/static/js/async/6408.2dffc699.js rename modern-js/module-tools/static/js/async/{8842.64147a1b.js => 6512.35d7bc4d.js} (98%) rename modern-js/module-tools/static/js/async/{5575.ce4d4add.js.LICENSE.txt => 6512.35d7bc4d.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{2458.bd7972f4.js => 6566.3ab6b5d9.js} (96%) rename modern-js/module-tools/static/js/async/{5605.f19af8e6.js.LICENSE.txt => 6566.3ab6b5d9.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{9343.2fa74d1e.js => 6573.8c6b5e09.js} (99%) rename modern-js/module-tools/static/js/async/{840.17ce598b.js.LICENSE.txt => 6573.8c6b5e09.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/6658.aeef8790.js rename modern-js/module-tools/static/js/async/{5608.806e6a1b.js.LICENSE.txt => 6658.aeef8790.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/679.dad5d5aa.js rename modern-js/module-tools/static/js/async/{4888.aefed6d6.js => 6800.b1b81661.js} (97%) rename modern-js/module-tools/static/js/async/{5977.c60808b6.js.LICENSE.txt => 6800.b1b81661.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{7836.7593d13f.js => 705.8b38f041.js} (98%) rename modern-js/module-tools/static/js/async/{5994.b1a304bb.js.LICENSE.txt => 705.8b38f041.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{1980.79b63473.js => 7115.001bfea1.js} (79%) rename modern-js/module-tools/static/js/async/{6111.89a3f56e.js.LICENSE.txt => 7115.001bfea1.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/721.4493e1c6.js delete mode 100644 modern-js/module-tools/static/js/async/7227.47916665.js rename modern-js/module-tools/static/js/async/{4465.3480ef34.js => 7287.f2f905cd.js} (99%) rename modern-js/module-tools/static/js/async/{6356.53c422e3.js.LICENSE.txt => 7287.f2f905cd.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/7321.63e4af77.js rename modern-js/module-tools/static/js/async/{6458.2d6a7f4e.js.LICENSE.txt => 7321.63e4af77.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{8738.736ed031.js => 7334.2b4d109f.js} (97%) rename modern-js/module-tools/static/js/async/{6760.5df82a32.js.LICENSE.txt => 7334.2b4d109f.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{978.a32834bd.js => 737.8eedae12.js} (99%) rename modern-js/module-tools/static/js/async/{865.6bb1555b.js.LICENSE.txt => 737.8eedae12.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5994.b1a304bb.js => 7426.32bc11b9.js} (71%) rename modern-js/module-tools/static/js/async/{6844.b821cee1.js.LICENSE.txt => 7426.32bc11b9.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5110.6bd38ea0.js => 7534.4139a31a.js} (99%) rename modern-js/module-tools/static/js/async/{6955.09d1828c.js.LICENSE.txt => 7534.4139a31a.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{2436.ca618e73.js => 7565.d04bd6d3.js} (97%) rename modern-js/module-tools/static/js/async/{7227.47916665.js.LICENSE.txt => 7565.d04bd6d3.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/7664.c654123f.js rename modern-js/module-tools/static/js/async/{7371.40bbf968.js.LICENSE.txt => 7664.c654123f.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/7698.3cc8e11f.js rename modern-js/module-tools/static/js/async/{8993.14d2528b.js.LICENSE.txt => 7698.3cc8e11f.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{1831.f3a83f13.js => 7782.70e3e8e1.js} (97%) rename modern-js/module-tools/static/js/async/{7767.b9556903.js.LICENSE.txt => 7782.70e3e8e1.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{9092.35775ebb.js => 7929.5d0e4c1f.js} (99%) rename modern-js/module-tools/static/js/async/{7836.7593d13f.js.LICENSE.txt => 7929.5d0e4c1f.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5562.ad6aae96.js => 7947.1bc4e2fe.js} (99%) rename modern-js/module-tools/static/js/async/{7948.f52b62fa.js.LICENSE.txt => 7947.1bc4e2fe.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/803.9bccdc9e.js rename modern-js/module-tools/static/js/async/{9343.2fa74d1e.js.LICENSE.txt => 803.9bccdc9e.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{9602.5e9dd124.js => 8058.a1f19999.js} (99%) rename modern-js/module-tools/static/js/async/{952.6c5ac17e.js.LICENSE.txt => 8058.a1f19999.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{9826.e8ebb4aa.js => 8067.3cf6d68d.js} (85%) rename modern-js/module-tools/static/js/async/{81.129c306f.js.LICENSE.txt => 8067.3cf6d68d.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/81.129c306f.js create mode 100644 modern-js/module-tools/static/js/async/8104.66e49f69.js create mode 100644 modern-js/module-tools/static/js/async/8104.66e49f69.js.LICENSE.txt rename modern-js/module-tools/static/js/async/{5388.a629059c.js => 8269.4ed5a426.js} (95%) rename modern-js/module-tools/static/js/async/{8175.9fda3d57.js.LICENSE.txt => 8269.4ed5a426.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/840.17ce598b.js rename modern-js/module-tools/static/js/async/{8439.74d8f520.js => 8409.1be93ad7.js} (99%) rename modern-js/module-tools/static/js/async/{8200.2c9b573e.js.LICENSE.txt => 8409.1be93ad7.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/8484.8075cc5a.js delete mode 100644 modern-js/module-tools/static/js/async/8506.886cd5ae.js create mode 100644 modern-js/module-tools/static/js/async/8528.1ccd4f8d.js create mode 100644 modern-js/module-tools/static/js/async/8528.1ccd4f8d.js.LICENSE.txt rename modern-js/module-tools/static/js/async/{7948.f52b62fa.js => 8571.1705338e.js} (93%) rename modern-js/module-tools/static/js/async/{8439.74d8f520.js.LICENSE.txt => 8571.1705338e.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/8580.1a78ef5f.js rename modern-js/module-tools/static/js/async/{8506.886cd5ae.js.LICENSE.txt => 8580.1a78ef5f.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{5567.90015958.js => 8612.6fdbde84.js} (98%) rename modern-js/module-tools/static/js/async/{8738.736ed031.js.LICENSE.txt => 8612.6fdbde84.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/865.6bb1555b.js rename modern-js/module-tools/static/js/async/{3293.8c6de277.js => 8741.507fd5f7.js} (96%) rename modern-js/module-tools/static/js/async/{3293.8c6de277.js.LICENSE.txt => 8741.507fd5f7.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{3777.44838359.js => 8746.f85b2010.js} (90%) rename modern-js/module-tools/static/js/async/{8842.64147a1b.js.LICENSE.txt => 8746.f85b2010.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{8773.66b5f0c8.js => 8914.a2a0b7b9.js} (98%) create mode 100644 modern-js/module-tools/static/js/async/8914.a2a0b7b9.js.LICENSE.txt delete mode 100644 modern-js/module-tools/static/js/async/8954.12a56f9d.js rename modern-js/module-tools/static/js/async/{7371.40bbf968.js => 8975.5404cc56.js} (99%) rename modern-js/module-tools/static/js/async/{8954.12a56f9d.js.LICENSE.txt => 8975.5404cc56.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/8993.14d2528b.js rename modern-js/module-tools/static/js/async/{9001.2aa57bcd.js => 9016.43a2da2a.js} (95%) rename modern-js/module-tools/static/js/async/{9001.2aa57bcd.js.LICENSE.txt => 9016.43a2da2a.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{3497.4327456e.js => 9176.d1a045a2.js} (99%) rename modern-js/module-tools/static/js/async/{9092.35775ebb.js.LICENSE.txt => 9176.d1a045a2.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/9460.40dea9c9.js rename modern-js/module-tools/static/js/async/{9602.5e9dd124.js.LICENSE.txt => 9460.40dea9c9.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/async/9475.6320e3be.js rename modern-js/module-tools/static/js/async/{978.a32834bd.js.LICENSE.txt => 9475.6320e3be.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/async/9492.5b48b04b.js delete mode 100644 modern-js/module-tools/static/js/async/9492.5b48b04b.js.LICENSE.txt create mode 100644 modern-js/module-tools/static/js/async/9549.c3191d68.js rename modern-js/module-tools/static/js/async/{9983.fc4a3f3f.js.LICENSE.txt => 9549.c3191d68.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{952.6c5ac17e.js => 958.55859902.js} (61%) rename modern-js/module-tools/static/js/async/{433.b3f966b6.js.LICENSE.txt => 958.55859902.js.LICENSE.txt} (75%) delete mode 100644 modern-js/module-tools/static/js/async/9587.54a19c07.js delete mode 100644 modern-js/module-tools/static/js/async/9587.54a19c07.js.LICENSE.txt rename modern-js/module-tools/static/js/async/{8683.7396e81f.js => 9675.0d4f59ca.js} (98%) rename modern-js/module-tools/static/js/async/{7524.842b2e3f.js.LICENSE.txt => 9675.0d4f59ca.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/js/async/{7586.184e82bf.js => 9697.411c4dcd.js} (99%) rename modern-js/module-tools/static/js/async/{6408.2dffc699.js.LICENSE.txt => 9697.411c4dcd.js.LICENSE.txt} (75%) create mode 100644 modern-js/module-tools/static/js/async/972.16544374.js rename modern-js/module-tools/static/js/async/{8484.8075cc5a.js.LICENSE.txt => 972.16544374.js.LICENSE.txt} (75%) delete mode 100644 modern-js/module-tools/static/js/async/9826.e8ebb4aa.js.LICENSE.txt rename modern-js/module-tools/static/js/async/{6917.5162bac3.js => 9931.b2327126.js} (98%) rename modern-js/module-tools/static/js/async/{8683.7396e81f.js.LICENSE.txt => 9931.b2327126.js.LICENSE.txt} (100%) create mode 100644 modern-js/module-tools/static/js/index.5a5eef94.js rename modern-js/module-tools/static/js/{index.89b31f62.js.LICENSE.txt => index.5a5eef94.js.LICENSE.txt} (100%) delete mode 100644 modern-js/module-tools/static/js/index.89b31f62.js rename modern-js/module-tools/static/js/{lib-polyfill.7aec7d99.js => lib-polyfill.d1077309.js} (86%) rename modern-js/module-tools/static/js/{lib-polyfill.7aec7d99.js.LICENSE.txt => lib-polyfill.d1077309.js.LICENSE.txt} (100%) rename modern-js/module-tools/static/{search_index.en.2cd9fa42.json => search_index.en.ea8d594a.json} (78%) rename modern-js/module-tools/static/{search_index.zh.678be30e.json => search_index.zh.10a5690c.json} (52%) diff --git a/modern-js/module-tools/api/config/build-config.html b/modern-js/module-tools/api/config/build-config.html index 2848dce44e..5fd0042783 100644 --- a/modern-js/module-tools/api/config/build-config.html +++ b/modern-js/module-tools/api/config/build-config.html @@ -1,4 +1,4 @@ -buildConfig - Modern.js ModuleModern.js Module

buildConfig

+buildConfig - Modern.js ModuleModern.js Module

buildConfig

buildConfig 是一个用来描述如何编译、生成构建产物的配置项,它包含了构建的所有配置。

  • 类型:object | object[]
  • diff --git a/modern-js/module-tools/api/config/build-preset.html b/modern-js/module-tools/api/config/build-preset.html index 8a77c3d898..93428de821 100644 --- a/modern-js/module-tools/api/config/build-preset.html +++ b/modern-js/module-tools/api/config/build-preset.html @@ -1,4 +1,4 @@ -buildPreset - Modern.js ModuleModern.js Module

    buildPreset

    +buildPreset - Modern.js ModuleModern.js Module

    buildPreset

    构建的预设字符串或者预设函数。提供开箱即用的构建配置。

    • diff --git a/modern-js/module-tools/api/config/dev.html b/modern-js/module-tools/api/config/dev.html index d27da1a7ce..accf1c56ee 100644 --- a/modern-js/module-tools/api/config/dev.html +++ b/modern-js/module-tools/api/config/dev.html @@ -1,4 +1,4 @@ -dev - Modern.js ModuleModern.js Module

      dev

      +dev - Modern.js ModuleModern.js Module

      dev

      本章节描述了 Modern.js Module 关于调试工具相关的所有配置。

      storybook

      WARNING

      Deprecated:该配置已过时,只适用于 StorybookV6,详情请看使用Storybook。 diff --git a/modern-js/module-tools/api/config/plugins.html b/modern-js/module-tools/api/config/plugins.html index e5d3214043..c45912204b 100644 --- a/modern-js/module-tools/api/config/plugins.html +++ b/modern-js/module-tools/api/config/plugins.html @@ -1,4 +1,4 @@ -plugins - Modern.js ModuleModern.js Module

      plugins

      +plugins - Modern.js ModuleModern.js Module

      plugins

      本章介绍注册 Modern.js Module 插件的配置。

      • 类型:ModuleToolsPlugin[]
      • diff --git a/modern-js/module-tools/api/config/testing.html b/modern-js/module-tools/api/config/testing.html index f3826a9b33..8e3ff0f8ea 100644 --- a/modern-js/module-tools/api/config/testing.html +++ b/modern-js/module-tools/api/config/testing.html @@ -1,4 +1,4 @@ -testing - Modern.js ModuleModern.js Module

        testing

        +testing - Modern.js ModuleModern.js Module

        testing

        本章描述了测试相关的配置。

        TIP

        需要先通过 pnpm run new 启用 单元测试 功能。

        diff --git a/modern-js/module-tools/api/index.html b/modern-js/module-tools/api/index.html index 665e8ea1cd..24fb224d14 100644 --- a/modern-js/module-tools/api/index.html +++ b/modern-js/module-tools/api/index.html @@ -1 +1 @@ -概览 - Modern.js ModuleModern.js Module
        \ No newline at end of file +概览 - Modern.js ModuleModern.js Module
        \ No newline at end of file diff --git a/modern-js/module-tools/api/plugin-api/plugin-hooks.html b/modern-js/module-tools/api/plugin-api/plugin-hooks.html index 9006ccf3ee..78d734e762 100644 --- a/modern-js/module-tools/api/plugin-api/plugin-hooks.html +++ b/modern-js/module-tools/api/plugin-api/plugin-hooks.html @@ -1,4 +1,4 @@ -Plugin Hooks - Modern.js ModuleModern.js Module

        Plugin Hooks

        +Plugin Hooks - Modern.js ModuleModern.js Module

        Plugin Hooks

        本章介绍关于 Modern.js Module 支持的生命周期钩子。

        目前主要包含以下几类生命周期钩子:

        \ No newline at end of file diff --git a/modern-js/module-tools/guide/faq/test.html b/modern-js/module-tools/guide/faq/test.html index 6280b34a6c..715be28aa4 100644 --- a/modern-js/module-tools/guide/faq/test.html +++ b/modern-js/module-tools/guide/faq/test.html @@ -1,4 +1,4 @@ -测试相关问题 - Modern.js ModuleModern.js Module

        测试相关问题

        +测试相关问题 - Modern.js ModuleModern.js Module

        测试相关问题

        执行 test 命令报错 TypeError: Cannot read property 'testEnvironmentOptions' of undefined

        jest-error

        问题原因多是存在多个版本的 jest-environment-jsdom 依赖,可以检查 Monorepo 中其他项目是否有 jest-environment-jsdom 依赖,并通过 Monorepo 提供的 overrides 能力统一依赖版本。

        \ No newline at end of file diff --git a/modern-js/module-tools/guide/intro/getting-started.html b/modern-js/module-tools/guide/intro/getting-started.html index 3d98799507..f185a1a67f 100644 --- a/modern-js/module-tools/guide/intro/getting-started.html +++ b/modern-js/module-tools/guide/intro/getting-started.html @@ -1,4 +1,4 @@ -快速开始 - Modern.js ModuleModern.js Module

        快速开始

        +快速开始 - Modern.js ModuleModern.js Module

        快速开始

        三分钟快速上手

        想要实际体验 Modern.js Module?首先你需要安装 Node.js LTS,并确保 Node 版本大于等于 16.0.0。我们推荐使用 Node.js 18 的 LTS 版本。

        创建新项目

        diff --git a/modern-js/module-tools/guide/intro/welcome.html b/modern-js/module-tools/guide/intro/welcome.html index c05cd6f0b1..7fc8399e59 100644 --- a/modern-js/module-tools/guide/intro/welcome.html +++ b/modern-js/module-tools/guide/intro/welcome.html @@ -1,4 +1,4 @@ -欢迎使用 - Modern.js ModuleModern.js Module

        欢迎使用

        +欢迎使用 - Modern.js ModuleModern.js Module

        欢迎使用

        Modern.js Module 是 Modern.js 的模块工程解决方案,同时也是核心依赖。它可以让开发者更轻松地构建、调试、发布模块类型的项目。模块类型的项目大多数情况可以认为是 npm 包类型的项目,它可能是一个组件、组件库或者工具库项目。

        如果你正打算开发一个 npm 包类型的项目,那么你就来对地方了!Modern.js 提供了专业的模块工程解决方案。它带来了:

          diff --git a/modern-js/module-tools/guide/intro/why-module-engineering-solution.html b/modern-js/module-tools/guide/intro/why-module-engineering-solution.html index 46b420148f..f45ac5299f 100644 --- a/modern-js/module-tools/guide/intro/why-module-engineering-solution.html +++ b/modern-js/module-tools/guide/intro/why-module-engineering-solution.html @@ -1,4 +1,4 @@ -为什么需要 Modern.js Module - Modern.js ModuleModern.js Module

          为什么需要 Modern.js Module

          +为什么需要 Modern.js Module - Modern.js ModuleModern.js Module

          为什么需要 Modern.js Module

          大家可能都经历过:从零开始开发一个组件库或者工具库的过程中,我们不仅要考虑项目本身的代码逻辑如何编写,还要考虑项目的构建、调试、测试、代码格式化等等和代码逻辑无关的事情。

          比如说,当我们考虑构建模块项目的代码是使用什么构建工具的时候,在之前我们可能会考虑使用 webpack 还是 Rollup,然而现在的话,也许还会考虑是使用 esbuild 还是 SWC

          无论选择哪个构建工具,这对于没有熟练掌握这些构建工具使用方式的开发者来说,是需要一定的成本去学习的。即使想要快速使用,也会需要花费大量的时间和精力。

          diff --git a/modern-js/module-tools/index.html b/modern-js/module-tools/index.html index a3b669dd0e..31d4e6a318 100644 --- a/modern-js/module-tools/index.html +++ b/modern-js/module-tools/index.html @@ -1 +1 @@ -Modern.js ModuleModern.js Module

          Modern.js Module

          模块工程解决方案

          简单、强大、高性能的现代化 npm 包开发方案

          🚀

          esbuild: 高性能的 JS Bundler

          基于 esbuild 构建,构建速度极快,带给你极致的开发体验。

          双构建模式

          支持 Bundle 和 Bundleless 两种构建模式。

          🛠️

          开箱即用

          无需过多配置即可开发你的 npm 包,内置预设覆盖多种场景。

          🎨

          扩展性强: 提供强大的插件机制

          通过其插件扩展机制,你可以轻松的扩展 Modern.js Module 的各项能力。

          📦

          Storybook: 社区流行的 UI 开发工具

          集成了 Storybook,你可以使用它调试 UI。

          📐

          Jest: 令人愉快的测试框架

          集成了 Jest,使得代码测试更加容易。

          Copyright © 2023 ByteDance.
          \ No newline at end of file +Modern.js ModuleModern.js Module

          Modern.js Module

          模块工程解决方案

          简单、强大、高性能的现代化 npm 包开发方案

          🚀

          esbuild: 高性能的 JS Bundler

          基于 esbuild 构建,构建速度极快,带给你极致的开发体验。

          双构建模式

          支持 Bundle 和 Bundleless 两种构建模式。

          🛠️

          开箱即用

          无需过多配置即可开发你的 npm 包,内置预设覆盖多种场景。

          🎨

          扩展性强: 提供强大的插件机制

          通过其插件扩展机制,你可以轻松的扩展 Modern.js Module 的各项能力。

          📦

          Storybook: 社区流行的 UI 开发工具

          集成了 Storybook,你可以使用它调试 UI。

          📐

          Jest: 令人愉快的测试框架

          集成了 Jest,使得代码测试更加容易。

          Copyright © 2023 ByteDance.
          \ No newline at end of file diff --git a/modern-js/module-tools/plugins/guide/getting-started.html b/modern-js/module-tools/plugins/guide/getting-started.html index 3f0519d082..13dfff2f93 100644 --- a/modern-js/module-tools/plugins/guide/getting-started.html +++ b/modern-js/module-tools/plugins/guide/getting-started.html @@ -1,4 +1,4 @@ -快速开始 - Modern.js ModuleModern.js Module

          快速开始

          +快速开始 - Modern.js ModuleModern.js Module

          快速开始

          Modern.js Module 不仅提供了丰富的功能,同时也支持通过插件的方式为当前项目扩展能力。

          我们可以通过下面的例子来快速了解如何编写一个 Modern.js Module 插件:

            diff --git a/modern-js/module-tools/plugins/guide/plugin-object.html b/modern-js/module-tools/plugins/guide/plugin-object.html index c7f31a0f38..cf4511c48e 100644 --- a/modern-js/module-tools/plugins/guide/plugin-object.html +++ b/modern-js/module-tools/plugins/guide/plugin-object.html @@ -1,4 +1,4 @@ -插件对象 - Modern.js ModuleModern.js Module

            插件对象

            +插件对象 - Modern.js ModuleModern.js Module

            插件对象

            Modern.js Module 的插件是一个对象,对象包含以下属性:

            • name:插件的名称,唯一标识符。
            • diff --git a/modern-js/module-tools/plugins/guide/setup-function.html b/modern-js/module-tools/plugins/guide/setup-function.html index c2823bd031..69cbe83213 100644 --- a/modern-js/module-tools/plugins/guide/setup-function.html +++ b/modern-js/module-tools/plugins/guide/setup-function.html @@ -1,4 +1,4 @@ -Setup 函数 - Modern.js ModuleModern.js Module

              Setup 函数

              +Setup 函数 - Modern.js ModuleModern.js Module

              Setup 函数

              「插件对象」 部分我们知道插件对象包含了一个 setup 函数,该函数不仅包含了一个 api 对象参数,同时还可以返回一个 Hooks 对象。

              插件 API 对象

              插件的 setup 函数会提供一个 api 对象参数,你可以调用该对象上提供的一些方法来获取到配置、项目上下文等信息。

              diff --git a/modern-js/module-tools/plugins/official-list/overview.html b/modern-js/module-tools/plugins/official-list/overview.html index b6a4546222..0b429ec442 100644 --- a/modern-js/module-tools/plugins/official-list/overview.html +++ b/modern-js/module-tools/plugins/official-list/overview.html @@ -1,4 +1,4 @@ -总览 - Modern.js ModuleModern.js Module

              总览

              +总览 - Modern.js ModuleModern.js Module

              总览

              官方插件

              • @modern-js/plugin-module-import:使用 SWC 提供与 babel-plugin-import 一样的能力。
              • diff --git a/modern-js/module-tools/plugins/official-list/plugin-babel.html b/modern-js/module-tools/plugins/official-list/plugin-babel.html index 25218cee7a..5ee00b97a5 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-babel.html +++ b/modern-js/module-tools/plugins/official-list/plugin-babel.html @@ -1,4 +1,4 @@ -Babel 插件 - Modern.js ModuleModern.js Module

                Babel 插件

                +Babel 插件 - Modern.js ModuleModern.js Module

                Babel 插件

                TIP

                通常情况下,我们无需使用 Babel 转换我们的代码,此插件仅作为一种降级方式。

                快速开始

                安装

                diff --git a/modern-js/module-tools/plugins/official-list/plugin-banner.html b/modern-js/module-tools/plugins/official-list/plugin-banner.html index b31bb69cf1..f046846c73 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-banner.html +++ b/modern-js/module-tools/plugins/official-list/plugin-banner.html @@ -1,4 +1,4 @@ -Banner 插件 - Modern.js ModuleModern.js Module

                Banner 插件

                +Banner 插件 - Modern.js ModuleModern.js Module

                Banner 插件

                提供为每个 JS 和 CSS 文件的顶部和底部注入内容的能力。

                TIP

                @modern-js/module-tools 2.36.0 版本开始,该插件功能内置在 Modern.js Module 中,由 bannerfooter 配置提供。 diff --git a/modern-js/module-tools/plugins/official-list/plugin-import.html b/modern-js/module-tools/plugins/official-list/plugin-import.html index d9295b3b7e..a303f8e121 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-import.html +++ b/modern-js/module-tools/plugins/official-list/plugin-import.html @@ -1,4 +1,4 @@ -Import 插件 - Modern.js ModuleModern.js Module

                Import 插件

                +Import 插件 - Modern.js ModuleModern.js Module

                Import 插件

                提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现。

                TIP

                @modern-js/module-tools 2.16.0 版本开始,该插件功能内置在 Modern.js Module 中,由 transformImport 配置提供。 diff --git a/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html b/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html index 6c59fc1ab6..625ba8c74d 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html +++ b/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html @@ -1,4 +1,4 @@ -Node Polyfill 插件 - Modern.js ModuleModern.js Module

                Node Polyfill 插件

                +Node Polyfill 插件 - Modern.js ModuleModern.js Module

                Node Polyfill 插件

                Node Polyfill 介绍

                通常情况下,我们不会在浏览器端使用 Node 模块。但在当前代码需要同时在 Node 端和浏览器端运行时,用到一些 Node 模块是有可能的。Node Polyfill 为这些 Node 模块提供了浏览器版本的 polyfills。

                通过使用 Node Polyfill 插件,会自动注入 Node 核心模块在浏览器端的 polyfills,让你可以在浏览器端放心使用这些模块。

                快速开始

                diff --git a/modern-js/module-tools/plugins/official-list/plugin-polyfill.html b/modern-js/module-tools/plugins/official-list/plugin-polyfill.html index c8234be85a..373a6e42f9 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-polyfill.html +++ b/modern-js/module-tools/plugins/official-list/plugin-polyfill.html @@ -1,4 +1,4 @@ -Polyfill 插件 - Modern.js ModuleModern.js Module

                Polyfill 插件

                +Polyfill 插件 - Modern.js ModuleModern.js Module

                Polyfill 插件

                TIP

                通常情况下,我们不需要为 npm 包注入 polyfill,这一步应该在 Web 应用的框架侧完成,但是在某些场景,为了让我们的库能够直接运行在低版本浏览器里,我们需要注入 polyfill。

                请注意,此插件并不会转化你的代码语法,只会为你的代码中使用到的不支持的功能注入 polyfill,把它们作为普通函数导入而不是污染全局。你需要安装 core-js-pure 依赖

                diff --git a/modern-js/module-tools/plugins/official-list/plugin-vue.html b/modern-js/module-tools/plugins/official-list/plugin-vue.html index 3964ca8b73..4b0ca9e567 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-vue.html +++ b/modern-js/module-tools/plugins/official-list/plugin-vue.html @@ -1,4 +1,4 @@ -Vue 插件 - Modern.js ModuleModern.js Module

                Vue 插件

                +Vue 插件 - Modern.js ModuleModern.js Module

                Vue 插件

                Vue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 esbuild-plugin-vue3@vue/babel-plugin-jsx

                WARNING

                请注意,此插件仍有一些用法限制:

                  diff --git a/modern-js/module-tools/static/js/1362.3be3fc30.js b/modern-js/module-tools/static/js/1362.3be3fc30.js new file mode 100644 index 0000000000..01fc1e14c4 --- /dev/null +++ b/modern-js/module-tools/static/js/1362.3be3fc30.js @@ -0,0 +1,2 @@ +/*! For license information please see 1362.3be3fc30.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1362"],{95929:function(e,t,n){"use strict";n.d(t,{V:function(){return h}});var i=n("39980"),r=n("2363"),o=n("8319"),a=n("11207"),l=n("13328"),s=n("92688"),d=n("51812");let{routes:c}=n("99593"),u=(0,r.memo)(function(e){let t=e.el;return l.Z?.themeConfig?.enableContentAnimation&&(t=(0,d.n_)(e.el)),t},(e,t)=>e.el===t.el),h=({fallback:e=(0,i.jsx)(i.Fragment,{})})=>{let{pathname:t}=(0,o.TH)(),n=(0,a.fp)(c,(0,s.Tm)(t));if(!n)return(0,i.jsx)("div",{});let l=n[0].route.element;return(0,i.jsx)(r.Suspense,{fallback:e,children:(0,i.jsx)(u,{el:l})})}},40741:function(e,t,n){"use strict";n.d(t,{r:function(){return o}});var i=n("39980"),r=n("2363");function o(e){let{children:t}=e,[n,o]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{o(!0)},[]),n)?(0,i.jsx)(i.Fragment,{children:t}):null}},51812:function(e,t,n){"use strict";n.d(t,{Jr:function(){return s},Ni:function(){return a},R0:function(){return o},Vi:function(){return l},aw:function(){return d},n_:function(){return c}});var i=n("2363"),r=n("61850");let o=(0,i.createContext)({}),a=(0,i.createContext)({});function l(){return(0,i.useContext)(o).data}function s(){return(0,i.useContext)(o).data.page.lang||""}function d(){return(0,i.useContext)(o).data.page.version||""}function c(e){let[t,n]=(0,i.useState)(e);return(0,i.useLayoutEffect)(()=>{document.startViewTransition&&t!==e?document.startViewTransition(()=>{(0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent"))}):((0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent")))},[e]),t}},92688:function(e,t,n){"use strict";n.d(t,{AP:function(){return d},E9:function(){return l},Tm:function(){return o},i6:function(){return c},pJ:function(){return a},pV:function(){return s}});var i=n("13328"),r=n("72855");function o(e){return decodeURIComponent(e).replace(/\.html$/,"").replace(/\/index$/,"/")}function a(e="/"){return(0,r.pJ)(e,i.Z.base)}function l(e){return(0,r.E9)(e,i.Z.base)}function s(e,t){return a(d((0,r.lm)(e)))===a(d((0,r.lm)(t)))}function d(e){let t=!!i.Z?.route?.cleanUrls;return(0,r.yc)(e,t)}function c(e){return!(0,r.yv)()||(0,r.xf)(e)||(0,r.pZ)(e)?e:a(e)}},12555:function(e,t,n){"use strict";n.d(t,{Qp:function(){return v},tP:function(){return b}});var i=!1;if("undefined"!=typeof window){var r={get passive(){i=!0;return}};window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),a=[],l=!1,s=-1,d=void 0,c=void 0,u=void 0,h=function(e){return a.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))||!1})},p=function(e){var t=e||window.event;return!!h(t.target)||!!(t.touches.length>1)||(t.preventDefault&&t.preventDefault(),!1)},m=function(e){if(void 0===u){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);u=document.body.style.paddingRight,document.body.style.paddingRight=i+n+"px"}}void 0===d&&(d=document.body.style.overflow,document.body.style.overflow="hidden")},f=function(){void 0!==u&&(document.body.style.paddingRight=u,u=void 0),void 0!==d&&(document.body.style.overflow=d,d=void 0)},g=function(){if(void 0!==c){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=c.position,document.body.style.top=c.top,document.body.style.left=c.left,window.scrollTo(t,e),c=void 0}},x=function(e,t){var n,i=e.targetTouches[0].clientY-s;if(h(e.target))return!1;if(t&&0===t.scrollTop&&i>0)return p(e);return(n=t)&&n.scrollHeight-n.scrollTop<=n.clientHeight&&i<0?p(e):(e.stopPropagation(),!0)},v=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}!a.some(function(t){return t.targetElement===e})&&(a=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t=i&&(document.body.style.top=-(t+e))})},300)}}):m(t),o&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(s=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&x(t,e)},!l&&(document.addEventListener("touchmove",p,i?{passive:!1}:void 0),l=!0)))},b=function(){o&&(a.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),l&&(document.removeEventListener("touchmove",p,i?{passive:!1}:void 0),l=!1),s=-1),o?g():f(),a=[]}},429:function(e,t){"use strict";t.parse=function(e){for(var t,n=[],i=String(e||""),r=i.indexOf(","),o=0,a=!1;!a;)-1===r&&(r=i.length,a=!0),((t=i.slice(o,r).trim())||!a)&&n.push(t),o=r+1,r=i.indexOf(",",o);return n};function n(e,t){var n=t||{},i=!1===n.padLeft?"":" ",r=n.padRight?" ":"";return""===e[e.length-1]&&(e=e.concat("")),e.join(r+","+i).trim()}},79522:function(e,t,n){"use strict";var i=n("48456"),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,o,a,l,s,d,c,u,h=!1;!t&&(t={}),a=t.debug||!1;try{if(s=i(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(n){if(n.stopPropagation(),t.format){if(n.preventDefault(),void 0===n.clipboardData){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e)}t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");h=!0}catch(i){a&&console.error("unable to copy using execCommand: ",i),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(i){;a&&console.error("unable to copy using clipboardData: ",i),a&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",o=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C",l=n.replace(/#{\s*key\s*}/g,o),window.prompt(l,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}},34532:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var i=n("37302");function r(e,t){e.classList?e.classList.add(t):!(0,i.Z)(e,t)&&("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}},37302:function(e,t,n){"use strict";function i(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}n.d(t,{Z:function(){return i}})},72523:function(e,t,n){"use strict";function i(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function r(e,t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=i(e.className,t):e.setAttribute("class",i(e.className&&e.className.baseVal||"",t))}n.d(t,{Z:function(){return r}})},85653:function(e,t){"use strict";var n,i,r;let o;n="FlexSearch",i=function e(t){let n;function i(e,t){let n=t?t.id:e&&e.id;this.id=n||0===n?n:z++,this.init(e,t),l(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)}),l(this,"length",function(){return this.index.length})}function r(e,t,n,i){return this.u!==this.g&&(this.o=this.o.concat(n),this.u++,i&&this.o.length>=i&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(t,this.o),this.F&&this.F(this.o))),this}function o(e,t){let n=e.length,i=y(t),r=[];for(let o=0,a=0;o=a&&((e=(e=e[l-(r+.5>>0)])[n]||(e[n]=[]))[e.length]=i),r)}function u(e,t){if(e){let n=Object.keys(e);for(let i=0,r=n.length;i(e=e.length-t.length)?1:e?-1:0}function m(e,t){return e=e[n],e<(t=t[n])?-1:e>t?1:0}function f(e,t){let i=n.length;for(let r=0;rt?1:0}function g(e,t,n){return e?{page:e,next:t?""+t:null,result:n}:n}function x(e,t,n,i,r,o,a){let l,s=[];if(!0===n){n="0";var d=""}else d=n&&n.split(":");let c=e.length;if(1a&&(d=0),(l=(d=d||0)+t)=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:e,content:t}),this.c[a]=""+this.C,n&&n(),this;if(!r){if(this.async&&"function"!=typeof importScripts){let r=this;return(a=new Promise(function(n){setTimeout(function(){r.add(e,t,null,i,!0),r=null,n()})}),n)?(a.then(n),this):a}if(n)return this.add(e,t,null,i,!0),n(),this}if(!(t=this.encode(t)).length)return this;r=y(n=this.f)?n(t):t.split(this.split),this.filter&&(r=o(r,this.filter));let p=I();p._ctx=I();let m=r.length,f=this.threshold,g=this.depth,x=this.b,v=this.i,b=this.D;for(let t=0;th;n--)c(v,p,u=l.substring(h,n),e,t,d,f,x-1)}break;default:if(s=c(v,p,l,e,1,d,f,x-1),g&&1=f)for(s=p._ctx[l]||(p._ctx[l]=I()),l=this.h[l]||(this.h[l]=j(x-(f||0))),0>(d=t-g)&&(d=0),(u=t+g+1)>m&&(u=m);dr;n--)i=o[n-1],o[n]=i,t[i]=n;o[r]=e,t[e]=r}}}return t},e}();return i}(function(){let e={},t="undefined"!=typeof Blob&&"undefined"!=typeof URL&&URL.createObjectURL;return function(n,i,r,o,a){return r=t?URL.createObjectURL(new Blob(["("+r.toString()+")()"],{type:"text/javascript"})):n+".min.js",e[n+="-"+i]||(e[n]=[]),e[n][a]=new Worker(r),e[n][a].onmessage=o,e[n][a]}}()),r=this,(o=r.define)&&o.amd?o([],function(){return i}):(o=r.modules)?o[n.toLowerCase()]=i:"object"==typeof t?e.exports=i:r[n]=i},43451:function(e){"use strict";e.exports=function(e,n){for(var i,r,o,a=e||"",l=n||"div",s={},d=0;d-1}var a=["itemScope"];function l(t,n,i,r){void 0===r&&(r=null);var o=i[t],a=i._;return o?e.createElement(o,n,r):a?a(t,n,r):e.createElement(t,n,r)}return function(e,i){if(void 0===i&&(i={}),"string"!=typeof e)throw TypeError("Expected HTML string");var o=document.createElement("div");o.innerHTML=e.trim();var a=Array.from(o.childNodes).map(function(e,o){return function e(i,o,a){var s,d,c,u,h=a.transform||{},p=a.preserveAttributes||[],m=a.dangerouslySetChildren||["style"],f=h._;if(8===i.nodeType)return null;if(3===i.nodeType){var g=i.textContent;return f?f(g):g}for(var x={},v=i.attributes,b=0;b1){var r,a=(r=i[0].trim(),/^-ms-/.test(r)&&(r=r.substr(1)),r.startsWith("--")?r:t(r)),l=(n=i.slice(1).join(":").trim(),/^\d+$/.test(n)?Number(n):n.replace(/'/g,'"'));o[a]=l}}),o);else{var l=d[n],h=""===l||String(l).toLowerCase()===i.toLowerCase();e[a.name]=a.isBoolean?h:l}return e},{})),k=Array.from(i.childNodes).map(function(t,i){return n.indexOf(y)>-1&&3===t.nodeType&&(t.textContent=t.textContent.trim(),""===t.textContent)?null:e(t,o+"."+i,a)}).filter(Boolean);if(m.indexOf(y)>-1){var j=i.innerHTML;return j&&("style"!==y&&"script"!==y&&(j=j.replace(/"/g,""")),w.dangerouslySetInnerHTML={__html:j.trim()}),l(y,w,h)}return l(y,w,h,0===k.length?null:k)}(e,String(o),i)}).filter(Boolean);return 1===a.length?a[0]:a}},"object"==typeof t?e.exports=r(n("2363")):"function"==typeof define&&define.amd?define(["react"],r):(i=i||self).htmr=r(i.React)},24546:function(e){"use strict";e.exports=function(e,t,n,i,r,o,a,l){if(!e){var s;if(void 0===t)s=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,i,r,o,a,l],c=0;(s=Error(t.replace(/%s/g,function(){return d[c++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}}},54761:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},29975:function(e,t,n){"use strict";var i=n("54761"),r=n("67525");e.exports=function(e){return i(e)||r(e)}},67525:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},72201:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},60366:function(e,t){"use strict";var n=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},c=window.Promise||function(e){function t(){}e(t,t)},u=function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,i=function(){var e={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},t=void 0,i=void 0;if(b.container){if(b.container instanceof Object)t=(e=n({},e,b.container)).width-e.left-e.right-2*b.margin,i=e.height-e.top-e.bottom-2*b.margin;else{var a=(r(b.container)?b.container:document.querySelector(b.container)).getBoundingClientRect();e=n({},e,{width:a.width,height:a.height,left:a.left,top:a.top})}}t=t||e.width-2*b.margin,i=i||e.height-2*b.margin;var l=y.zoomedHd||y.original,s=o(l)?t:l.naturalWidth||t,d=o(l)?i:l.naturalHeight||i,c=l.getBoundingClientRect(),u=c.top,h=c.left,p=c.width,m=c.height,f=Math.min(Math.min(Math.max(p,s),t)/p,Math.min(Math.max(m,d),i)/m),g=(-h+(t-p)/2+b.margin+e.left)/f,x=(-u+(i-m)/2+b.margin+e.top)/f,v="scale("+f+") translate3d("+g+"px, "+x+"px, 0)";y.zoomed.style.transform=v,y.zoomedHd&&(y.zoomedHd.style.transform=v)};return new c(function(e){if(t&&-1===f.indexOf(t)){e(k);return}if(y.zoomed){e(k);return}if(t)y.original=t;else if(f.length>0){var n=f;y.original=n[0]}else{e(k);return}if(y.original.dispatchEvent(d("medium-zoom:open",{detail:{zoom:k}})),v=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,x=!0,y.zoomed=s(y.original),document.body.appendChild(w),b.template){var o=r(b.template)?b.template:document.querySelector(b.template);y.template=document.createElement("div"),y.template.appendChild(o.content.cloneNode(!0)),document.body.appendChild(y.template)}if(y.original.parentElement&&"PICTURE"===y.original.parentElement.tagName&&y.original.currentSrc&&(y.zoomed.src=y.original.currentSrc),document.body.appendChild(y.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),y.original.classList.add("medium-zoom-image--hidden"),y.zoomed.classList.add("medium-zoom-image--opened"),y.zoomed.addEventListener("click",p),y.zoomed.addEventListener("transitionend",function t(){x=!1,y.zoomed.removeEventListener("transitionend",t),y.original.dispatchEvent(d("medium-zoom:opened",{detail:{zoom:k}})),e(k)}),y.original.getAttribute("data-zoom-src")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("srcset"),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading"),y.zoomedHd.src=y.zoomed.getAttribute("data-zoom-src"),y.zoomedHd.onerror=function(){clearInterval(a),console.warn("Unable to reach the zoom image target "+y.zoomedHd.src),y.zoomedHd=null,i()};var a=setInterval(function(){y.zoomedHd.complete&&(clearInterval(a),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",p),document.body.appendChild(y.zoomedHd),i())},10)}else if(y.original.hasAttribute("srcset")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading");var l=y.zoomedHd.addEventListener("load",function(){y.zoomedHd.removeEventListener("load",l),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",p),document.body.appendChild(y.zoomedHd),i()})}else i()})},p=function(){return new c(function(e){if(x||!y.original){e(k);return}x=!0,document.body.classList.remove("medium-zoom--opened"),y.zoomed.style.transform="",y.zoomedHd&&(y.zoomedHd.style.transform=""),y.template&&(y.template.style.transition="opacity 150ms",y.template.style.opacity=0),y.original.dispatchEvent(d("medium-zoom:close",{detail:{zoom:k}})),y.zoomed.addEventListener("transitionend",function t(){y.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(y.zoomed),y.zoomedHd&&document.body.removeChild(y.zoomedHd),document.body.removeChild(w),y.zoomed.classList.remove("medium-zoom-image--opened"),y.template&&document.body.removeChild(y.template),x=!1,y.zoomed.removeEventListener("transitionend",t),y.original.dispatchEvent(d("medium-zoom:closed",{detail:{zoom:k}})),y.original=null,y.zoomed=null,y.zoomedHd=null,y.template=null,e(k)})})},m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target;return y.original?p():h({target:t})},f=[],g=[],x=!1,v=0,b=i,y={original:null,zoomed:null,zoomedHd:null,template:null};"[object Object]"===Object.prototype.toString.call(t)?b=t:(t||"string"==typeof t)&&u(t);var w=l((b=n({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},b)).background);document.addEventListener("click",function(e){var t=e.target;if(t===w){p();return}-1!==f.indexOf(t)&&m({target:t})}),document.addEventListener("keyup",function(e){var t=e.key||e.keyCode;("Escape"===t||"Esc"===t||27===t)&&p()}),document.addEventListener("scroll",function(){if(!x&&y.original){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(v-e)>b.scrollOffset&&setTimeout(p,150)}}),window.addEventListener("resize",p);var k={open:h,close:p,toggle:m,update:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.background&&(w.style.background=e.background),e.container&&e.container instanceof Object&&(e.container=n({},b.container,e.container)),e.template){var t=r(e.template)?e.template:document.querySelector(e.template);e.template=t}return b=n({},b,e),f.forEach(function(e){e.dispatchEvent(d("medium-zoom:update",{detail:{zoom:k}}))}),k},clone:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(n({},b,t))},attach:u,detach:function(){for(var e=arguments.length,t=Array(e),n=0;n0?t.reduce(function(e,t){return[].concat(e,a(t))},[]):f;return i.forEach(function(e){e.classList.remove("medium-zoom-image"),e.dispatchEvent(d("medium-zoom:detach",{detail:{zoom:k}}))}),f=f.filter(function(e){return -1===i.indexOf(e)}),k},on:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(i){i.addEventListener("medium-zoom:"+e,t,n)}),g.push({type:"medium-zoom:"+e,listener:t,options:n}),k},off:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(i){i.removeEventListener("medium-zoom:"+e,t,n)}),g=g.filter(function(n){return!(n.type==="medium-zoom:"+e&&n.listener.toString()===t.toString())}),k},getOptions:function(){return b},getImages:function(){return f},getZoomedImage:function(){return y.original}};return k}},47841:function(e,t){var n,i;n=this,i=function(){var e,t,n,i={};i.version="0.2.0";var r=i.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
                  '};function o(e,t,n){return en?n:e}function a(e){return(-1+e)*100}i.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},i.status=null,i.set=function(e){var t=i.isStarted();e=o(e,r.minimum,1),i.status=1===e?null:e;var n=i.render(!t),a=n.querySelector(r.barSelector),d=r.speed,c=r.easing;return n.offsetWidth,l(function(t){""===r.positionUsing&&(r.positionUsing=i.getPositioningCSS()),s(a,function(e,t,n){var i;if("translate3d"===r.positionUsing)i={transform:"translate3d("+(-1+e)*100+"%,0,0)"};else if("translate"===r.positionUsing)i={transform:"translate("+(-1+e)*100+"%,0)"};else i={"margin-left":(-1+e)*100+"%"};return i.transition="all "+t+"ms "+n,i}(e,d,c)),1===e?(s(n,{transition:"none",opacity:1}),n.offsetWidth,setTimeout(function(){s(n,{transition:"all "+d+"ms linear",opacity:0}),setTimeout(function(){i.remove(),t()},d)},d)):setTimeout(t,d)}),this},i.isStarted=function(){return"number"==typeof i.status},i.start=function(){!i.status&&i.set(0);var e=function(){setTimeout(function(){i.status&&(i.trickle(),e())},r.trickleSpeed)};return r.trickle&&e(),this},i.done=function(e){return e||i.status?i.inc(.3+.5*Math.random()).set(1):this},i.inc=function(e){var t=i.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),i.set(t)):i.start()},i.trickle=function(){return i.inc(Math.random()*r.trickleRate)},e=0,t=0,i.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&i.start(),e++,t++,n.always(function(){0==--t?(e=0,i.done()):i.set((e-t)/e)}),this):this},i.render=function(e){if(i.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var n,o=t.querySelector(r.barSelector),a=e?"-100":function(e){return(-1+e)*100}(i.status||0),l=document.querySelector(r.parent);return s(o,{transition:"all 0 linear",transform:"translate3d("+a+"%,0,0)"}),!r.showSpinner&&(n=t.querySelector(r.spinnerSelector))&&p(n),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},i.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},i.isRendered=function(){return!!document.getElementById("nprogress")},i.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective" in e?"translate3d":t+"Transform" in e?"translate":"margin"};var l=(n=[],function(e){n.push(e),1==n.length&&!function e(){var t=n.shift();t&&t(e)}()}),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n,i,r){i=function(n){return t[n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var i,r=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((i=e[r]+o)in n)return i;return t}(n))}(i),n.style[i]=r}return function(e,t){var i,r,o=arguments;if(2==o.length)for(i in t)void 0!==(r=t[i])&&t.hasOwnProperty(i)&&n(e,i,r);else n(e,o[1],o[2])}}();function d(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=h(e),i=n+t;!d(n,t)&&(e.className=i.substring(1))}function u(e,t){var n,i=h(e);d(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return i},"function"==typeof define&&define.amd?define(i):"object"==typeof t?e.exports=i():n.NProgress=i()},55144:function(e){"use strict";var t;e.exports=function(e){var n,i="&"+e+";";return(t=t||document.createElement("i")).innerHTML=i,(59!==(n=t.textContent).charCodeAt(n.length-1)||"semi"===e)&&n!==i&&n}},82668:function(e,t,n){"use strict";var i=n("10924"),r=n("33222"),o=n("67525"),a=n("72201"),l=n("29975"),s=n("55144");e.exports=function(e,t){var n,o,a={};for(o in!t&&(t={}),h)n=t[o],a[o]=null==n?h[o]:n;return(a.position.indent||a.position.start)&&(a.indent=a.position.indent||[],a.position=a.position.start),function(e,t){var n,o,a,h,b,y,w,k,j,I,P,E,S,C,z,N,_,A,T,O=t.additional,M=t.nonTerminated,L=t.text,D=t.reference,R=t.warning,B=t.textContext,$=t.referenceContext,F=t.warningContext,H=t.position,Z=t.indent||[],W=e.length,U=0,q=-1,V=H.column||1,G=H.line||1,Y="",Q=[];for("string"==typeof O&&(O=O.charCodeAt(0)),N=K(),k=R?function(e,t){var n=K();n.column+=t,n.offset+=t,R.call(F,v[e],n,e)}:u,U--,W++;++U=55296&&e<=57343||e>1114111}(y=parseInt(h,g[C]))?(k(7,A),y=c(65533)):y in r?(k(6,A),y=r[y]):(I="",function(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(65535&e)==65535||(65535&e)==65534}(y)&&k(6,A),y>65535&&(y-=65536,I+=c(y>>>10|55296),y=56320|1023&y),y=I+c(y))):C!==p&&k(4,A);y?(J(),N=K(),U=T-1,V+=T-S+1,Q.push(y),_=K(),_.offset++,D&&D.call($,y,{start:N,end:_},e.slice(S-1,T)),N=_):(h=e.slice(S-1,T),Y+=h,V+=h.length,U=T-1)}else 10===b&&(G++,q++,V=0),b==b?(Y+=c(b),V++):J();return Q.join("");function K(){return{line:G,column:V,offset:U+(H.offset||0)}}function J(){Y&&(Q.push(Y),L&&L.call(B,Y,{start:N,end:K()}),Y="")}}(e,a)};var d={}.hasOwnProperty,c=String.fromCharCode,u=Function.prototype,h={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",f="decimal",g={};g[m]=16,g[f]=10;var x={};x[p]=l,x[f]=o,x[m]=a;var v={};v[1]="Named character references must be terminated by a semicolon",v[2]="Numeric character references must be terminated by a semicolon",v[3]="Named character references cannot be empty",v[4]="Numeric character references cannot be empty",v[5]="Named character references must be known",v[6]="Numeric character references cannot be disallowed",v[7]="Numeric character references cannot be outside the permissible Unicode range"},3921:function(e,t,n){var i=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach));k+=w.value.length,w=w.next){var j,I=w.value;if(n.length>t.length)return;if(!(I instanceof o)){var P=1;if(x){if(!(j=a(y,k,t,g))||j.index>=t.length)break;var E=j.index,S=j.index+j[0].length,C=k;for(C+=w.value.length;E>=C;)C+=(w=w.next).value.length;if(C-=w.value.length,k=C,w.value instanceof o)continue;for(var z=w;z!==n.tail&&(Cc.reach&&(c.reach=T);var O=w.prev;if(_&&(O=s(n,O,_),k+=_.length),function(e,t,n){for(var i=t.next,r=0;r1){var M={cause:u+","+p,reach:T};e(t,n,i,w.prev,k,M),c&&M.reach>c.reach&&(c.reach=M.reach)}}}}}}(e,d,t,d.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(d)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,o=0;i=n[o++];)i(t)}},Token:o};function o(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function a(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var o=r[1].length;r.index+=o,r[0]=r[0].slice(o)}return r}e.Prism=r,o.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach(function(t){i+=e(t,n)}),i}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},a=t.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(o.classes,a):o.classes.push(a)),r.hooks.run("wrap",o);var l="";for(var s in o.attributes)l+=" "+s+'="'+(o.attributes[s]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+""};function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}if(!e.document)return e.addEventListener?(!r.disableWorkerMessageHandler&&e.addEventListener("message",function(t){var n=JSON.parse(t.data),i=n.language,o=n.code,a=n.immediateClose;e.postMessage(r.highlight(o,r.languages[i],i)),a&&e.close()},!1),r):r;var d=r.util.currentScript();function c(){!r.manual&&r.highlightAll()}if(d&&(r.filename=d.src,d.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var u=document.readyState;"loading"===u||"interactive"===u&&d&&d.defer?document.addEventListener("DOMContentLoaded",c):window.requestAnimationFrame?window.requestAnimationFrame(c):window.setTimeout(c,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=i),void 0!==n.g&&(n.g.Prism=i)},52504:function(e,t,n){"use strict";var i=n("62265");function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,a){if(a!==i){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},23698:function(e,t,n){e.exports=n("52504")()},62265:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},62616:function(e,t,n){"use strict";var i=n("22275"),r=n("6492"),o=n("23811"),a="data";e.exports=function(e,t){var n=i(t),h=t,p=o;return n in e.normal?e.property[e.normal[n]]:(n.length>4&&n.slice(0,4)===a&&l.test(t)&&("-"===t.charAt(4)?h=function(e){var t=e.slice(5).replace(s,u);return a+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);return s.test(t)?e:("-"!==(t=t.replace(d,c)).charAt(0)&&(t="-"+t),a+t)}(t),p=r),new p(h,t))};var l=/^data[-\w.:]+$/i,s=/-[a-z]/g,d=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function u(e){return e.charAt(1).toUpperCase()}},46093:function(e,t,n){"use strict";var i=n("96399"),r=n("59283"),o=n("87430"),a=n("62376"),l=n("35531"),s=n("51581");e.exports=i([o,r,a,l,s])},35531:function(e,t,n){"use strict";var i=n("13077"),r=n("79469"),o=i.booleanish,a=i.number,l=i.spaceSeparated;e.exports=r({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:o,ariaAutoComplete:null,ariaBusy:o,ariaChecked:o,ariaColCount:a,ariaColIndex:a,ariaColSpan:a,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:o,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:o,ariaFlowTo:l,ariaGrabbed:o,ariaHasPopup:null,ariaHidden:o,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:a,ariaLive:null,ariaModal:o,ariaMultiLine:o,ariaMultiSelectable:o,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:a,ariaPressed:o,ariaReadOnly:o,ariaRelevant:null,ariaRequired:o,ariaRoleDescription:l,ariaRowCount:a,ariaRowIndex:a,ariaRowSpan:a,ariaSelected:o,ariaSetSize:a,ariaSort:null,ariaValueMax:a,ariaValueMin:a,ariaValueNow:a,ariaValueText:null,role:null}})},51581:function(e,t,n){"use strict";var i=n("13077"),r=n("79469"),o=n("12561"),a=i.boolean,l=i.overloadedBoolean,s=i.booleanish,d=i.number,c=i.spaceSeparated,u=i.commaSeparated;e.exports=r({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:o,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:u,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:a,allowPaymentRequest:a,allowUserMedia:a,alt:null,as:null,async:a,autoCapitalize:null,autoComplete:c,autoFocus:a,autoPlay:a,capture:a,charSet:null,checked:a,cite:null,className:c,cols:d,colSpan:null,content:null,contentEditable:s,controls:a,controlsList:c,coords:d|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:a,defer:a,dir:null,dirName:null,disabled:a,download:l,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:a,formTarget:null,headers:c,height:d,hidden:a,high:d,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:u,inputMode:null,integrity:null,is:null,isMap:a,itemId:null,itemProp:c,itemRef:c,itemScope:a,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:a,low:d,manifest:null,max:null,maxLength:d,media:null,method:null,min:null,minLength:d,multiple:a,muted:a,name:null,nonce:null,noModule:a,noValidate:a,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:a,optimum:d,pattern:null,ping:c,placeholder:null,playsInline:a,poster:null,preload:null,readOnly:a,referrerPolicy:null,rel:c,required:a,reversed:a,rows:d,rowSpan:d,sandbox:c,scope:null,scoped:a,seamless:a,selected:a,shape:null,size:d,sizes:null,slot:null,span:d,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:u,start:d,step:null,style:null,tabIndex:d,target:null,title:null,translate:null,type:null,typeMustMatch:a,useMap:null,value:s,width:d,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:d,borderColor:null,bottomMargin:d,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:a,declare:a,event:null,face:null,frame:null,frameBorder:null,hSpace:d,leftMargin:d,link:null,longDesc:null,lowSrc:null,marginHeight:d,marginWidth:d,noResize:a,noHref:a,noShade:a,noWrap:a,object:null,profile:null,prompt:null,rev:null,rightMargin:d,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:d,valueType:null,version:null,vAlign:null,vLink:null,vSpace:d,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:a,disableRemotePlayback:a,prefix:null,property:null,results:d,security:null,unselectable:null}})},12561:function(e,t,n){"use strict";var i=n("56073");e.exports=function(e,t){return i(e,t.toLowerCase())}},56073:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},79469:function(e,t,n){"use strict";var i=n("22275"),r=n("23673"),o=n("6492");e.exports=function(e){var t,n,a=e.space,l=e.mustUseProperty||[],s=e.attributes||{},d=e.properties,c=e.transform,u={},h={};for(t in d)n=new o(t,c(s,t),d[t],a),-1!==l.indexOf(t)&&(n.mustUseProperty=!0),u[t]=n,h[i(t)]=t,h[i(n.attribute)]=t;return new r(u,h,a)}},6492:function(e,t,n){"use strict";var i=n("23811"),r=n("13077");e.exports=l,l.prototype=new i,l.prototype.defined=!0;var o=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],a=o.length;function l(e,t,n,l){var s,d=-1;for(function(e,t,n){n&&(e[t]=n)}(this,"space",l),i.call(this,e,t);++d=0||(r[n]=e[n]);return r}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},x={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},b={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},y=Object.keys(g).map(function(e){return g[e]}),w={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(w).reduce(function(e,t){return e[w[t]]=t,e},{}),j=function(e,t){for(var n=e.length-1;n>=0;n-=1){var i=e[n];if(Object.prototype.hasOwnProperty.call(i,t))return i[t]}return null},I=function(e){var t=j(e,g.TITLE),n=j(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,function(){return t});var i=j(e,"defaultTitle");return t||i||void 0},P=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return h({},e,t)},{})},E=function(e,t,n){var i={};return n.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,n){var r={};n.filter(function(e){for(var n,o=Object.keys(e),a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")},T=function(e){return Object.keys(e).reduce(function(t,n){var i=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+i:i},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,n){return t[w[n]||n]=e[n],t},t)},M=function(e,t){return t.map(function(t,n){var r,o=((r={key:n})["data-rh"]=!0,r);return Object.keys(t).forEach(function(e){var n=w[e]||e;"innerHTML"===n||"cssText"===n?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[n]=t[e]}),i.createElement(e,o)})},L=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){var e,n,r,o;return n=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,o=O(n,r),[i.createElement(g.TITLE,o,e)]},toString:function(){var i,r,o,a,l,s;return i=e,r=t.title,o=t.titleAttributes,a=n,l=T(o),s=C(r),l?"<"+i+' data-rh="true" '+l+">"+A(s,a)+"":"<"+i+' data-rh="true">'+A(s,a)+""}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(t)},toString:function(){return T(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){var i,r,o;return i=e,r=t,o=n,r.reduce(function(e,t){var n=Object.keys(t).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,n){var i=void 0===t[n]?n:n+'="'+A(t[n],o)+'"';return e?e+" "+i:i},""),r=t.innerHTML||t.cssText||"",a=-1===_.indexOf(i);return e+"<"+i+' data-rh="true" '+n+(a?"/>":">"+r+"")},"")}}}},D=function(e){var t=e.baseTag,n=e.bodyAttributes,i=e.encode,r=e.htmlAttributes,o=e.noscriptTags,a=e.styleTags,l=e.title,s=e.titleAttributes,d=e.linkTags,c=e.metaTags,u=e.scriptTags,h={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var p,m,f,y,w,k,j,I=(m=(p=e).linkTags,f=p.scriptTags,y=p.encode,w=z(p.metaTags,b),k=z(m,x),j=z(f,v),{priorityMethods:{toComponent:function(){return[].concat(M(g.META,w.priority),M(g.LINK,k.priority),M(g.SCRIPT,j.priority))},toString:function(){return L(g.META,w.priority,y)+" "+L(g.LINK,k.priority,y)+" "+L(g.SCRIPT,j.priority,y)}},metaTags:w.default,linkTags:k.default,scriptTags:j.default});h=I.priorityMethods,d=I.linkTags,c=I.metaTags,u=I.scriptTags}return{priority:h,base:L(g.BASE,t,i),bodyAttributes:L("bodyAttributes",n,i),htmlAttributes:L("htmlAttributes",r,i),link:L(g.LINK,d,i),meta:L(g.META,c,i),noscript:L(g.NOSCRIPT,o,i),script:L(g.SCRIPT,u,i),style:L(g.STYLE,a,i),title:L(g.TITLE,{title:void 0===l?"":l,titleAttributes:s},i)}},R=[],B=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?R:n.instances},add:function(e){(n.canUseDOM?R:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?R:n.instances).indexOf(e);(n.canUseDOM?R:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=D({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},$=i.createContext({}),F=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),H=function(e){function t(n){var i;return(i=e.call(this,n)||this).helmetData=new B(i.props.context,t.canUseDOM),i}return p(t,e),t.prototype.render=function(){return i.createElement($.Provider,{value:this.helmetData.value},this.props.children)},t}(i.Component);H.canUseDOM="undefined"!=typeof document,H.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},H.defaultProps={context:{}},H.displayName="HelmetProvider";var Z=function(e,t){var n,i=document.head||document.querySelector(g.HEAD),r=i.querySelectorAll(e+"[data-rh]"),o=[].slice.call(r),a=[];return t&&t.length&&t.forEach(function(t){var i=document.createElement(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("innerHTML"===r?i.innerHTML=t.innerHTML:"cssText"===r?i.styleSheet?i.styleSheet.cssText=t.cssText:i.appendChild(document.createTextNode(t.cssText)):i.setAttribute(r,void 0===t[r]?"":t[r]));i.setAttribute("data-rh","true"),o.some(function(e,t){return n=t,i.isEqualNode(e)})?o.splice(n,1):a.push(i)}),o.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return i.appendChild(e)}),{oldTags:o,newTags:a}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var i=n.getAttribute("data-rh"),r=i?i.split(","):[],o=[].concat(r),a=Object.keys(t),l=0;l=0;u-=1)n.removeAttribute(o[u]);r.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==a.join(",")&&n.setAttribute("data-rh",a.join(","))}},U=function(e,t){var n,i,r=e.baseTag,o=e.htmlAttributes,a=e.linkTags,l=e.metaTags,s=e.noscriptTags,d=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,h=e.title,p=e.titleAttributes;W(g.BODY,e.bodyAttributes),W(g.HTML,o),n=h,i=p,void 0!==n&&document.title!==n&&(document.title=C(n)),W(g.TITLE,i);var m={baseTag:Z(g.BASE,r),linkTags:Z(g.LINK,a),metaTags:Z(g.META,l),noscriptTags:Z(g.NOSCRIPT,s),scriptTags:Z(g.SCRIPT,c),styleTags:Z(g.STYLE,u)},f={},x={};Object.keys(m).forEach(function(e){var t=m[e],n=t.newTags,i=t.oldTags;n.length&&(f[e]=n),i.length&&(x[e]=m[e].oldTags)}),t&&t(),d(e,f,x)},q=null,V=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,i=e.arrayTypeChildren;return h({},i,((t={})[n.type]=[].concat(i[n.type]||[],[h({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,i=e.child,r=e.newProps,o=e.newChildProps,a=e.nestedChildren;switch(i.type){case g.TITLE:return h({},r,((t={})[i.type]=a,t.titleAttributes=h({},o),t));case g.BODY:return h({},r,{bodyAttributes:h({},o)});case g.HTML:return h({},r,{htmlAttributes:h({},o)});default:return h({},r,((n={})[i.type]=h({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=h({},t);return Object.keys(e).forEach(function(t){var i;n=h({},n,((i={})[t]=e[t],i))}),n},n.warnOnInvalidChildren=function(e,t){return d()(y.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+y.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),d()(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``} ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,r={};return i.Children.forEach(e,function(e){if(e&&e.props){var i=e.props,o=i.children,a=f(i,G),l=Object.keys(a).reduce(function(e,t){return e[k[t]||t]=a[t],e},{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,o),s){case g.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:l,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:o})}}}),this.mapArrayTypeChildrenToProps(r,t)},n.render=function(){var e=this.props,t=e.children,n=f(e,Y),r=h({},n),o=n.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!o||o instanceof B||(o=new B(o.context,o.instances)),o?i.createElement(V,h({},r,{context:o.value,helmetData:void 0})):i.createElement($.Consumer,null,function(e){return i.createElement(V,h({},r,{context:e}))})},t}(i.Component);Q.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},Q.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},Q.displayName="Helmet"},22897:function(e,t,n){"use strict";t.lazyWithPreload=void 0;var i,r=n("2363");function o(e){var t,n,i=(0,r.lazy)(e),o=(0,r.forwardRef)(function(e,n){var o=(0,r.useRef)(null!=t?t:i);return(0,r.createElement)(o.current,Object.assign(n?{ref:n}:{},e))});return o.preload=function(){return!n&&(n=e().then(function(e){return t=e.default})),n},o}t.lazyWithPreload=o},68965:function(e,t,n){"use strict";function i(e,t){return -1!==e.listLanguages().indexOf(t)}n.d(t,{Z:function(){return i}})},51414:function(e,t,n){"use strict";n.d(t,{ZP:function(){return c}});var i=n("90107"),r=n("26037"),o=n("2363");function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,n,i=e.join(".");if(!s[i]){;s[i]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0}return s[i]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return l(l({},e),n[t])},t)}(u.className,Object.assign({},u.style,void 0===r?{}:r),n)})}else v=l(l({},u),{},{className:u.className.join(" ")});var j=b(t.children);return o.createElement(p,(0,i.Z)({key:d},v),j)}}},40458:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var i=n("95775"),r=n("29618"),o=n("26037"),a=n("2363"),l=n("51414"),s=n("68965"),d=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function u(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=0;o2&&void 0!==arguments[2]?arguments[2]:[];return t||a.length>0?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return g({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:l,showInlineLineNumbers:o,lineProps:n,className:r,showLineNumbers:i,wrapLongLines:d})}(e,r,a):function(e,t){if(i&&t&&o){var n=f(s,t,l);e.unshift(m(t,n))}return e}(e,r)}for(;v>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=i.variable[1].inside,a=0;a]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}e.exports=t,t.displayName="clike",t.aliases=[]},17520:function(e){"use strict";function t(e){var t,n,i;n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,(t=e).languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css,(i=t.languages.markup)&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}e.exports=t,t.displayName="css",t.aliases=[]},63610:function(e){"use strict";function t(e){var t,n;(t=e).languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]},Object.keys(n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"}).forEach(function(e){var i=n[e],r=[];!/^\w+$/.test(e)&&r.push(/\w+/.exec(e)[0]),"diff"===e&&r.push("bold"),t.languages.diff[e]={pattern:RegExp("^(?:["+i+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(e)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})}e.exports=t,t.displayName="diff",t.aliases=[]},59551:function(e){"use strict";function t(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|")+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}e.exports=t,t.displayName="javascript",t.aliases=["js"]},7091:function(e){"use strict";function t(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}e.exports=t,t.displayName="json",t.aliases=["webmanifest"]},17942:function(e){"use strict";function t(e){!function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function o(e,t){return RegExp(e=e.replace(//g,function(){return n}).replace(//g,function(){return i}).replace(//g,function(){return r}),t)}r=o(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var a=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(a).join(""):""},l=function(t){for(var n=[],i=0;i0&&n[n.length-1].tagName===a(r.content[0].content[1])&&n.pop():"/>"===r.content[r.content.length-1].content||n.push({tagName:a(r.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===r.type&&"{"===r.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof r)&&n.length>0&&0===n[n.length-1].openedBraces){var s=a(r);i0&&("string"==typeof t[i-1]||"plain-text"===t[i-1].type)&&(s=a(t[i-1])+s,t.splice(i-1,1),i--),t[i]=new e.Token("plain-text",s,null,s)}r.content&&"string"!=typeof r.content&&l(r.content)}};e.hooks.add("after-tokenize",function(e){("jsx"===e.language||"tsx"===e.language)&&l(e.tokens)})}(e)}e.exports=t,t.displayName="jsx",t.aliases=[]},89693:function(e){"use strict";function t(e){e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}e.exports=t,t.displayName="less",t.aliases=[]},19463:function(e){"use strict";function t(e){!function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+o+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+o+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add("after-tokenize",function(e){("markdown"===e.language||"md"===e.language)&&function e(t){if(t&&"string"!=typeof t)for(var n=0,i=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(e)}e.exports=t,t.displayName="markdown",t.aliases=["md"]},47264:function(e){"use strict";function t(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var i={};i["language-"+n]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[n]},i.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:i}};r["language-"+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var o={};o[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},e.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}e.exports=t,t.displayName="markup",t.aliases=["html","mathml","svg","xml","ssml","atom","rss"]},31337:function(e){"use strict";function t(e){e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}e.exports=t,t.displayName="scss",t.aliases=[]},89455:function(e,t,n){"use strict";var i=n("17942"),r=n("63847");function o(e){var t,n,o;e.register(i),e.register(r),n=(t=e).util.clone(t.languages.typescript),t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"],(o=t.languages.tsx.tag).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+o.pattern.source+")",o.pattern.flags),o.lookbehind=!0}e.exports=o,o.displayName="tsx",o.aliases=[]},63847:function(e){"use strict";function t(e){var t,n;(t=e).languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"],n=t.languages.extend("typescript",{}),delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript}e.exports=t,t.displayName="typescript",t.aliases=["ts"]},14646:function(e){"use strict";function t(e){!function(e){function t(t,n){e.languages[t]&&e.languages.insertBefore(t,"comment",{"doc-comment":n})}var n=e.languages.markup.tag,i={pattern:/\/\/\/.*/,greedy:!0,alias:"comment",inside:{tag:n}};t("csharp",i),t("fsharp",i),t("vbnet",{pattern:/'''.*/,greedy:!0,alias:"comment",inside:{tag:n}})}(e)}e.exports=t,t.displayName="xmlDoc",t.aliases=[]},70660:function(e){"use strict";function t(e){!function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,i="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function a(e,t){return t=(t||"").replace(/m/g,"")+"m",RegExp(/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return e}),t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return i})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return"(?:"+r+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:a(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:a(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:a(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:a(o),lookbehind:!0,greedy:!0},number:{pattern:a(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(e)}e.exports=t,t.displayName="yaml",t.aliases=["yml"]},65241:function(e){e.exports=function(e,t,n,i){var r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s{let n=e=>e.replace(/\/$/,"").toLowerCase();return(0,l.pV)(n(t.routePath),n(e))}),d=encodeURIComponent(a),c=(null===(r=n.default.__RSPRESS_PAGE_META)||void 0===r?void 0:r[d])||{},{toc:u=[],title:p="",frontmatter:m={},...f}=h.kv.test(t.filePath)?c:n;return{siteData:o.Z,page:{...f,pagePath:a,...s,pageType:(null==m?void 0:m.pageType)||"doc",title:p,frontmatter:m,toc:u}}}return{siteData:o.Z,page:{pagePath:"",pageType:"404",routePath:"/404",lang:o.Z.lang||"",frontmatter:{},title:"404",toc:[],version:"",_filepath:"",_relativePath:""}}}function x(e){let{helmetContext:t}=e,{setData:n,data:i}=(0,u.useContext)(s.R0),o=i.page.frontmatter||{},{pathname:a,search:h}=(0,d.TH)(),f=new URLSearchParams(h),x="globalUIComponents",v=!1===o[x]||"0"===f.get(x);return(0,u.useLayoutEffect)(()=>{(async function e(){try{let e=await g((0,l.Tm)(a));n(e)}catch(e){console.log(e)}})()},[a,n]),(0,r.jsxs)(c.B6,{context:t,children:[(0,r.jsx)(m.ZP.Layout,{}),!v&&p.Z.map((e,t)=>{if(Array.isArray(e)){let[n,i]=e;return u.createElement(n,{key:t,...i})}return u.createElement(e,{key:t})})]})}},56411:function(e,t,n){"use strict";var i=n("39980"),r=n("2363"),o=n("72855"),a=n("13328"),l=n("92688"),s=n("51812"),d=n("35383"),c=n("82493");let u=a.Z.ssg,{default:h,useThemeState:p}=n("92919");(async function e(){let e=document.getElementById("root"),t=async()=>{let e=await (0,c.$X)((0,l.Tm)(window.location.pathname));return function(){let[t,n]=(0,r.useState)(e),[o,a]=p();return(0,i.jsx)(s.Ni.Provider,{value:(0,r.useMemo)(()=>({theme:o,setTheme:a}),[o,a]),children:(0,i.jsx)(s.R0.Provider,{value:(0,r.useMemo)(()=>({data:t,setData:n}),[t,n]),children:(0,i.jsx)(d.VK,{children:(0,i.jsx)(c.gV,{})})})})}},a=await t();{let{createRoot:t,hydrateRoot:r}=n("30417");(0,o.yv)()&&u?r(e,(0,i.jsx)(a,{})):t(e).render((0,i.jsx)(a,{}))}})().then(()=>{h.setup()})},27974:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}});var i=n("71895")},8951:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var i=n("8319"),r=n("60366"),o=n("2363");function a(e){let{pathname:t}=(0,i.TH)(),{selector:n=".rspress-doc img",options:a={}}=e;return(0,o.useEffect)(()=>{let e;let t=setTimeout(()=>{let t=document.querySelectorAll(n);e=(0,r.Z)(t,{...a,background:"var(--rp-c-bg)"})},100);return()=>{clearTimeout(t),null==e||e.detach(),null==e||e.close()}},[t]),null}n("48097")},78958:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}});var i=n("27974")},49915:function(e,t,n){"use strict";var i=n("8951");t.Z=[[i.Z,{}]]},54345:function(e,t,n){"use strict";n("60817")},16288:function(e,t,n){"use strict";var i=n("68450"),r=n("78036"),o=n("35009"),a=n("69611"),l=n("41143"),s=n("51088"),d=n("89648"),c=n("94744"),u=n("12417"),h=n("61691"),p=n("29027"),m=n("5646");t.Z={js:i.Z,ts:r.Z,jsx:o.Z,tsx:o.Z,json:a.Z,css:l.Z,scss:s.Z,less:d.Z,xml:c.Z,diff:u.Z,yaml:h.Z,md:p.Z,mdx:o.Z,bash:m.Z}},99593:function(e,t,n){"use strict";n.r(t),n.d(t,{routes:function(){return eY}});var i=n("2363"),r=n("22897");let o=(0,r.lazyWithPreload)(()=>n.e("7947").then(n.bind(n,"31699"))),a=(0,r.lazyWithPreload)(()=>n.e("7664").then(n.bind(n,"85048"))),l=(0,r.lazyWithPreload)(()=>n.e("270").then(n.bind(n,"29198"))),s=(0,r.lazyWithPreload)(()=>n.e("7565").then(n.bind(n,"55511"))),d=(0,r.lazyWithPreload)(()=>n.e("1095").then(n.bind(n,"58568"))),c=(0,r.lazyWithPreload)(()=>n.e("330").then(n.bind(n,"89324"))),u=(0,r.lazyWithPreload)(()=>n.e("4523").then(n.bind(n,"10712"))),h=(0,r.lazyWithPreload)(()=>n.e("2814").then(n.bind(n,"35783"))),p=(0,r.lazyWithPreload)(()=>n.e("4887").then(n.bind(n,"9845"))),m=(0,r.lazyWithPreload)(()=>n.e("2551").then(n.bind(n,"92576"))),f=(0,r.lazyWithPreload)(()=>n.e("5305").then(n.bind(n,"25407"))),g=(0,r.lazyWithPreload)(()=>n.e("5800").then(n.bind(n,"91083"))),x=(0,r.lazyWithPreload)(()=>n.e("9549").then(n.bind(n,"4878"))),v=(0,r.lazyWithPreload)(()=>n.e("6201").then(n.bind(n,"20728"))),b=(0,r.lazyWithPreload)(()=>n.e("4344").then(n.bind(n,"56795"))),y=(0,r.lazyWithPreload)(()=>n.e("6800").then(n.bind(n,"68182"))),w=(0,r.lazyWithPreload)(()=>n.e("6658").then(n.bind(n,"15722"))),k=(0,r.lazyWithPreload)(()=>n.e("8612").then(n.bind(n,"19959"))),j=(0,r.lazyWithPreload)(()=>n.e("3104").then(n.bind(n,"72397"))),I=(0,r.lazyWithPreload)(()=>n.e("6573").then(n.bind(n,"46850"))),P=(0,r.lazyWithPreload)(()=>n.e("7334").then(n.bind(n,"37705"))),E=(0,r.lazyWithPreload)(()=>n.e("737").then(n.bind(n,"90072"))),S=(0,r.lazyWithPreload)(()=>n.e("7287").then(n.bind(n,"82632"))),C=(0,r.lazyWithPreload)(()=>n.e("8409").then(n.bind(n,"66939"))),z=(0,r.lazyWithPreload)(()=>n.e("972").then(n.bind(n,"59032"))),N=(0,r.lazyWithPreload)(()=>n.e("2259").then(n.bind(n,"79592"))),_=(0,r.lazyWithPreload)(()=>n.e("8058").then(n.bind(n,"85227"))),A=(0,r.lazyWithPreload)(()=>n.e("7929").then(n.bind(n,"49234"))),T=(0,r.lazyWithPreload)(()=>n.e("8975").then(n.bind(n,"40726"))),O=(0,r.lazyWithPreload)(()=>n.e("2913").then(n.bind(n,"33566"))),M=(0,r.lazyWithPreload)(()=>n.e("803").then(n.bind(n,"41048"))),L=(0,r.lazyWithPreload)(()=>n.e("1005").then(n.bind(n,"75947"))),D=(0,r.lazyWithPreload)(()=>n.e("8746").then(n.bind(n,"34378"))),R=(0,r.lazyWithPreload)(()=>n.e("1819").then(n.bind(n,"56290"))),B=(0,r.lazyWithPreload)(()=>n.e("3900").then(n.bind(n,"37549"))),$=(0,r.lazyWithPreload)(()=>n.e("4306").then(n.bind(n,"98041"))),F=(0,r.lazyWithPreload)(()=>n.e("6167").then(n.bind(n,"98571"))),H=(0,r.lazyWithPreload)(()=>n.e("6566").then(n.bind(n,"31517"))),Z=(0,r.lazyWithPreload)(()=>n.e("8571").then(n.bind(n,"48029"))),W=(0,r.lazyWithPreload)(()=>n.e("2263").then(n.bind(n,"73855"))),U=(0,r.lazyWithPreload)(()=>n.e("7321").then(n.bind(n,"85572"))),q=(0,r.lazyWithPreload)(()=>n.e("6512").then(n.bind(n,"61919"))),V=(0,r.lazyWithPreload)(()=>n.e("3969").then(n.bind(n,"68606"))),G=(0,r.lazyWithPreload)(()=>n.e("8741").then(n.bind(n,"7880"))),Y=(0,r.lazyWithPreload)(()=>n.e("8528").then(n.bind(n,"51458"))),Q=(0,r.lazyWithPreload)(()=>n.e("8914").then(n.bind(n,"50399"))),K=(0,r.lazyWithPreload)(()=>n.e("9931").then(n.bind(n,"15719"))),J=(0,r.lazyWithPreload)(()=>n.e("6051").then(n.bind(n,"53692"))),X=(0,r.lazyWithPreload)(()=>n.e("1563").then(n.bind(n,"39875"))),ee=(0,r.lazyWithPreload)(()=>n.e("1684").then(n.bind(n,"62584"))),et=(0,r.lazyWithPreload)(()=>n.e("4607").then(n.bind(n,"15543"))),en=(0,r.lazyWithPreload)(()=>n.e("1867").then(n.bind(n,"27503"))),ei=(0,r.lazyWithPreload)(()=>n.e("3535").then(n.bind(n,"11485"))),er=(0,r.lazyWithPreload)(()=>n.e("3691").then(n.bind(n,"54515"))),eo=(0,r.lazyWithPreload)(()=>n.e("8067").then(n.bind(n,"46498"))),ea=(0,r.lazyWithPreload)(()=>n.e("4575").then(n.bind(n,"95466"))),el=(0,r.lazyWithPreload)(()=>n.e("9475").then(n.bind(n,"8747"))),es=(0,r.lazyWithPreload)(()=>n.e("7426").then(n.bind(n,"83757"))),ed=(0,r.lazyWithPreload)(()=>n.e("7115").then(n.bind(n,"91882"))),ec=(0,r.lazyWithPreload)(()=>n.e("7698").then(n.bind(n,"7904"))),eu=(0,r.lazyWithPreload)(()=>n.e("1586").then(n.bind(n,"2910"))),eh=(0,r.lazyWithPreload)(()=>n.e("958").then(n.bind(n,"22978"))),ep=(0,r.lazyWithPreload)(()=>n.e("8580").then(n.bind(n,"65612"))),em=(0,r.lazyWithPreload)(()=>n.e("538").then(n.bind(n,"79130"))),ef=(0,r.lazyWithPreload)(()=>n.e("1800").then(n.bind(n,"95293"))),eg=(0,r.lazyWithPreload)(()=>n.e("3635").then(n.bind(n,"2076"))),ex=(0,r.lazyWithPreload)(()=>n.e("9460").then(n.bind(n,"2966"))),ev=(0,r.lazyWithPreload)(()=>n.e("4699").then(n.bind(n,"5449"))),eb=(0,r.lazyWithPreload)(()=>n.e("131").then(n.bind(n,"37321"))),ey=(0,r.lazyWithPreload)(()=>n.e("4131").then(n.bind(n,"9990"))),ew=(0,r.lazyWithPreload)(()=>n.e("310").then(n.bind(n,"31003"))),ek=(0,r.lazyWithPreload)(()=>n.e("9176").then(n.bind(n,"18393"))),ej=(0,r.lazyWithPreload)(()=>n.e("1310").then(n.bind(n,"35756"))),eI=(0,r.lazyWithPreload)(()=>n.e("4191").then(n.bind(n,"50894"))),eP=(0,r.lazyWithPreload)(()=>n.e("2414").then(n.bind(n,"44069"))),eE=(0,r.lazyWithPreload)(()=>n.e("9697").then(n.bind(n,"28097"))),eS=(0,r.lazyWithPreload)(()=>n.e("7534").then(n.bind(n,"55130"))),eC=(0,r.lazyWithPreload)(()=>n.e("3937").then(n.bind(n,"54266"))),ez=(0,r.lazyWithPreload)(()=>n.e("5269").then(n.bind(n,"44605"))),eN=(0,r.lazyWithPreload)(()=>n.e("9016").then(n.bind(n,"30934"))),e_=(0,r.lazyWithPreload)(()=>n.e("187").then(n.bind(n,"15884"))),eA=(0,r.lazyWithPreload)(()=>n.e("6275").then(n.bind(n,"54075"))),eT=(0,r.lazyWithPreload)(()=>n.e("5898").then(n.bind(n,"59168"))),eO=(0,r.lazyWithPreload)(()=>n.e("5188").then(n.bind(n,"92373"))),eM=(0,r.lazyWithPreload)(()=>n.e("9675").then(n.bind(n,"54257"))),eL=(0,r.lazyWithPreload)(()=>n.e("705").then(n.bind(n,"67530"))),eD=(0,r.lazyWithPreload)(()=>n.e("7782").then(n.bind(n,"65840"))),eR=(0,r.lazyWithPreload)(()=>n.e("1166").then(n.bind(n,"36869"))),eB=(0,r.lazyWithPreload)(()=>n.e("1297").then(n.bind(n,"80380"))),e$=(0,r.lazyWithPreload)(()=>n.e("19").then(n.bind(n,"14132"))),eF=(0,r.lazyWithPreload)(()=>n.e("1877").then(n.bind(n,"30085"))),eH=(0,r.lazyWithPreload)(()=>n.e("8269").then(n.bind(n,"17482"))),eZ=(0,r.lazyWithPreload)(()=>n.e("4764").then(n.bind(n,"33889"))),eW=(0,r.lazyWithPreload)(()=>n.e("347").then(n.bind(n,"29602"))),eU=(0,r.lazyWithPreload)(()=>n.e("1600").then(n.bind(n,"26166"))),eq=(0,r.lazyWithPreload)(()=>n.e("1711").then(n.bind(n,"41696"))),eV=(0,r.lazyWithPreload)(()=>n.e("8104").then(n.bind(n,"31456"))),eG=(0,r.lazyWithPreload)(()=>n.e("1960").then(n.bind(n,"25351"))),eY=[{path:"/module-tools/en/api/config/build-config",element:i.createElement(o),filePath:"en/api/config/build-config.mdx",preload:async()=>(await o.preload(),n.e("7947").then(n.bind(n,"31699"))),lang:"en",version:""},{path:"/module-tools/en/api/config/build-preset",element:i.createElement(a),filePath:"en/api/config/build-preset.mdx",preload:async()=>(await a.preload(),n.e("7664").then(n.bind(n,"85048"))),lang:"en",version:""},{path:"/module-tools/en/api/config/dev",element:i.createElement(l),filePath:"en/api/config/dev.md",preload:async()=>(await l.preload(),n.e("270").then(n.bind(n,"29198"))),lang:"en",version:""},{path:"/module-tools/en/api/config/plugins",element:i.createElement(s),filePath:"en/api/config/plugins.md",preload:async()=>(await s.preload(),n.e("7565").then(n.bind(n,"55511"))),lang:"en",version:""},{path:"/module-tools/en/api/config/testing",element:i.createElement(d),filePath:"en/api/config/testing.md",preload:async()=>(await d.preload(),n.e("1095").then(n.bind(n,"58568"))),lang:"en",version:""},{path:"/module-tools/en/api/",element:i.createElement(c),filePath:"en/api/index.md",preload:async()=>(await c.preload(),n.e("330").then(n.bind(n,"89324"))),lang:"en",version:""},{path:"/module-tools/en/api/plugin-api/plugin-hooks",element:i.createElement(u),filePath:"en/api/plugin-api/plugin-hooks.md",preload:async()=>(await u.preload(),n.e("4523").then(n.bind(n,"10712"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-exception",element:i.createElement(h),filePath:"en/components/faq-build-exception.mdx",preload:async()=>(await h.preload(),n.e("2814").then(n.bind(n,"35783"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-other",element:i.createElement(p),filePath:"en/components/faq-build-other.mdx",preload:async()=>(await p.preload(),n.e("4887").then(n.bind(n,"9845"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-product",element:i.createElement(m),filePath:"en/components/faq-build-product.mdx",preload:async()=>(await m.preload(),n.e("2551").then(n.bind(n,"92576"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-storybook",element:i.createElement(f),filePath:"en/components/faq-storybook.mdx",preload:async()=>(await f.preload(),n.e("5305").then(n.bind(n,"25407"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-test",element:i.createElement(g),filePath:"en/components/faq-test.mdx",preload:async()=>(await g.preload(),n.e("5800").then(n.bind(n,"91083"))),lang:"en",version:""},{path:"/module-tools/en/components/publish-emo",element:i.createElement(x),filePath:"en/components/publish-emo.mdx",preload:async()=>(await x.preload(),n.e("9549").then(n.bind(n,"4878"))),lang:"en",version:""},{path:"/module-tools/en/components/register-esbuild-plugin",element:i.createElement(v),filePath:"en/components/register-esbuild-plugin.mdx",preload:async()=>(await v.preload(),n.e("6201").then(n.bind(n,"20728"))),lang:"en",version:""},{path:"/module-tools/en/components/release-module-doc",element:i.createElement(b),filePath:"en/components/release-module-doc.mdx",preload:async()=>(await b.preload(),n.e("4344").then(n.bind(n,"56795"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/asset",element:i.createElement(y),filePath:"en/guide/advance/asset.mdx",preload:async()=>(await y.preload(),n.e("6800").then(n.bind(n,"68182"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/build-umd",element:i.createElement(w),filePath:"en/guide/advance/build-umd.mdx",preload:async()=>(await w.preload(),n.e("6658").then(n.bind(n,"15722"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/copy",element:i.createElement(k),filePath:"en/guide/advance/copy.md",preload:async()=>(await k.preload(),n.e("8612").then(n.bind(n,"19959"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/external-dependency",element:i.createElement(j),filePath:"en/guide/advance/external-dependency.mdx",preload:async()=>(await j.preload(),n.e("3104").then(n.bind(n,"72397"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-build",element:i.createElement(I),filePath:"en/guide/advance/in-depth-about-build.md",preload:async()=>(await I.preload(),n.e("6573").then(n.bind(n,"46850"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-dev-command",element:i.createElement(P),filePath:"en/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await P.preload(),n.e("7334").then(n.bind(n,"37705"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/before-getting-started",element:i.createElement(E),filePath:"en/guide/basic/before-getting-started.md",preload:async()=>(await E.preload(),n.e("737").then(n.bind(n,"90072"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/command-preview",element:i.createElement(S),filePath:"en/guide/basic/command-preview.md",preload:async()=>(await S.preload(),n.e("7287").then(n.bind(n,"82632"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/modify-output-product",element:i.createElement(C),filePath:"en/guide/basic/modify-output-product.md",preload:async()=>(await C.preload(),n.e("8409").then(n.bind(n,"66939"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/publish-your-project",element:i.createElement(z),filePath:"en/guide/basic/publish-your-project.mdx",preload:async()=>(await z.preload(),n.e("972").then(n.bind(n,"59032"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-micro-generator",element:i.createElement(N),filePath:"en/guide/basic/use-micro-generator.md",preload:async()=>(await N.preload(),n.e("2259").then(n.bind(n,"79592"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-module-doc",element:i.createElement(_),filePath:"en/guide/basic/use-module-doc.mdx",preload:async()=>(await _.preload(),n.e("8058").then(n.bind(n,"85227"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/using-storybook",element:i.createElement(A),filePath:"en/guide/basic/using-storybook.mdx",preload:async()=>(await A.preload(),n.e("7929").then(n.bind(n,"49234"))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/components",element:i.createElement(T),filePath:"en/guide/best-practices/components.mdx",preload:async()=>(await T.preload(),n.e("8975").then(n.bind(n,"40726"))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/use-tailwindcss",element:i.createElement(O),filePath:"en/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await O.preload(),n.e("2913").then(n.bind(n,"33566"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/basic",element:i.createElement(M),filePath:"en/guide/faq/basic.mdx",preload:async()=>(await M.preload(),n.e("803").then(n.bind(n,"41048"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/build",element:i.createElement(L),filePath:"en/guide/faq/build.mdx",preload:async()=>(await L.preload(),n.e("1005").then(n.bind(n,"75947"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/",element:i.createElement(D),filePath:"en/guide/faq/index.md",preload:async()=>(await D.preload(),n.e("8746").then(n.bind(n,"34378"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/storybook",element:i.createElement(R),filePath:"en/guide/faq/storybook.mdx",preload:async()=>(await R.preload(),n.e("1819").then(n.bind(n,"56290"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/test",element:i.createElement(B),filePath:"en/guide/faq/test.mdx",preload:async()=>(await B.preload(),n.e("3900").then(n.bind(n,"37549"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/getting-started",element:i.createElement($),filePath:"en/guide/intro/getting-started.mdx",preload:async()=>(await $.preload(),n.e("4306").then(n.bind(n,"98041"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/welcome",element:i.createElement(F),filePath:"en/guide/intro/welcome.md",preload:async()=>(await F.preload(),n.e("6167").then(n.bind(n,"98571"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/why-module-engineering-solution",element:i.createElement(H),filePath:"en/guide/intro/why-module-engineering-solution.md",preload:async()=>(await H.preload(),n.e("6566").then(n.bind(n,"31517"))),lang:"en",version:""},{path:"/module-tools/en/",element:i.createElement(Z),filePath:"en/index.md",preload:async()=>(await Z.preload(),n.e("8571").then(n.bind(n,"48029"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/getting-started",element:i.createElement(W),filePath:"en/plugins/guide/getting-started.mdx",preload:async()=>(await W.preload(),n.e("2263").then(n.bind(n,"73855"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/plugin-object",element:i.createElement(U),filePath:"en/plugins/guide/plugin-object.mdx",preload:async()=>(await U.preload(),n.e("7321").then(n.bind(n,"85572"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/setup-function",element:i.createElement(q),filePath:"en/plugins/guide/setup-function.mdx",preload:async()=>(await q.preload(),n.e("6512").then(n.bind(n,"61919"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/overview",element:i.createElement(V),filePath:"en/plugins/official-list/overview.md",preload:async()=>(await V.preload(),n.e("3969").then(n.bind(n,"68606"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-babel",element:i.createElement(G),filePath:"en/plugins/official-list/plugin-babel.mdx",preload:async()=>(await G.preload(),n.e("8741").then(n.bind(n,"7880"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-banner",element:i.createElement(Y),filePath:"en/plugins/official-list/plugin-banner.mdx",preload:async()=>(await Y.preload(),n.e("8528").then(n.bind(n,"51458"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-import",element:i.createElement(Q),filePath:"en/plugins/official-list/plugin-import.mdx",preload:async()=>(await Q.preload(),n.e("8914").then(n.bind(n,"50399"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-node-polyfill",element:i.createElement(K),filePath:"en/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await K.preload(),n.e("9931").then(n.bind(n,"15719"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-polyfill",element:i.createElement(J),filePath:"en/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await J.preload(),n.e("6051").then(n.bind(n,"53692"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-vue",element:i.createElement(X),filePath:"en/plugins/official-list/plugin-vue.mdx",preload:async()=>(await X.preload(),n.e("1563").then(n.bind(n,"39875"))),lang:"en",version:""},{path:"/module-tools/api/config/build-config",element:i.createElement(ee),filePath:"zh/api/config/build-config.mdx",preload:async()=>(await ee.preload(),n.e("1684").then(n.bind(n,"62584"))),lang:"zh",version:""},{path:"/module-tools/api/config/build-preset",element:i.createElement(et),filePath:"zh/api/config/build-preset.mdx",preload:async()=>(await et.preload(),n.e("4607").then(n.bind(n,"15543"))),lang:"zh",version:""},{path:"/module-tools/api/config/dev",element:i.createElement(en),filePath:"zh/api/config/dev.md",preload:async()=>(await en.preload(),n.e("1867").then(n.bind(n,"27503"))),lang:"zh",version:""},{path:"/module-tools/api/config/plugins",element:i.createElement(ei),filePath:"zh/api/config/plugins.md",preload:async()=>(await ei.preload(),n.e("3535").then(n.bind(n,"11485"))),lang:"zh",version:""},{path:"/module-tools/api/config/testing",element:i.createElement(er),filePath:"zh/api/config/testing.md",preload:async()=>(await er.preload(),n.e("3691").then(n.bind(n,"54515"))),lang:"zh",version:""},{path:"/module-tools/api/",element:i.createElement(eo),filePath:"zh/api/index.md",preload:async()=>(await eo.preload(),n.e("8067").then(n.bind(n,"46498"))),lang:"zh",version:""},{path:"/module-tools/api/plugin-api/plugin-hooks",element:i.createElement(ea),filePath:"zh/api/plugin-api/plugin-hooks.md",preload:async()=>(await ea.preload(),n.e("4575").then(n.bind(n,"95466"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-exception",element:i.createElement(el),filePath:"zh/components/faq-build-exception.mdx",preload:async()=>(await el.preload(),n.e("9475").then(n.bind(n,"8747"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-other",element:i.createElement(es),filePath:"zh/components/faq-build-other.mdx",preload:async()=>(await es.preload(),n.e("7426").then(n.bind(n,"83757"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-product",element:i.createElement(ed),filePath:"zh/components/faq-build-product.mdx",preload:async()=>(await ed.preload(),n.e("7115").then(n.bind(n,"91882"))),lang:"zh",version:""},{path:"/module-tools/components/faq-storybook",element:i.createElement(ec),filePath:"zh/components/faq-storybook.mdx",preload:async()=>(await ec.preload(),n.e("7698").then(n.bind(n,"7904"))),lang:"zh",version:""},{path:"/module-tools/components/faq-test",element:i.createElement(eu),filePath:"zh/components/faq-test.mdx",preload:async()=>(await eu.preload(),n.e("1586").then(n.bind(n,"2910"))),lang:"zh",version:""},{path:"/module-tools/components/publish-emo",element:i.createElement(eh),filePath:"zh/components/publish-emo.mdx",preload:async()=>(await eh.preload(),n.e("958").then(n.bind(n,"22978"))),lang:"zh",version:""},{path:"/module-tools/components/register-esbuild-plugin",element:i.createElement(ep),filePath:"zh/components/register-esbuild-plugin.mdx",preload:async()=>(await ep.preload(),n.e("8580").then(n.bind(n,"65612"))),lang:"zh",version:""},{path:"/module-tools/components/release-module-doc",element:i.createElement(em),filePath:"zh/components/release-module-doc.mdx",preload:async()=>(await em.preload(),n.e("538").then(n.bind(n,"79130"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/asset",element:i.createElement(ef),filePath:"zh/guide/advance/asset.mdx",preload:async()=>(await ef.preload(),n.e("1800").then(n.bind(n,"95293"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/build-umd",element:i.createElement(eg),filePath:"zh/guide/advance/build-umd.mdx",preload:async()=>(await eg.preload(),n.e("3635").then(n.bind(n,"2076"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/copy",element:i.createElement(ex),filePath:"zh/guide/advance/copy.md",preload:async()=>(await ex.preload(),n.e("9460").then(n.bind(n,"2966"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/external-dependency",element:i.createElement(ev),filePath:"zh/guide/advance/external-dependency.mdx",preload:async()=>(await ev.preload(),n.e("4699").then(n.bind(n,"5449"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-build",element:i.createElement(eb),filePath:"zh/guide/advance/in-depth-about-build.md",preload:async()=>(await eb.preload(),n.e("131").then(n.bind(n,"37321"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-dev-command",element:i.createElement(ey),filePath:"zh/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await ey.preload(),n.e("4131").then(n.bind(n,"9990"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/before-getting-started",element:i.createElement(ew),filePath:"zh/guide/basic/before-getting-started.md",preload:async()=>(await ew.preload(),n.e("310").then(n.bind(n,"31003"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/command-preview",element:i.createElement(ek),filePath:"zh/guide/basic/command-preview.md",preload:async()=>(await ek.preload(),n.e("9176").then(n.bind(n,"18393"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/modify-output-product",element:i.createElement(ej),filePath:"zh/guide/basic/modify-output-product.md",preload:async()=>(await ej.preload(),n.e("1310").then(n.bind(n,"35756"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/publish-your-project",element:i.createElement(eI),filePath:"zh/guide/basic/publish-your-project.mdx",preload:async()=>(await eI.preload(),n.e("4191").then(n.bind(n,"50894"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-micro-generator",element:i.createElement(eP),filePath:"zh/guide/basic/use-micro-generator.md",preload:async()=>(await eP.preload(),n.e("2414").then(n.bind(n,"44069"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-module-doc",element:i.createElement(eE),filePath:"zh/guide/basic/use-module-doc.mdx",preload:async()=>(await eE.preload(),n.e("9697").then(n.bind(n,"28097"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/using-storybook",element:i.createElement(eS),filePath:"zh/guide/basic/using-storybook.mdx",preload:async()=>(await eS.preload(),n.e("7534").then(n.bind(n,"55130"))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/components",element:i.createElement(eC),filePath:"zh/guide/best-practices/components.mdx",preload:async()=>(await eC.preload(),n.e("3937").then(n.bind(n,"54266"))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/use-tailwindcss",element:i.createElement(ez),filePath:"zh/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await ez.preload(),n.e("5269").then(n.bind(n,"44605"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/basic",element:i.createElement(eN),filePath:"zh/guide/faq/basic.mdx",preload:async()=>(await eN.preload(),n.e("9016").then(n.bind(n,"30934"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/build",element:i.createElement(e_),filePath:"zh/guide/faq/build.mdx",preload:async()=>(await e_.preload(),n.e("187").then(n.bind(n,"15884"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/",element:i.createElement(eA),filePath:"zh/guide/faq/index.md",preload:async()=>(await eA.preload(),n.e("6275").then(n.bind(n,"54075"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/storybook",element:i.createElement(eT),filePath:"zh/guide/faq/storybook.mdx",preload:async()=>(await eT.preload(),n.e("5898").then(n.bind(n,"59168"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/test",element:i.createElement(eO),filePath:"zh/guide/faq/test.mdx",preload:async()=>(await eO.preload(),n.e("5188").then(n.bind(n,"92373"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/getting-started",element:i.createElement(eM),filePath:"zh/guide/intro/getting-started.mdx",preload:async()=>(await eM.preload(),n.e("9675").then(n.bind(n,"54257"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/welcome",element:i.createElement(eL),filePath:"zh/guide/intro/welcome.md",preload:async()=>(await eL.preload(),n.e("705").then(n.bind(n,"67530"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/why-module-engineering-solution",element:i.createElement(eD),filePath:"zh/guide/intro/why-module-engineering-solution.md",preload:async()=>(await eD.preload(),n.e("7782").then(n.bind(n,"65840"))),lang:"zh",version:""},{path:"/module-tools/",element:i.createElement(eR),filePath:"zh/index.md",preload:async()=>(await eR.preload(),n.e("1166").then(n.bind(n,"36869"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/getting-started",element:i.createElement(eB),filePath:"zh/plugins/guide/getting-started.mdx",preload:async()=>(await eB.preload(),n.e("1297").then(n.bind(n,"80380"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/plugin-object",element:i.createElement(e$),filePath:"zh/plugins/guide/plugin-object.mdx",preload:async()=>(await e$.preload(),n.e("19").then(n.bind(n,"14132"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/setup-function",element:i.createElement(eF),filePath:"zh/plugins/guide/setup-function.mdx",preload:async()=>(await eF.preload(),n.e("1877").then(n.bind(n,"30085"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/overview",element:i.createElement(eH),filePath:"zh/plugins/official-list/overview.md",preload:async()=>(await eH.preload(),n.e("8269").then(n.bind(n,"17482"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-babel",element:i.createElement(eZ),filePath:"zh/plugins/official-list/plugin-babel.mdx",preload:async()=>(await eZ.preload(),n.e("4764").then(n.bind(n,"33889"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-banner",element:i.createElement(eW),filePath:"zh/plugins/official-list/plugin-banner.mdx",preload:async()=>(await eW.preload(),n.e("347").then(n.bind(n,"29602"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-import",element:i.createElement(eU),filePath:"zh/plugins/official-list/plugin-import.mdx",preload:async()=>(await eU.preload(),n.e("1600").then(n.bind(n,"26166"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-node-polyfill",element:i.createElement(eq),filePath:"zh/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await eq.preload(),n.e("1711").then(n.bind(n,"41696"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-polyfill",element:i.createElement(eV),filePath:"zh/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await eV.preload(),n.e("8104").then(n.bind(n,"31456"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-vue",element:i.createElement(eG),filePath:"zh/plugins/official-list/plugin-vue.mdx",preload:async()=>(await eG.preload(),n.e("1960").then(n.bind(n,"25351"))),lang:"zh",version:""}]},51801:function(e,t,n){"use strict";n.d(t,{H:function(){return i}});let i=()=>{}},25756:function(e,t){"use strict";t.Z={"###en":"ea8d594a","###zh":"10a5690c"}},13328:function(e,t){"use strict";t.Z={title:"Modern.js Module",description:"",icon:"https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png",themeConfig:{footer:{message:"Copyright \xa9 2023 ByteDance."},socialLinks:[{icon:"github",mode:"link",content:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools"}],locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.53.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"},{text:"testing",link:"/module-tools/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"},{text:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.53.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"},{text:"testing",link:"/module-tools/en/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"},{text:"Test FAQ",link:"/module-tools/en/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],editLink:{docRepoBaseUrl:"https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs",text:"Edit this page on GitHub"}},base:"/module-tools/",lang:"zh",locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.53.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"},{text:"testing",link:"/module-tools/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"},{text:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.53.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"},{text:"testing",link:"/module-tools/en/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"},{text:"Test FAQ",link:"/module-tools/en/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],logo:"",logoText:"",ssg:!0,multiVersion:{default:"",versions:[]},search:{},pages:[{title:"buildConfig",routePath:"/module-tools/en/api/config/build-config",lang:"en",toc:[{text:"alias",id:"alias",depth:2,charIndex:378},{text:"asset",id:"asset",depth:2,charIndex:1054},{text:"asset.name",id:"assetname",depth:2,charIndex:1113},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:1571},{text:"asset.path",id:"assetpath",depth:2,charIndex:2045},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:2149},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:2336},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:2783},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:2901},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:3018},{text:"autoExtension",id:"autoextension",depth:2,charIndex:3299},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:4498},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:5006},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:5142},{text:"banner",id:"banner",depth:2,charIndex:5273},{text:"buildType",id:"buildtype",depth:2,charIndex:5514},{text:"copy",id:"copy",depth:2,charIndex:5674},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:5850},{text:"copy.options",id:"copyoptions",depth:2,charIndex:5908},{text:"define",id:"define",depth:2,charIndex:6133},{text:"dts",id:"dts",depth:2,charIndex:7312},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:7435},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:7919},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:8081},{text:"dts.only",id:"dtsonly",depth:2,charIndex:8508},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:8664},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:8793},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:9225},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:10401},{text:"externals",id:"externals",depth:2,charIndex:10923},{text:"footer",id:"footer",depth:2,charIndex:11113},{text:"format",id:"format",depth:2,charIndex:11209},{text:"format: esm",id:"format-esm",depth:3,charIndex:11396},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:11536},{text:"format: iife",id:"format-iife",depth:3,charIndex:11732},{text:"format: umd",id:"format-umd",depth:3,charIndex:12026},{text:"hooks",id:"hooks",depth:2,charIndex:12329},{text:"input",id:"input",depth:2,charIndex:12816},{text:"jsx",id:"jsx",depth:2,charIndex:13845},{text:"metafile",id:"metafile",depth:2,charIndex:14380},{text:"minify",id:"minify",depth:2,charIndex:14809},{text:"outDir",id:"outdir",depth:2,charIndex:14952},{text:"platform",id:"platform",depth:2,charIndex:15046},{text:"redirect",id:"redirect",depth:2,charIndex:15277},{text:"resolve",id:"resolve",depth:2,charIndex:15793},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:15838},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:16333},{text:"shims",id:"shims",depth:2,charIndex:16798},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:17219},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:18068},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:18326},{text:"sourceType",id:"sourcetype",depth:2,charIndex:18437},{text:"splitting",id:"splitting",depth:2,charIndex:18664},{text:"style",id:"style",depth:2,charIndex:18827},{text:"style.less",id:"styleless",depth:2,charIndex:18875},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:18917},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:19042},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:19163},{text:"style.sass",id:"stylesass",depth:2,charIndex:19508},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:19551},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:19657},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:19789},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:20129},{text:"style.inject",id:"styleinject",depth:2,charIndex:20477},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:21490},{text:"style.modules",id:"stylemodules",depth:2,charIndex:21837},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:22137},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3,charIndex:22251},{text:"Type",id:"type",depth:3,charIndex:22460},{text:"Notes",id:"notes",depth:3,charIndex:22765},{text:"target",id:"target",depth:2,charIndex:23348},{text:"transformImport",id:"transformimport",depth:2,charIndex:23712},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:24068},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:24569},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:24674},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:24985}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/en/api/config/build-preset",lang:"en",toc:[{text:"`npm-library`",id:"npm-library",depth:3,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:3,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:3,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:3,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:3,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:1651}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/en/api/config/dev",lang:"en",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:93},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:239},{text:"Configure Manager App",id:"configure-manager-app",depth:4,charIndex:506},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:686}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/en/api/config/plugins",lang:"en",toc:[{text:"Plugin Execution Order",id:"plugin-execution-order",depth:2,charIndex:140},{text:"Developing Plugins",id:"developing-plugins",depth:2,charIndex:584},{text:"Example",id:"example",depth:2,charIndex:680},{text:"Using Plugins from npm",id:"using-plugins-from-npm",depth:3,charIndex:691},{text:"Using Local Plugins",id:"using-local-plugins",depth:4,charIndex:837},{text:"Plugin Configuration",id:"plugin-configuration",depth:3,charIndex:960}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/api/config/plugins.md"},{title:"testing",routePath:"/module-tools/en/api/config/testing",lang:"en",toc:[{text:"jest",id:"jest",depth:2,charIndex:133},{text:"transformer",id:"transformer",depth:2,charIndex:482}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/api/config/testing.md"},{title:"Overview",routePath:"/module-tools/en/api/",lang:"en",toc:[],frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1},version:"",_relativePath:"en/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/en/api/plugin-api/plugin-hooks",lang:"en",toc:[{text:"Config hooks",id:"config-hooks",depth:2,charIndex:509},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"build hooks",id:"build-hooks",depth:2,charIndex:596},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2,charIndex:1494},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"Dev Hooks",id:"dev-hooks",depth:2,charIndex:2796},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/en/components/faq-build-exception",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-other",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-product",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/en/components/faq-storybook",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/en/components/faq-test",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-test.mdx"},{title:"",routePath:"/module-tools/en/components/publish-emo",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/en/components/register-esbuild-plugin",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/en/components/release-module-doc",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/release-module-doc.mdx"},{title:"Handle static assets",routePath:"/module-tools/en/guide/advance/asset",lang:"en",toc:[{text:"Default behavior",id:"default-behavior",depth:2,charIndex:139},{text:"Example",id:"example",depth:2,charIndex:571}],frontmatter:{sidebar_position:6},version:"",_relativePath:"en/guide/advance/asset.mdx"},{title:"Build umd artifacts",routePath:"/module-tools/en/guide/advance/build-umd",lang:"en",toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2,charIndex:412},{text:"Example",id:"example",depth:3,charIndex:716},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3,charIndex:1171},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2,charIndex:1831}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/advance/build-umd.mdx"},{title:"Use the Copy Tools",routePath:"/module-tools/en/guide/advance/copy",lang:"en",toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2,charIndex:171},{text:"API Description",id:"api-description",depth:2,charIndex:335},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2,charIndex:1783},{text:"Copying Files",id:"copying-files",depth:3,charIndex:1818},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3,charIndex:1837},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3,charIndex:1871},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3,charIndex:1912},{text:"Using Glob",id:"using-glob",depth:3,charIndex:1948}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/advance/copy.md"},{title:"Handle third-party dependencies",routePath:"/module-tools/en/guide/advance/external-dependency",lang:"en",toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2,charIndex:811},{text:"Example",id:"example",depth:3,charIndex:1373},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2,charIndex:1643}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/advance/external-dependency.mdx"},{title:"In-depth understanding of build",routePath:"/module-tools/en/guide/advance/in-depth-about-build",lang:"en",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"use swc",id:"use-swc",depth:2,charIndex:2845},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2,charIndex:3803},{text:"Hook type",id:"hook-type",depth:3,charIndex:4183},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:4195},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:4334},{text:"Hook API",id:"hook-api",depth:3,charIndex:4431},{text:"load",id:"load",depth:4,charIndex:4442},{text:"transform",id:"transform",depth:4,charIndex:4626},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:4837},{text:"dts",id:"dts",depth:2,charIndex:5071},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3,charIndex:5154},{text:"Build type files",id:"build-type-files",depth:3,charIndex:5357},{text:"Alias Conversion",id:"alias-conversion",depth:3,charIndex:6424},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3,charIndex:-1},{text:"Build process",id:"build-process",depth:2,charIndex:6764},{text:"Build errors",id:"build-errors",depth:2,charIndex:7057},{text:"Debug mode",id:"debug-mode",depth:2,charIndex:7582}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/advance/in-depth-about-build.md"},{title:"In-depth understanding of the dev command",routePath:"/module-tools/en/guide/advance/in-depth-about-dev-command",lang:"en",toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2,charIndex:92},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2,charIndex:806}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/advance/in-depth-about-dev-command.md"},{title:"Before you start",routePath:"/module-tools/en/guide/basic/before-getting-started",lang:"en",toc:[{text:"Environment preparation",id:"environment-preparation",depth:2,charIndex:3},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2,charIndex:424},{text:"npm package type project",id:"npm-package-type-project",depth:2,charIndex:906},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2,charIndex:1922},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2,charIndex:3606},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3,charIndex:3643},{text:"`scripts`",id:"scripts",depth:3,charIndex:-1},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:5883},{text:"npm package manager",id:"npm-package-manager",depth:2,charIndex:6585},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2,charIndex:6850}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/basic/before-getting-started.md"},{title:"CLI Commands",routePath:"/module-tools/en/guide/basic/command-preview",lang:"en",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern test`",id:"modern-test",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/basic/command-preview.md"},{title:"Modify the output",routePath:"/module-tools/en/guide/basic/modify-output-product",lang:"en",toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2,charIndex:3},{text:"buildPreset",id:"buildpreset",depth:2,charIndex:818},{text:"buildConfig",id:"buildconfig",depth:2,charIndex:1639},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2,charIndex:4390}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/basic/modify-output-product.md"},{title:"Versioning and Publishing",routePath:"/module-tools/en/guide/basic/publish-your-project",lang:"en",toc:[{text:"Tracking changes",id:"tracking-changes",depth:2,charIndex:610},{text:"Version update",id:"version-update",depth:2,charIndex:1355},{text:"Publish",id:"publish",depth:2,charIndex:1780},{text:"Pre-releases",id:"pre-releases",depth:2,charIndex:2468}],frontmatter:{sidebar_position:7},version:"",_relativePath:"en/guide/basic/publish-your-project.mdx"},{title:"Using the Microgenerator",routePath:"/module-tools/en/guide/basic/use-micro-generator",lang:"en",toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2,charIndex:431},{text:"Storybook",id:"storybook",depth:2,charIndex:895},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2,charIndex:1243},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2,charIndex:1528}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/basic/use-micro-generator.md"},{title:"Developing Module documentation",routePath:"/module-tools/en/guide/basic/use-module-doc",lang:"en",toc:[{text:"Before we start",id:"before-we-start",depth:2,charIndex:98},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3,charIndex:117},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3,charIndex:451},{text:"Basic site structure",id:"basic-site-structure",depth:2,charIndex:686},{text:"Configure sidebar",id:"configure-sidebar",depth:3,charIndex:1493},{text:"Writing Documentation",id:"writing-documentation",depth:2,charIndex:2109},{text:"Component preview",id:"component-preview",depth:2,charIndex:2329},{text:"Example",id:"example",depth:3,charIndex:2514},{text:"Mobile Preview",id:"mobile-preview",depth:3,charIndex:3121},{text:"Using external demos",id:"using-external-demos",depth:3,charIndex:3451},{text:"Using built-in components",id:"using-built-in-components",depth:2,charIndex:3691},{text:"API",id:"api",depth:3,charIndex:3837},{text:"Parse file",id:"parse-file",depth:4,charIndex:3883},{text:"Content generation",id:"content-generation",depth:4,charIndex:3981},{text:"Using the component",id:"using-the-component",depth:4,charIndex:5005},{text:"Overview",id:"overview",depth:3,charIndex:5154},{text:"Plugin options",id:"plugin-options",depth:2,charIndex:5675},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:5693},{text:"doc",id:"doc",depth:3,charIndex:5817},{text:"entries",id:"entries",depth:3,charIndex:5833},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:6040},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:6320},{text:"previewMode",id:"previewmode",depth:3,charIndex:6408},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:6599},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:6746},{text:"Scripts",id:"scripts",depth:2,charIndex:6967},{text:"Advanced guide",id:"advanced-guide",depth:2,charIndex:7130}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/use-module-doc.mdx"},{title:"Using Storybook",routePath:"/module-tools/en/guide/basic/using-storybook",lang:"en",toc:[{text:"V7 (Recommended)",id:"v7-recommended",depth:2,charIndex:511},{text:"Enable Storybook",id:"enable-storybook",depth:3,charIndex:531},{text:"Enable Debug output",id:"enable-debug-output",depth:3,charIndex:985},{text:"Enable Rspack build",id:"enable-rspack-build",depth:3,charIndex:2036},{text:"Configurations",id:"configurations",depth:3,charIndex:2361},{text:"bundler",id:"bundler",depth:4,charIndex:2441},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:2579},{text:"Command",id:"command",depth:3,charIndex:2782},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:2850},{text:"storybook build",id:"storybook-build",depth:4,charIndex:2890},{text:"Migrate from V6 to V7",id:"migrate-from-v6-to-v7",depth:2,charIndex:2948},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:3767},{text:"Start Storybook",id:"start-storybook",depth:3,charIndex:4013},{text:"Configure Storybook",id:"configure-storybook",depth:3,charIndex:4352},{text:"Build Storybook Output",id:"build-storybook-output",depth:3,charIndex:5092}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/using-storybook.mdx"},{title:"Developing Components",routePath:"/module-tools/en/guide/best-practices/components",lang:"en",toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2,charIndex:93},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2,charIndex:406},{text:"Developing Styles",id:"developing-styles",depth:2,charIndex:505},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:711},{text:"Less",id:"less",depth:3,charIndex:1098},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:1251},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:1414},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:1488},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2,charIndex:1852},{text:"Releasing components",id:"releasing-components",depth:2,charIndex:2666}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/best-practices/components.mdx"},{title:"Using Tailwind CSS",routePath:"/module-tools/en/guide/best-practices/use-tailwindcss",lang:"en",toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2,charIndex:252},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2,charIndex:1105},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3,charIndex:1889},{text:"Build Modes",id:"build-modes",depth:2,charIndex:2460},{text:"Bundle Mode",id:"bundle-mode",depth:3,charIndex:2728},{text:"Bundleless Mode",id:"bundleless-mode",depth:3,charIndex:3091},{text:"Class Name Prefix",id:"class-name-prefix",depth:2,charIndex:3254},{text:"Usage Guide",id:"usage-guide",depth:2,charIndex:3641},{text:"HTML Class Names",id:"html-class-names",depth:3,charIndex:3703},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:4211},{text:"Less",id:"less",depth:4,charIndex:4413},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/best-practices/use-tailwindcss.mdx"},{title:"General Questions",routePath:"/module-tools/en/guide/faq/basic",lang:"en",toc:[{text:"What is the relationship between Modern.js Module and Rsbuild?",id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",depth:2,charIndex:3},{text:"Can Modern.js Module use webpack plugins or loaders?",id:"can-modernjs-module-use-webpack-plugins-or-loaders",depth:2,charIndex:210}],frontmatter:{},version:"",_relativePath:"en/guide/faq/basic.mdx"},{title:"Build FAQ",routePath:"/module-tools/en/guide/faq/build",lang:"en",toc:[{text:"Product FAQ",id:"product-faq",depth:2,charIndex:301},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3,charIndex:316},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:2578},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2,charIndex:2995},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:3013},{text:"Problem Description",id:"problem-description",depth:4,charIndex:3059},{text:"Solution",id:"solution",depth:4,charIndex:3287},{text:"Reference Links",id:"reference-links",depth:4,charIndex:3792},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:4560},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:5206},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3,charIndex:-1},{text:"Other FAQ",id:"other-faq",depth:2,charIndex:5958},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3,charIndex:5971},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3,charIndex:6445},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3,charIndex:7173}],frontmatter:{},version:"",_relativePath:"en/guide/faq/build.mdx"},{title:"FAQ",routePath:"/module-tools/en/guide/faq/",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/guide/faq/index.md"},{title:"Storybook FAQ",routePath:"/module-tools/en/guide/faq/storybook",lang:"en",toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2,charIndex:3},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2,charIndex:104},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:519},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2,charIndex:681},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2,charIndex:900},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2,charIndex:1200}],frontmatter:{},version:"",_relativePath:"en/guide/faq/storybook.mdx"},{title:"Test FAQ",routePath:"/module-tools/en/guide/faq/test",lang:"en",toc:[{text:"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/guide/faq/test.mdx"},{title:"Quick Start",routePath:"/module-tools/en/guide/intro/getting-started",lang:"en",toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2,charIndex:3},{text:"Create new project",id:"create-new-project",depth:3,charIndex:209},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3,charIndex:855},{text:"Core npm Package",id:"core-npm-package",depth:3,charIndex:1577},{text:"View official example",id:"view-official-example",depth:3,charIndex:2272},{text:"Let's get started",id:"lets-get-started",depth:2,charIndex:2407}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/intro/getting-started.mdx"},{title:"Welcome to Modern.js Module",routePath:"/module-tools/en/guide/intro/welcome",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/intro/welcome.md"},{title:"Why you need Modern.js Module",routePath:"/module-tools/en/guide/intro/why-module-engineering-solution",lang:"en",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/en/",lang:"en",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/en/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/en/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Jest: Delightful Testing Framework",details:"Jest integration makes it easier to test code\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"en/index.md"},{title:"Quick Start",routePath:"/module-tools/en/plugins/guide/getting-started",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/plugins/guide/getting-started.mdx"},{title:"Plugin Object",routePath:"/module-tools/en/plugins/guide/plugin-object",lang:"en",toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2,charIndex:570},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2,charIndex:741}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/plugins/guide/plugin-object.mdx"},{title:"Setup function",routePath:"/module-tools/en/plugins/guide/setup-function",lang:"en",toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2,charIndex:173},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2,charIndex:993},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2,charIndex:1434}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/plugins/guide/setup-function.mdx"},{title:"Overview",routePath:"/module-tools/en/plugins/official-list/overview",lang:"en",toc:[{text:"Official Plugins",id:"official-plugins",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/overview.md"},{title:"Babel Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-babel",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:110},{text:"Install",id:"install",depth:3,charIndex:125},{text:"Register",id:"register",depth:3,charIndex:136},{text:"Config",id:"config",depth:2,charIndex:372}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-babel.mdx"},{title:"Banner Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-banner",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:89},{text:"Install",id:"install",depth:3,charIndex:104},{text:"Register",id:"register",depth:3,charIndex:115},{text:"Example",id:"example",depth:2,charIndex:271},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3,charIndex:282},{text:"Configuration",id:"configuration",depth:2,charIndex:337},{text:"banner",id:"banner",depth:3,charIndex:365},{text:"footer",id:"footer",depth:3,charIndex:505}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-banner.mdx"},{title:"Import Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-import",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:230},{text:"Install",id:"install",depth:3,charIndex:245},{text:"Register",id:"register",depth:3,charIndex:256},{text:"Configurations",id:"configurations",depth:2,charIndex:413},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:443},{text:"Notes",id:"notes",depth:2,charIndex:602}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-node-polyfill",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:460},{text:"Install",id:"install",depth:3,charIndex:475},{text:"Register",id:"register",depth:3,charIndex:486},{text:"Configurations",id:"configurations",depth:2,charIndex:569},{text:"exclude",id:"exclude",depth:3,charIndex:599},{text:"overrides",id:"overrides",depth:3,charIndex:655},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:708},{text:"Globals",id:"globals",depth:3,charIndex:726},{text:"Modules",id:"modules",depth:3,charIndex:877},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:1336}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-polyfill",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:497},{text:"Install",id:"install",depth:3,charIndex:512},{text:"Register",id:"register",depth:3,charIndex:523},{text:"Config",id:"config",depth:2,charIndex:778},{text:"targets",id:"targets",depth:3,charIndex:799}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-vue",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:547},{text:"Install",id:"install",depth:3,charIndex:562},{text:"Register",id:"register",depth:3,charIndex:573},{text:"Options",id:"options",depth:2,charIndex:656},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:667}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-vue.mdx"},{title:"buildConfig",routePath:"/module-tools/api/config/build-config",lang:"zh",toc:[{text:"alias",id:"alias",depth:2,charIndex:141},{text:"asset",id:"asset",depth:2,charIndex:483},{text:"asset.name",id:"assetname",depth:2,charIndex:506},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:753},{text:"asset.path",id:"assetpath",depth:2,charIndex:981},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:1052},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:1159},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:1411},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:1510},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:1611},{text:"autoExtension",id:"autoextension",depth:2,charIndex:1802},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:2393},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:2670},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:2758},{text:"banner",id:"banner",depth:2,charIndex:2854},{text:"buildType",id:"buildtype",depth:2,charIndex:2984},{text:"copy",id:"copy",depth:2,charIndex:3087},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:3128},{text:"copy.options",id:"copyoptions",depth:2,charIndex:3180},{text:"define",id:"define",depth:2,charIndex:3341},{text:"dts",id:"dts",depth:2,charIndex:3802},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:3864},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:4097},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:4196},{text:"dts.only",id:"dtsonly",depth:2,charIndex:4419},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:4499},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:4718},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:4790},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:5293},{text:"externals",id:"externals",depth:2,charIndex:5501},{text:"footer",id:"footer",depth:2,charIndex:5617},{text:"format",id:"format",depth:2,charIndex:5655},{text:"format: esm",id:"format-esm",depth:3,charIndex:5780},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:5859},{text:"format: iife",id:"format-iife",depth:3,charIndex:5957},{text:"format: umd",id:"format-umd",depth:3,charIndex:6058},{text:"hooks",id:"hooks",depth:2,charIndex:6211},{text:"input",id:"input",depth:2,charIndex:6359},{text:"jsx",id:"jsx",depth:2,charIndex:6824},{text:"metafile",id:"metafile",depth:2,charIndex:7147},{text:"minify",id:"minify",depth:2,charIndex:7385},{text:"outDir",id:"outdir",depth:2,charIndex:7505},{text:"platform",id:"platform",depth:2,charIndex:7559},{text:"redirect",id:"redirect",depth:2,charIndex:7693},{text:"resolve",id:"resolve",depth:2,charIndex:7924},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:7946},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:8263},{text:"shims",id:"shims",depth:2,charIndex:8520},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:8787},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:9229},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:9345},{text:"sourceType",id:"sourcetype",depth:2,charIndex:9432},{text:"splitting",id:"splitting",depth:2,charIndex:9590},{text:"style",id:"style",depth:2,charIndex:9703},{text:"style.less",id:"styleless",depth:2,charIndex:9724},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:9750},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:9841},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:9925},{text:"sass",id:"sass",depth:2,charIndex:10100},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:10120},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:10190},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:10285},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:10461},{text:"style.inject",id:"styleinject",depth:2,charIndex:10620},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:11116},{text:"style.modules",id:"stylemodules",depth:2,charIndex:11350},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:11529},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3,charIndex:11611},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3,charIndex:11731},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3,charIndex:11862},{text:"target",id:"target",depth:2,charIndex:12152},{text:"transformImport",id:"transformimport",depth:2,charIndex:12318},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:12514},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:12756},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:12844},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:13004}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/api/config/build-preset",lang:"zh",toc:[{text:"`npm-library`",id:"npm-library",depth:2,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:2,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:835}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/api/config/dev",lang:"zh",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:43},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:118},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4,charIndex:314},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:417}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/api/config/plugins",lang:"zh",toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2,charIndex:79},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2,charIndex:221},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:253},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3,charIndex:259},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4,charIndex:316},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3,charIndex:364}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/api/config/plugins.md"},{title:"testing",routePath:"/module-tools/api/config/testing",lang:"zh",toc:[{text:"jest",id:"jest",depth:2,charIndex:55},{text:"transformer",id:"transformer",depth:2,charIndex:202}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/api/config/testing.md"},{title:"\u6982\u89C8",routePath:"/module-tools/api/",lang:"zh",toc:[],frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1},version:"",_relativePath:"zh/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/api/plugin-api/plugin-hooks",lang:"zh",toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2,charIndex:209},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2,charIndex:276},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2,charIndex:713},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2,charIndex:1459},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/components/faq-build-exception",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/components/faq-build-other",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/components/faq-build-product",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/components/faq-storybook",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/components/faq-test",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-test.mdx"},{title:"",routePath:"/module-tools/components/publish-emo",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/components/register-esbuild-plugin",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/components/release-module-doc",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/release-module-doc.mdx"},{title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",routePath:"/module-tools/guide/advance/asset",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2,charIndex:74},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:355}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/advance/asset.mdx"},{title:"\u6784\u5EFA umd \u4EA7\u7269",routePath:"/module-tools/guide/advance/build-umd",lang:"zh",toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2,charIndex:181},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:302},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3,charIndex:556},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2,charIndex:836}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/advance/build-umd.mdx"},{title:"\u4F7F\u7528 Copy \u5DE5\u5177",routePath:"/module-tools/guide/advance/copy",lang:"zh",toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2,charIndex:72},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2,charIndex:165},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2,charIndex:826},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3,charIndex:838},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:851},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:865},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3,charIndex:879},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3,charIndex:891}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/advance/copy.md"},{title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",routePath:"/module-tools/guide/advance/external-dependency",lang:"zh",toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2,charIndex:264},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:521},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2,charIndex:652}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/advance/external-dependency.mdx"},{title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",routePath:"/module-tools/guide/advance/in-depth-about-build",lang:"zh",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2,charIndex:1281},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2,charIndex:1762},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3,charIndex:1936},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:1946},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:2048},{text:"Hook API",id:"hook-api",depth:3,charIndex:2117},{text:"load",id:"load",depth:4,charIndex:2128},{text:"transform",id:"transform",depth:4,charIndex:2236},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:2358},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2,charIndex:2500},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3,charIndex:2542},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3,charIndex:2619},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3,charIndex:3090},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3,charIndex:3208},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2,charIndex:3220},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2,charIndex:3394},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2,charIndex:3567}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/advance/in-depth-about-build.md"},{title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",routePath:"/module-tools/guide/advance/in-depth-about-dev-command",lang:"zh",toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2,charIndex:42},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2,charIndex:333}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/advance/in-depth-about-dev-command.md"},{title:"\u5F00\u59CB\u4E4B\u524D",routePath:"/module-tools/guide/basic/before-getting-started",lang:"zh",toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2,charIndex:3},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2,charIndex:188},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2,charIndex:391},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2,charIndex:818},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2,charIndex:1602},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3,charIndex:1621},{text:'"scripts"',id:"scripts",depth:3,charIndex:2042},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:2825},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2,charIndex:3139},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2,charIndex:3247}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/basic/before-getting-started.md"},{title:"CLI \u547D\u4EE4",routePath:"/module-tools/guide/basic/command-preview",lang:"zh",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern test`",id:"modern-test",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/basic/command-preview.md"},{title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",routePath:"/module-tools/guide/basic/modify-output-product",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2,charIndex:3},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2,charIndex:344},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2,charIndex:664},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2,charIndex:1952}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/basic/modify-output-product.md"},{title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",routePath:"/module-tools/guide/basic/publish-your-project",lang:"zh",toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2,charIndex:231},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2,charIndex:519},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2,charIndex:728},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2,charIndex:1040}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/basic/publish-your-project.mdx"},{title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",routePath:"/module-tools/guide/basic/use-micro-generator",lang:"zh",toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2,charIndex:166},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2,charIndex:370},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2,charIndex:561},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2,charIndex:709}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/basic/use-micro-generator.md"},{title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",routePath:"/module-tools/guide/basic/use-module-doc",lang:"zh",toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2,charIndex:29},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3,charIndex:37},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3,charIndex:146},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2,charIndex:233},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3,charIndex:625},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2,charIndex:830},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2,charIndex:916},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:973},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3,charIndex:1216},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3,charIndex:1369},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2,charIndex:1461},{text:"API",id:"api",depth:3,charIndex:1505},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4,charIndex:1525},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4,charIndex:1563},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4,charIndex:2032},{text:"Overview",id:"overview",depth:3,charIndex:2092},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2,charIndex:2360},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:2368},{text:"doc",id:"doc",depth:3,charIndex:2478},{text:"entries",id:"entries",depth:3,charIndex:2493},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:2596},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:2749},{text:"previewMode",id:"previewmode",depth:3,charIndex:2818},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:2936},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:3003},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2,charIndex:3112},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2,charIndex:3184}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/use-module-doc.mdx"},{title:"\u4F7F\u7528 Storybook",routePath:"/module-tools/guide/basic/using-storybook",lang:"zh",toc:[{text:"V7 (\u63A8\u8350)",id:"v7-\u63A8\u8350",depth:2,charIndex:239},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook",depth:3,charIndex:250},{text:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",id:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",depth:3,charIndex:492},{text:"\u5F00\u542F Rspack \u6784\u5EFA",id:"\u5F00\u542F-rspack-\u6784\u5EFA",depth:3,charIndex:946},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:3,charIndex:1095},{text:"bundler",id:"bundler",depth:4,charIndex:1134},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:1222},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:3,charIndex:1356},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:1409},{text:"storybook build",id:"storybook-build",depth:4,charIndex:1444},{text:"\u914D\u7F6E\u6587\u4EF6",id:"\u914D\u7F6E\u6587\u4EF6",depth:3,charIndex:1490},{text:"\u4ECE V6 \u8FC1\u79FB\u81F3 V7",id:"\u4ECE-v6-\u8FC1\u79FB\u81F3-v7",depth:2,charIndex:1574},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:2037},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook-1",depth:3,charIndex:2178},{text:"\u914D\u7F6E Storybook",id:"\u914D\u7F6E-storybook",depth:3,charIndex:2358},{text:"\u6784\u5EFA Storybook \u4EA7\u7269",id:"\u6784\u5EFA-storybook-\u4EA7\u7269",depth:3,charIndex:2705}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/using-storybook.mdx"},{title:"\u5F00\u53D1\u7EC4\u4EF6",routePath:"/module-tools/guide/best-practices/components",lang:"zh",toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2,charIndex:40},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2,charIndex:166},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2,charIndex:227},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:335},{text:"Less",id:"less",depth:3,charIndex:587},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:680},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:784},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:832},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2,charIndex:1071},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2,charIndex:1431}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/best-practices/components.mdx"},{title:"\u4F7F\u7528 Tailwind CSS",routePath:"/module-tools/guide/best-practices/use-tailwindcss",lang:"zh",toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2,charIndex:127},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2,charIndex:585},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2,charIndex:1047},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2,charIndex:1360},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3,charIndex:1477},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3,charIndex:1660},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2,charIndex:1732},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2,charIndex:1890},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3,charIndex:1925},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:2192},{text:"Less",id:"less",depth:4,charIndex:2300},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/best-practices/use-tailwindcss.mdx"},{title:"\u901A\u7528\u7C7B\u95EE\u9898",routePath:"/module-tools/guide/faq/basic",lang:"zh",toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2,charIndex:3},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2,charIndex:103}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/basic.mdx"},{title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/build",lang:"zh",toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2,charIndex:110},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3,charIndex:118},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:1337},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2,charIndex:1559},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:1568},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4,charIndex:1614},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4,charIndex:1714},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4,charIndex:1916},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:2338},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:2595},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3,charIndex:-1},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2,charIndex:2940},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3,charIndex:2946},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3,charIndex:3184},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3,charIndex:3492}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/build.mdx"},{title:"\u5E38\u89C1\u95EE\u9898",routePath:"/module-tools/guide/faq/",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/guide/faq/index.md"},{title:"Storybook \u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/storybook",lang:"zh",toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2,charIndex:3},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2,charIndex:58},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:263},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2,charIndex:373},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2,charIndex:538},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2,charIndex:696}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/storybook.mdx"},{title:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/test",lang:"zh",toc:[{text:"\u6267\u884C `test` \u547D\u4EE4\u62A5\u9519 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:2,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/test.mdx"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/guide/intro/getting-started",lang:"zh",toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2,charIndex:3},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3,charIndex:110},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3,charIndex:402},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3,charIndex:784},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3,charIndex:1118},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2,charIndex:1175}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/intro/getting-started.mdx"},{title:"\u6B22\u8FCE\u4F7F\u7528",routePath:"/module-tools/guide/intro/welcome",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/intro/welcome.md"},{title:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",routePath:"/module-tools/guide/intro/why-module-engineering-solution",lang:"zh",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/",lang:"zh",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Jest: \u4EE4\u4EBA\u6109\u5FEB\u7684\u6D4B\u8BD5\u6846\u67B6",details:"\u96C6\u6210\u4E86 Jest\uFF0C\u4F7F\u5F97\u4EE3\u7801\u6D4B\u8BD5\u66F4\u52A0\u5BB9\u6613\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"zh/index.md"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/plugins/guide/getting-started",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/plugins/guide/getting-started.mdx"},{title:"\u63D2\u4EF6\u5BF9\u8C61",routePath:"/module-tools/plugins/guide/plugin-object",lang:"zh",toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2,charIndex:245},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2,charIndex:323}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/plugins/guide/plugin-object.mdx"},{title:"Setup \u51FD\u6570",routePath:"/module-tools/plugins/guide/setup-function",lang:"zh",toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2,charIndex:77},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2,charIndex:430},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2,charIndex:579}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/plugins/guide/setup-function.mdx"},{title:"\u603B\u89C8",routePath:"/module-tools/plugins/official-list/overview",lang:"zh",toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/overview.md"},{title:"Babel \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-babel",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:50},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:58},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:64},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:172}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-babel.mdx"},{title:"Banner \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-banner",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:132},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:140},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:146},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:240},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3,charIndex:246},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:267},{text:"banner",id:"banner",depth:3,charIndex:283},{text:"footer",id:"footer",depth:3,charIndex:362}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-banner.mdx"},{title:"Import \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-import",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:144},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:152},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:158},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:245},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:261},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2,charIndex:357}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-node-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:213},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:221},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:227},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:274},{text:"exclude",id:"exclude",depth:3,charIndex:290},{text:"overrides",id:"overrides",depth:3,charIndex:326},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:363},{text:"Globals",id:"globals",depth:3,charIndex:381},{text:"Modules",id:"modules",depth:3,charIndex:464},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:860}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:197},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:205},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:211},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:322},{text:"targets",id:"targets",depth:3,charIndex:338}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-vue",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:256},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:264},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:270},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:317},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:323}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-vue.mdx"}],markdown:{showLineNumbers:!1,defaultWrapCode:!1,codeHighlighter:"prism"}}},9580:function(e,t,n){"use strict";n.d(t,{Zo:function(){return l},ah:function(){return o}});var i=n("2363");let r=i.createContext({});function o(e){let t=i.useContext(r);return i.useMemo(()=>"function"==typeof e?e(t):{...t,...e},[t,e])}let a={};function l({components:e,children:t,disableParentContext:n}){let l;return l=n?"function"==typeof e?e({}):e||a:o(e),i.createElement(r.Provider,{value:l},t)}},72855:function(e,t,n){"use strict";n.d(t,{$U:function(){return th},E9:function(){return tv},Kw:function(){return td},_f:function(){return ta},bw:function(){return tr},kv:function(){return te},lm:function(){return to},mi:function(){return ts},pJ:function(){return tx},pZ:function(){return tu},rp:function(){return tt},t6:function(){return tn},tz:function(){return tg},xM:function(){return tp},xf:function(){return tc},yc:function(){return tf},yv:function(){return ti}});var i,r,o,a,l,s,d,c,u,h="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,m=h||p||Function("return this")(),f=m.Symbol,g=Object.prototype,x=g.hasOwnProperty,v=g.toString,b=f?f.toStringTag:void 0,y=function(e){var t=x.call(e,b),n=e[b];try{e[b]=void 0;var i=!0}catch(e){}var r=v.call(e);return i&&(t?e[b]=n:delete e[b]),r},w=Object.prototype.toString,k=f?f.toStringTag:void 0,j=function(e){var t;if(null==e)return void 0===e?"[object Undefined]":"[object Null]";return k&&k in Object(e)?y(e):(t=e,w.call(t))},I=function(e){return null!=e&&"object"==typeof e},P=Array.isArray,E=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},S=function(e){return e},C=function(e){if(!E(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},z=m["__core-js_shared__"];var N=(i=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",_=Function.prototype.toString,A=function(e){if(null!=e){try{return _.call(e)}catch(e){}try{return e+""}catch(e){}}return""},T=/^\[object .+?Constructor\]$/,O=Object.prototype,M=Function.prototype.toString,L=O.hasOwnProperty,D=RegExp("^"+M.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=function(e){var t;return!!E(e)&&(t=e,!N||!(N in t))&&(C(e)?D:T).test(A(e))},B=function(e,t){var n,i,r=(n=e,i=t,null==n?void 0:n[i]);return R(r)?r:void 0},$=Object.create,F=function(){function e(){}return function(t){if(!E(t))return{};if($)return $(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),H=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Z=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n0){if(++o>=800)return arguments[0]}else o=0;return r.apply(void 0,arguments)}),V=/^(?:0|[1-9]\d*)$/,G=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&V.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ei=function(e){return null!=e&&en(e.length)&&!C(e)},er=function(e,t,n){if(!E(n))return!1;var i=typeof t;return("number"==i?!!(ei(n)&&G(t,n.length)):"string"==i&&t in n)&&Q(n[t],e)},eo=Object.prototype,ea=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||eo)},el=function(e,t){for(var n=-1,i=Array(e);++n-1},eD.prototype.set=function(e,t){var n=this.__data__,i=eM(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var eR=B(m,"Map"),eB=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},e$=function(e,t){var n=e.__data__;return eB(t)?n["string"==typeof t?"string":"hash"]:n.map};function eF(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(r=u.length>3&&"function"==typeof r?(i--,r):void 0,o&&er(t[0],t[1],o)&&(r=i<3?void 0:r,i=1),e=Object(e);++n!0,tr=e=>e.replace(e9,"").replace(e8,"");function to(e){return e.replace(/#.*$/,"")}var ta=()=>!0;function tl(e){return"/"===e.charAt(0)||tc(e)?e:`/${e}`}function ts(e){return"/"===e.charAt(e.length-1)?e:`${e}/`}function td(e){var t;return"/"===(t=tl(function(e){let t=e.replace(/\\/g,"/"),n=t.startsWith("/"),i=t.split("/"),r=[];for(let e of i)"."===e||""===e||(".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():n&&r.push(".."):r.push(e));let o=r.join("/");return n&&(o=`/${o}`),o}(e))).charAt(t.length-1)?t.slice(0,-1):t}function tc(e=""){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")}function tu(e=""){return/^\s*data:/i.test(e)}function th(e,t,n,i="",r=!1){let o=tv(e,i);!o&&(o=r?"/index":"/index.html"),o.endsWith("/")&&(o+=r?"/index":"/index.html");let a="",l="",s="",d=o.split("/").filter(Boolean);return n.current&&n.current!==n.default&&(a=d.shift()||""),t.target!==t.default?(l=t.target,t.current!==t.default&&d.shift()):d.shift(),s=d.join("/")||"",(a||l)&&!s&&(s=r?"index":"index.html"),tx(tl([a,l,s].filter(Boolean).join("/")),i)}function tp(e,t,n="",i=!1){let r=tv(e,n);!r&&(r=i?"/index":"/index.html");let o="",a=r.split("/").filter(Boolean);t.target!==t.default?(o=t.target,t.current!==t.default&&a.shift()):a.shift();let l=a.join("/")||"";return o&&!l&&(l=i?"index":"index.html"),tx(tl([o,l].filter(Boolean).join("/")),n)}var tm=e=>{let[t,n=""]=e.split("#");return{url:t,hash:n}};function tf(e,t=!1){if(!e)return"/";if(tc(e))return e;let{url:n,hash:i}=tm(decodeURIComponent(e));return!t&&!n.endsWith(".html")&&(n.endsWith("/")?n+="index.html":n+=".html"),t&&n.endsWith("/")&&(n+="index"),tl(i?`${n}#${i}`:n)}function tg(e,t=""){return tl(e).replace(td(t),"")}function tx(e="/",t=""){let n=tl(e),i=td(t);return n.startsWith(i)?n:`${i}${n}`}function tv(e,t){return tl(e).replace(RegExp(`^${td(t)}`),"")}},60125:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})})},72247:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M22 16 12 26l-1.4-1.4 8.6-8.6-8.6-8.6L12 6z"})})},35329:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M24 9.4 22.6 8 16 14.6 9.4 8 8 9.4l6.6 6.6L8 22.6 9.4 24l6.6-6.6 6.6 6.6 1.4-1.4-6.6-6.6L24 9.4z"})})},32313:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 30 30",...e,children:[(0,i.jsx)("path",{fill:"currentColor",d:"M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"})]})},93388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})})},78009:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,fill:"none",viewBox:"0 0 48 48",...e,children:[(0,i.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M24 5v6m7 1 4-4m-18 4-4-4m27 33H8a2 2 0 0 1-2-2v-8.46a2 2 0 0 1 .272-1.007l6.15-10.54A2 2 0 0 1 14.148 18H33.85a2 2 0 0 1 1.728.992l6.149 10.541A2 2 0 0 1 42 30.541V39a2 2 0 0 1-2 2Z"}),(0,i.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M41.5 30H28s-1 3-4 3-4-3-4-3H6.5"})]})},66433:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:[(0,i.jsx)("circle",{cx:22,cy:24,r:2,fill:"currentColor"}),(0,i.jsx)("path",{fill:"none",d:"M22 28a4 4 0 1 1 4-4 4.004 4.004 0 0 1-4 4Zm0-6a2 2 0 1 0 2 2 2.003 2.003 0 0 0-2-2Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M29.777 23.479A8.64 8.64 0 0 0 22 18a8.64 8.64 0 0 0-7.777 5.479L14 24l.223.521A8.64 8.64 0 0 0 22 30a8.64 8.64 0 0 0 7.777-5.479L30 24ZM22 28a4 4 0 1 1 4-4 4.005 4.005 0 0 1-4 4Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M12 28H8V4h8v6a2.006 2.006 0 0 0 2 2h6v4h2v-6a.91.91 0 0 0-.3-.7l-7-7A.909.909 0 0 0 18 2H8a2.006 2.006 0 0 0-2 2v24a2.006 2.006 0 0 0 2 2h4Zm6-23.6 5.6 5.6H18Z"})]})},96113:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})},54788:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"m21.94 13.11-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91-6.17-7.91m8.73 7.92 2.47-7.59.1-.33h3.61l-5.59 7.16m4.1-13.67 1.81 5.56h-3.62m-1.3.95-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94 7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43 5.82 7.45m11.38-4.73-6.51 4.73.02-.03 5.79-7.42.79 2.43c.04.1 0 .22-.09.29"})})},68640:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M28 12v-2h-6V4h-2v6h-8V4h-2v6H4v2h6v8H4v2h6v6h2v-6h8v6h2v-6h6v-2h-6v-8Zm-8 8h-8v-8h8Z"})})},84820:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M13.414 17.586 18 22.172V8H8V6h10a2.002 2.002 0 0 1 2 2v14.172l4.586-4.586L26 19l-7 7-7-7Z"})})},74400:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsxs)("g",{fill:"none",stroke:"var(--rp-c-brand)",strokeLinecap:"round",strokeWidth:2,children:[(0,i.jsx)("path",{strokeDasharray:60,strokeDashoffset:60,strokeOpacity:.3,d:"M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",children:(0,i.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"1.3s",values:"60;0"})}),(0,i.jsxs)("path",{strokeDasharray:15,strokeDashoffset:15,d:"M12 3a9 9 0 0 1 9 9",children:[(0,i.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),(0,i.jsx)("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})]})]})})},93614:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"})})},51457:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"})})},7617:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"var(--rp-c-gray)",d:"m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z"})})},64992:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",...e,children:[(0,i.jsx)("circle",{cx:8,cy:16,r:2,fill:"currentColor"}),(0,i.jsx)("circle",{cx:16,cy:16,r:2,fill:"currentColor"}),(0,i.jsx)("circle",{cx:24,cy:16,r:2,fill:"currentColor"})]})},4226:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:32,height:32,viewBox:"0 0 30 30",...e,children:(0,i.jsx)("path",{fill:"#49cd37",d:"m13 24-9-9 1.414-1.414L13 21.171 26.586 7.586 28 9 13 24z"})})},51505:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"})})},1188:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 4a2 2 0 0 1 2-2h8a1 1 0 0 1 .707.293l5 5A1 1 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4zm13.586 4L14 4.414V8h3.586zM12 4H6v16h12V10h-5a1 1 0 0 1-1-1V4z"})})},86255:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:18,height:18,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6 2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z"})})},5687:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 7H3V5h13v2M3 19h13v-2H3v2m19-7-4-3v2H3v2h15v2l4-3Z"})})},53211:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"#22a041",d:"M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"})})},23657:function(e,t,n){"use strict";n.d(t,{AV:function(){return tr},Ar:function(){return tI},BZ:function(){return t9},CF:function(){return eU},CU:function(){return eW},Ct:function(){return t2},EG:function(){return n2},JL:function(){return nO},KO:function(){return nu},M4:function(){return e$},NG:function(){return tp},O9:function(){return na},OK:function(){return nK},Os:function(){return tP},Qe:function(){return nW},Qn:function(){return tv},RY:function(){return tj},Rg:function(){return id},SU:function(){return nH},TJ:function(){return t0},UQ:function(){return eG},VA:function(){return tm},Vl:function(){return eq},Vp:function(){return ic},WG:function(){return nx},WS:function(){return eZ},YE:function(){return io},YS:function(){return ti},ZB:function(){return il},ZP:function(){return ip},cY:function(){return eY},eE:function(){return eQ},eF:function(){return eV},g2:function(){return nL},ls:function(){return tc},mQ:function(){return nQ},mi:function(){return t6},of:function(){return ih},ol:function(){return n3},pU:function(){return nq},qx:function(){return eB},rU:function(){return ns},s2:function(){return th},tx:function(){return eH},xB:function(){return nr},xK:function(){return ne},xN:function(){return tf},y2:function(){return tt},zh:function(){return tu},zx:function(){return t4}});var i,r,o,a,l,s,d,c,u,h,p,m,f,g,x,v,b,y,w,k,j,I,P=n("51812"),E=n("39980");n("31642");var S=n("20288"),C=n("23657"),z=n("95929"),N=n("2363"),_=n("9580"),A=n("40741"),T=n("8319"),O=n("92688"),M=n("72855"),L=n("45187"),D=n("85653"),R=n("25756"),B=n("13328"),$=n("93371"),F=n("49555"),H=n("84520"),Z=n("93614"),W=n("72247"),U=n("85394"),q=n("5687"),V=n("53211"),G=n("16288"),Y=n("68271"),Q=n("79522"),K=n("32313"),J=n("4226"),X=n("11207"),ee=n("47841"),et=n("99593"),en=n("64992"),ei=n("12555"),er=n("51505"),eo=n("51457"),ea=n("60125"),el=n("86255"),es=n("93388"),ed=n("7617"),ec=n("11593"),eu=n("49157"),eh=n("61850"),ep=n("51801"),em=n("35329"),ef=n("74400"),eg=n("78009"),ex=n("66433"),ev=n("84820"),eb=n("68640"),ey=n("1188"),ew=n("96113"),ek=n("54788"),ej=Object.defineProperty,eI=Object.defineProperties,eP=Object.getOwnPropertyDescriptors,eE=Object.getOwnPropertySymbols,eS=Object.prototype.hasOwnProperty,eC=Object.prototype.propertyIsEnumerable,ez=(e,t,n)=>t in e?ej(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eN=(e,t)=>{for(var n in t||(t={}))eS.call(t,n)&&ez(e,n,t[n]);if(eE)for(var n of eE(t))eC.call(t,n)&&ez(e,n,t[n]);return e},e_=(e,t)=>eI(e,eP(t)),eA=(e,t)=>{var n={};for(var i in e)eS.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&eE)for(var i of eE(e))0>t.indexOf(i)&&eC.call(e,i)&&(n[i]=e[i]);return n},eT=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},eO=(e,t,n)=>(eT(e,t,"read from private field"),n?n.call(e):t.get(e)),eM=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},eL=(e,t,n,i)=>(eT(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),eD=(e,t,n)=>(eT(e,t,"access private method"),n),eR=(e,t,n)=>new Promise((i,r)=>{var o=e=>{try{l(n.next(e))}catch(e){r(e)}},a=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=e=>e.done?i(e.value):Promise.resolve(e.value).then(o,a);l((n=n.apply(e,t)).next())});function eB(){let{siteData:e}=(0,P.Vi)(),t=e.lang;if(t&&"undefined"!=typeof window&&location.pathname.includes(`/${t}/`)){let e=location.pathname.replace(`/${t}/`,"/");return window.location.replace(e),(0,E.jsx)(E.Fragment,{})}return(0,E.jsxs)("div",{className:"m-auto mt-50 p-16 sm:p-8 sm:pt-24 sm:pb-40 text-center flex-center flex-col",children:[(0,E.jsx)("p",{className:"text-6xl font-semibold",children:"404"}),(0,E.jsx)("h1",{className:"leading-5 pt-3 text-xl font-bold",children:"PAGE NOT FOUND"}),(0,E.jsx)("div",{style:{height:"1px"},className:"mt-6 mx-auto mb-4.5 w-16 bg-gray-light-1"}),(0,E.jsx)("div",{className:"pt-5",children:(0,E.jsx)("a",{className:"py-2 px-4 rounded-2xl inline-block border-solid border-brand text-brand font-medium hover:border-brand-dark hover:text-brand-dark transition-colors duration-300",href:e.base,"aria-label":"go to home",children:"Take me home"})})]})}function e$(){var e,t,n;let i=(0,P.Vi)(),{page:{lang:r}}=i,o=null!=(t=null==(e=null==i?void 0:i.siteData)?void 0:e.themeConfig)?t:{},a=null!=(n=i.siteData.lang)?n:"",l=null==o?void 0:o.locales;return l&&0!==l.length?e_(eN({},l.find(e=>e.lang===r)),{langRoutePrefix:r===a?"/":r}):{nav:o.nav,sidebar:o.sidebar,prevPageText:o.prevPageText,nextPageText:o.nextPageText,sourceCodeText:o.sourceCodeText,searchPlaceholderText:o.searchPlaceholderText}}var eF=(e,t)=>{let n;for(let i of Object.keys(e)){if(n&&n!==i)continue;if((0,O.pV)((0,O.pJ)(i),t))return{group:"Documentation",items:e[i]};let r=e[i].find(r=>{let o=r=>{if(!t.startsWith((0,O.pJ)(i))){for(let r of Object.keys(e))if(r!==i&&t.startsWith((0,M.mi)((0,O.pJ)(r))))return n=r,!1}let a=()=>"link"in r&&(0,O.pV)((0,O.pJ)(r.link),t);if("items"in r)return!!a()||r.items.some(e=>o(e));return a()};return o(r)});if(r){let t=e[i];return{group:"text"in r&&r.text||"",items:t}}}return{group:"Documentation",items:[]}};function eH(){var e;let t=e$(),n=null!=(e=t.sidebar)?e:{},{pathname:i}=(0,T.TH)(),r=decodeURIComponent(i),[o,a]=(0,N.useState)(eF(n,r));return(0,N.useEffect)(()=>{a(eF(n,r))},[r,t.lang]),o}function eZ(){let{pathname:e}=(0,T.TH)(),{items:t}=eH(),n=[],i=e=>{"items"in e?(e.link&&n.push({text:e.text,link:e.link}),e.items.forEach(e=>{"dividerType"in e||i(e)})):n.push(e)};t.forEach(e=>!("dividerType"in e)&&i(e));let r=n.findIndex(t=>(0,O.pV)((0,O.pJ)(t.link),e)),o=n[r-1]||null;return{prevPage:o,nextPage:n[r+1]||null}}function eW(){var e,t,n;let{siteData:i,page:r}=(0,P.Vi)(),o=null!=(n=null!=(t=e$().editLink)?t:null==(e=i.themeConfig)?void 0:e.editLink)?n:{};if(!o.docRepoBaseUrl||!o.text)return null;let{docRepoBaseUrl:a}=o;!a.endsWith("/")&&(a+="/");let l=r._relativePath.replace(/\\/g,"/"),s=`${a}${l}`;return{text:o.text,link:s}}function eU(){var e;let{siteData:{themeConfig:t},page:{frontmatter:n={}}}=(0,P.Vi)(),i=(null==(e=null==n?void 0:n.navbar)||e)&&(null==t?void 0:t.hideNavbar)!=="always",[r,o]=(0,N.useState)(i);return[r,o]}function eq(){var e;let{siteData:{themeConfig:t}}=(0,P.Vi)(),n=null!=(e=t.hideNavbar)?e:"never",[i,r]=(0,N.useState)(!1),{pathname:o}=(0,T.TH)(),a=(0,N.useRef)(0);return"never"!==n&&("always"===n||((0,N.useEffect)(()=>{r(!1);let e=(0,L.Z)(()=>{let{scrollTop:e}=document.documentElement;if(e!==a.current)r(a.current>0&&e-a.current>0),a.current=e<=0?0:e},200);return window.addEventListener("mousewheel",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousewheel",e),window.removeEventListener("touchmove",e)}},[o]),i))}function eV(e,t,n=72){let i=parseInt(window.getComputedStyle(e).paddingTop,10),r=window.scrollY+e.getBoundingClientRect().top-n-i;window.scrollTo(eN({left:0,top:Math.round(r)},t?{behavior:"smooth"}:{}))}function eG(){let e=document.getElementById("aside-container"),t=Array.from(document.querySelectorAll(".rspress-doc .header-anchor")).filter(e=>{var t;return(null==(t=e.parentElement)?void 0:t.tagName)!=="H1"});if(!e||!t.length)return;let n=null;if(!Array.from((null==e?void 0:e.getElementsByTagName("a"))||[]).map(e=>decodeURIComponent(e.hash)).length)return;let i=(t,i)=>{if(t[i]){let r=t[i].getAttribute("href"),o=null==e?void 0:e.querySelector(`a[href="#${null==r?void 0:r.slice(1)}"] > span`);o&&(n&&n.classList.remove("aside-active"),(n=o).classList.add("aside-active"))}},r=()=>{if(document.documentElement.scrollTop+window.innerHeight>=document.documentElement.scrollHeight)i(t,t.length-1);else for(let e=0;e=a&&o{n&&n.classList.remove("aside-active"),window.removeEventListener("scroll",o)}}function eY(){(0,M._f)()&&(window.addEventListener("click",e=>{let t=e.target.closest("a");if(t){let{origin:n,hash:i,target:r,pathname:o,search:a}=t,l=window.location;i&&"_blank"!==r&&n===l.origin&&(o===l.pathname&&a===l.search&&i&&t.classList.contains("header-anchor")?(e.preventDefault(),history.pushState(null,"",i),!function(e,t,n=!1){let i=null;try{i=e.classList.contains("header-anchor")?e:document.getElementById(decodeURIComponent(t.slice(1)))}catch(e){console.warn(e)}i&&eV(i,n)}(t,i,!0),window.dispatchEvent(new Event("hashchange"))):window.addEventListener("RspressReloadContent",()=>{location.hash.length>1&&eV(document.getElementById(location.hash.slice(1)),!1)}))}},{capture:!0}),window.addEventListener("hashchange",e=>{e.preventDefault()}))}function eQ(){let e=(0,P.Jr)(),t=(0,P.aw)(),n=(0,P.Vi)(),i=n.siteData.lang,r=n.siteData.multiVersion.default;return{normalizeLinkHref:n=>{let o=n;if((i||r)&&!(0,M.xf)(o)&&!o.startsWith("#")){let n=(o=(0,O.E9)(o)).split("/").filter(Boolean),a="",l="",s="";return r&&(t!==r?(a=t,n[0]===t&&n.shift()):n[0]===r&&n.shift()),i&&(e!==i?(l=e,n[0]===e&&n.shift()):n[0]===i&&n.shift()),s=n.join("/"),(0,O.AP)((0,O.pJ)([a,l,s].filter(Boolean).join("/")))}return o}}}var eK="default",eJ=/[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]/u,eX=/[\u0400-\u04FF]/u;function e0(e){let t=e.toString().toLowerCase().normalize("NFD"),n=t.replace(/[\u0300-\u036f]/g,"");return eX.test(String(e))?t.normalize("NFC"):eJ.test(String(e))?n.normalize("NFC"):n}function e1(e){return e.replace(/https?:\/\/[^/]+/,"")}function e2(e){return e.charCodeAt(0)>255?3:1}var e3=e=>e.map(e=>"string"==typeof e?{value:e,label:e}:e);function e4(e,t){let n=0,i=0;for(let r=0;r=t);r++)i+=e2(e.charAt(r)),n++;return n}function e5(e){let t=0;for(let n=0;ne_(eN({},e),{normalizedContent:e0(e.content),headers:e.toc.map(e=>e0(e.text)).join(" "),normalizedTitle:e0(e.title)})),c={tokenize:"full",async:!0,doc:{id:"routePath",field:["normalizedTitle","headers","normalizedContent"]},cache:100,split:/\W+/};eL(this,r,D.create(c)),eL(this,o,D.create(e_(eN({},c),{tokenize:e=>e8(e,e6)}))),eL(this,a,D.create(e_(eN({},c),{tokenize:e=>e8(e,e7)}))),eO(this,r).add(d),eO(this,o).add(d),eO(this,a).add(d)})}search(e){return eR(this,null,function*(){var t,n;let{keyword:i,limit:l}=e,s={query:i,limit:l,field:["normalizedTitle","headers","normalizedContent"]};return[{index:eK,hits:(yield Promise.all([null==(t=eO(this,r))?void 0:t.search(s),null==(n=eO(this,o))?void 0:n.search(s),eO(this,a).search(s)])).flat(2).filter(Boolean)}]})}};r=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakSet,s=function(e,t){return eR(this,null,function*(){let n=`${t}###${e}`,i=t?`.${t.replace(".","_")}`:"",r=e?`.${e}`:"";return(yield fetch(`/module-tools/static/${M.t6}${i}${r}.${R.Z[n]}.json`)).json()})};var te=class{constructor(){eM(this,d,void 0)}init(e){return eR(this,null,function*(){eL(this,d,e)})}search(e){return eR(this,null,function*(){let{apiUrl:t,searchIndexes:n}=eO(this,d),{keyword:i,limit:r}=e,o=Object.entries({keyword:i,limit:r.toString(),searchIndexes:(null==n?void 0:n.map(e=>"string"==typeof e?e:e.value).join(","))||"",lang:eO(this,d).currentLang}).map(e=>e.map(encodeURIComponent).join("=")).join("&");try{return(yield fetch(`${t}?${o}`)).json()}catch(e){return console.error(e),[]}})}};d=new WeakMap;var tt=((i=tt||{}).Default="default",i.Custom="custom",i),tn=class{constructor(e){if(eM(this,p),eM(this,f),eM(this,x),eM(this,b),eM(this,w),eM(this,j),eM(this,c,void 0),eM(this,u,eK),eM(this,h,void 0),eL(this,c,e),eL(this,u,e.indexName),"remote"===e.mode)eL(this,h,new te);else eL(this,h,new e9)}init(){return eR(this,null,function*(){var e;yield null==(e=eO(this,h))?void 0:e.init(eO(this,c))})}match(e,t=7){return eR(this,null,function*(){var n;let i=yield null==(n=eO(this,h))?void 0:n.search({keyword:e,limit:t}),r=e0(e),o=(null==i?void 0:i.find(e=>eD(this,j,I).call(this,e.index)))||{index:eK,renderType:"default",hits:[]};return[{group:eO(this,u),renderType:"default",result:eD(this,p,m).call(this,r,o)},...((null==i?void 0:i.filter(e=>!eD(this,j,I).call(this,e.index)))||[]).map(e=>({group:e.index,renderType:"default",result:eD(this,p,m).call(this,r,e)}))]})}};function ti(){var e;let{siteData:t,page:n}=(0,P.Vi)(),[i,r]=(0,N.useState)(!1),{sidebar:o}=e$(),a=e=>eF(o,e).group,l=(0,N.useRef)(null);return(0,N.useEffect)(()=>{!function(){eR(this,null,function*(){if(!i){let e=new tn(e_(eN({},t.search),{mode:"local",currentLang:n.lang,currentVersion:n.version,extractGroupName:a}));l.current=e,yield e.init(),r(!0)}})}()},[]),{initialized:i,search:null==(e=l.current)?void 0:e.match.bind(l.current)}}function tr(){let{siteData:e,page:t}=(0,P.Vi)(),n=e.lang||"",i=Object.values(e.themeConfig.locales||{}).map(e=>e.lang)||[],r=t.lang;(0,N.useEffect)(()=>{var t;let o;if("auto"!==(null!=(t=e.themeConfig.localeRedirect)?t:"auto")||!n)return;let{pathname:a,search:l}=window.location,s=(0,O.E9)(a),d="rspress-visited";if(localStorage.getItem(d))return;localStorage.setItem(d,"1");let c=window.navigator.language.split("-")[0];if(!!i.includes(c))c!==r&&(o=c===n?a.replace(`/${r}`,""):r===n?(0,O.pJ)(`/${c}${s}`):a.replace(`/${r}`,`/${c}`))&&window.location.replace(o+l)},[])}c=new WeakMap,u=new WeakMap,h=new WeakMap,p=new WeakSet,m=function(e,t){let n=[];return null==t||t.hits.forEach(t=>{eD(this,f,g).call(this,t,e,n),!eD(this,x,v).call(this,t,e,n)&&eD(this,b,y).call(this,t,e,n)}),n},f=new WeakSet,g=function(e,t,n){let{title:i=""}=e,r=e0(i);return!!r.includes(t)&&(n.push({type:"title",title:i,header:i,link:`${e.domain}${(0,O.AP)(e.routePath)}`,query:t,highlightInfoList:[{start:r.indexOf(t),length:e5(t)}],group:eO(this,c).extractGroupName(e.routePath)}),!0)},x=new WeakSet,v=function(e,t,n){let{toc:i=[],domain:r="",title:o=""}=e;for(let[a,l]of i.entries())if(e0(l.text).includes(t)){let s=(function(e,t){let n=e[t],i=t,r=[n];for(;n&&n.depth>2;){let t=!1;for(let o=i-1;o>=0;o--){let a=e[o];if(a.depth>1&&a.depth===n.depth-1){n=a,i=o,r.unshift(n),t=!0;break}}if(!t)break}return r})(i,a).map(e=>e.text).join(" > "),d=e0(s).indexOf(t),u=`${o} > `;return n.push({type:"header",title:e.title,header:`${u}${s}`,highlightInfoList:[{start:d+u.length,length:e5(t)}],link:`${r}${(0,O.AP)(e.routePath)}#${l.id}`,query:t,group:eO(this,c).extractGroupName(e.routePath)}),!0}return!1},b=new WeakSet,y=function(e,t,n){var i,r,o;let{content:a,toc:l,domain:s}=e;if(!a.length)return;let d=e0(a),u=d.indexOf(t),h=l.map(e=>e.charIndex),p=e=>l[h.findIndex((t,n)=>{if(!(n=e)return!0}return!1})];if(-1===u){let o=null==(i=e._matchesPosition)?void 0:i.content;if(!(null==o?void 0:o.length))return;let l=e._matchesPosition.content[0].start,d=p(l),u=e4(a,l),h=e4(a,l+100),m=a.slice(u,h),f=e._matchesPosition.content.filter(e=>e.start>=l&&e.start+e.length<=l+100).map(e=>({start:e4(a,e.start)-u+3,length:e.length}));n.push({type:"content",title:e.title,header:null!=(r=null==d?void 0:d.text)?r:e.title,link:`${s}${(0,O.AP)(e.routePath)}${d?`#${d.id}`:""}`,query:t,highlightInfoList:f,group:eO(this,c).extractGroupName(e.routePath),statement:`...${m}...`});return}for(;-1!==u;){let i=p(u),r=a.slice(0,u).lastIndexOf("\n");r=-1===r?0:r;let l=a.indexOf("\n\n",u+t.length),h=a.slice(r,l);h.length>100&&(h=eD(this,w,k).call(this,h,t));let m=e0(h).indexOf(t),f=[{start:m,length:e5(t)}];n.push({type:"content",title:e.title,header:null!=(o=null==i?void 0:i.text)?o:e.title,statement:h,highlightInfoList:f,link:`${s}${(0,O.AP)(e.routePath)}${i?`#${i.id}`:""}`,query:t,group:eO(this,c).extractGroupName(e.routePath)}),u=d.indexOf(t,u+h.length-m)}},w=new WeakSet,k=function(e,t){let n=e0(e).indexOf(e0(t)),i=Math.floor((100-t.length)/2),r=e.slice(0,n);r.length>i&&(r=`...${e.slice(n-i+3,n)}`);let o=e.slice(n+t.length);return o.length>i&&(o=`${e.slice(n+t.length,n+i-3)}...`),r+t+o},j=new WeakSet,I=function(e){return e===eO(this,u)||e===eK};var to=e=>{let t=(0,N.useRef)(e);return t.current=e,(0,N.useRef)((...e)=>t.current(...e)).current},ta=e=>{let[t,n]=(0,N.useState)(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return(0,N.useEffect)(()=>{let t=window.matchMedia(e),i=e=>n(e.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[e]),t},tl=(e,t=null)=>{let[n,i]=(0,N.useState)(()=>{var n;return"undefined"==typeof window?t:null!=(n=localStorage.getItem(e))?n:t}),r=(0,N.useCallback)(t=>{i(n=>{let i="function"==typeof t?t(n):t;return null==i?localStorage.removeItem(e):localStorage.setItem(e,i),i})},[e]);return(0,N.useEffect)(()=>{let n=n=>{var r;n.key===e&&i(null!=(r=localStorage.getItem(e))?r:t)};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}},[e,t]),[n,r]},ts=e=>["light","dark","auto"].includes(e)?e:"auto",td=!1===B.Z.themeConfig.darkMode,tc=()=>{let e=ta("(prefers-color-scheme: dark)"),[t,n]=tl(M.rp),i=to(()=>{if(td)return"light";let n=ts(t);return"auto"===n?e?"dark":"light":n}),[r,o]=(0,N.useState)(()=>{var e;if("undefined"==typeof window)return"light";let t=null!=(e=window.RSPRESS_THEME)?e:window.MODERN_THEME;return t?"dark"===t?"dark":"light":i()}),a=(0,N.useCallback)((e,t=e)=>{!td&&(o(e),n(t),s(!0))},[]);(0,N.useEffect)(()=>{document.documentElement.classList.toggle("dark","dark"===r),document.documentElement.style.colorScheme=r},[r]);let[l,s]=(0,N.useState)(!0);return(0,N.useEffect)(()=>{s(!1)},[l]),(0,N.useEffect)(()=>{!l&&a(i(),ts(t))},[t]),(0,N.useEffect)(()=>{!l&&a(e?"dark":"light","auto")},[e]),[r,a]};function tu(e,t,n=!1){return!!t&&(n?(0,O.pV)(e,t):(0,O.pV)(e,t)||e.startsWith(t))}function th(){return window.innerWidth<=1024}function tp(e){return e?(0,H.Z)(e)?e:(0,F.Z)(e)?$(e):e:""}function tm(e){return tp(e.replace(/$1").replace(/`(.*?)`/g,"$1"))}function tf(e){var t;let{headers:n}=e,i=n.length>0,r=(null==(t=n[0])?void 0:t.depth)||2,o=eq();return(0,N.useEffect)(()=>{let e;setTimeout(()=>{e=eG()},100);let t=decodeURIComponent(window.location.hash);if(t){let e=document.getElementById(t.slice(1));e&&eV(e,!1,o?0:72)}else window.scrollTo(0,0);return()=>{e&&e()}},[n]),(0,E.jsx)("div",{className:"flex flex-col",children:(0,E.jsx)("div",{className:i?"(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:`#${e.id}`,className:"aside-link transition-all duration-300 hover:text-text-1 text-text-2 block",style:{paddingLeft:(e.depth-r)*12,fontWeight:"semibold"},onClick:t=>{t.preventDefault(),window.location.hash=e.id;let n=document.getElementById(e.id);n&&eV(n,!1,o?0:72)},children:(0,E.jsx)("span",{className:"aside-link-text block",children:tm(e.text)})})},e.id))})})]})})})}var tg="prev_e7091",tx="next_e7091";function tv(){let{prevPage:e,nextPage:t}=eZ(),{lastUpdated:n=!1}=e$(),{siteData:i}=(0,P.Vi)(),{themeConfig:r}=i,o=r.lastUpdated||n;return(0,E.jsxs)("footer",{className:"mt-8",children:[(0,E.jsx)("div",{className:"xs:flex pb-5 px-2 justify-end items-center",children:o&&(0,E.jsx)(C.O9,{})}),(0,E.jsx)("div",{className:"flex flex-col",children:(0,E.jsx)(C.mi,{})}),(0,E.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-around gap-4 pt-6",children:[(0,E.jsx)("div",{className:`${tg} flex flex-col`,children:e?(0,E.jsx)(C.Qe,{type:"prev",text:e.text,href:(0,O.AP)(e.link)}):null}),(0,E.jsx)("div",{className:`${tx} flex flex-col`,children:t?(0,E.jsx)(C.Qe,{type:"next",text:t.text,href:(0,O.AP)(t.link)}):null})]})]})}function tb(e){var{icon:t}=e,n=eA(e,["icon"]);return t?"string"==typeof t?(0,E.jsx)("img",eN({src:t,alt:""},n)):(0,E.jsx)(t,eN({},n)):null}function ty({outlineTitle:e,beforeSidebar:t,afterSidebar:n,uiSwitch:i}){let[r,o]=(0,N.useState)(!1),[a,l]=(0,N.useState)(!1),s=(0,N.useRef)(),d=(0,N.useRef)(),{pathname:c}=(0,T.TH)();(0,N.useEffect)(()=>{o(!1)},[c]),(0,N.useEffect)(()=>(document.addEventListener("mouseup",u),document.addEventListener("touchend",u),()=>{document.addEventListener("mouseup",u),document.removeEventListener("touchend",u)}),[]);let u=e=>{let{current:t}=d;if(null==t?void 0:t.contains(e.target))return;let{current:n}=s;n&&!n.contains(e.target)&&l(!1)};return(0,E.jsxs)(N.Fragment,{children:[(0,E.jsxs)("div",{className:"rspress-sidebar-menu",children:[i.showSidebar?(0,E.jsxs)("button",{onClick:function(){o(!0)},className:"flex-center mr-auto",children:[(0,E.jsx)("div",{className:"text-md mr-2",children:(0,E.jsx)(tb,{icon:Z.Z})}),(0,E.jsx)("span",{className:"text-sm",children:"Menu"})]}):null,i.showAside?(0,E.jsxs)(N.Fragment,{children:[(0,E.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex-center ml-auto",ref:d,children:[(0,E.jsx)("span",{className:"text-sm",children:e}),(0,E.jsx)("div",{className:"text-md mr-2",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease-out",marginTop:"2px"},children:(0,E.jsx)(tb,{icon:W.Z})})]}),(0,E.jsx)(U.Z,{in:a,timeout:300,unmountOnExit:!0,classNames:"fly-in",nodeRef:s,children:(0,E.jsx)("div",{className:"rspress-local-toc-container",ref:s,children:(0,E.jsx)(C.of,{onItemClick:()=>{l(!1)}})})})]}):null]}),i.showSidebar?(0,E.jsxs)(N.Fragment,{children:[(0,E.jsx)(C.YE,{isSidebarOpen:r,beforeSidebar:t,afterSidebar:n,uiSwitch:i}),r?(0,E.jsx)("div",{onClick:function(){o(!1)},className:"rspress-sidebar-back-drop",style:{background:"rgba(0, 0, 0, 0.6)"}}):null]}):null]})}var tw=(0,N.createContext)({}),tk={asideContainer:"aside-container_edeb4",docLayout:"docLayout_edeb4",content:"content_edeb4"};function tj(e){var t,n;let{beforeDocFooter:i,afterDocFooter:r,beforeDoc:o,afterDoc:a,beforeOutline:l,afterOutline:s,beforeSidebar:d,afterSidebar:c,uiSwitch:u}=e,{siteData:h,page:p}=(0,P.Vi)(),{toc:m=[],frontmatter:f}=p,[g,x]=(0,N.useState)({}),{themeConfig:v}=h,b=null!=(t=v.enableScrollToTop)&&t,y=e$(),w=(null==y?void 0:y.outlineTitle)||(null==v?void 0:v.outlineTitle)||"ON THIS PAGE",k=null!=(n=null==f?void 0:f.overview)&&n,j=(0,E.jsx)(tw.Provider,{value:{tabData:g,setTabData:x},children:(0,E.jsx)(_.Zo,{components:(0,C.TJ)(),children:(0,E.jsx)(z.V,{})})});return(0,E.jsxs)("div",{className:`${tk.docLayout} pt-0`,style:eN({},u.showNavbar?{}:{marginTop:0}),children:[o,(0,E.jsx)(ty,{outlineTitle:w,beforeSidebar:d,afterSidebar:c,uiSwitch:u}),(0,E.jsxs)("div",{className:`${tk.content} rspress-doc-container flex flex-shrink-0 mx-auto`,children:[(0,E.jsx)("div",{className:"w-full flex-1",children:k?(0,E.jsx)(C.g2,{content:j}):(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"rspress-doc",children:j}),(0,E.jsxs)("div",{className:"rspress-doc-footer",children:[i,u.showDocFooter&&(0,E.jsx)(tv,{}),r]})]})}),b&&(0,E.jsx)(A.r,{children:(0,E.jsx)(C.pU,{})}),u.showAside?(0,E.jsx)("div",{className:tk.asideContainer,style:eN({},u.showNavbar?{}:{marginTop:0,paddingTop:"32px"}),children:(0,E.jsxs)("div",{children:[l,(0,E.jsx)(tf,{headers:m,outlineTitle:w}),s]})}):null]}),a]})}var tI=e=>{var t;let{top:n,bottom:i,beforeDocFooter:r,afterDocFooter:o,beforeDoc:a,afterDoc:l,beforeSidebar:s,afterSidebar:d,beforeOutline:c,afterOutline:u,beforeNavTitle:h,afterNavTitle:p,beforeNav:m,beforeHero:f,afterHero:g,beforeFeatures:x,afterFeatures:v,afterNavMenu:b}=e,y={beforeDocFooter:r,afterDocFooter:o,beforeDoc:a,afterDoc:l,beforeSidebar:s,afterSidebar:d,beforeOutline:c,afterOutline:u},w={beforeHero:f,afterHero:g,beforeFeatures:x,afterFeatures:v},{siteData:k,page:j}=(0,P.Vi)(),{pageType:I,lang:_,title:A,frontmatter:O}=j,M=e$();tr();let L=null!=(t=null==O?void 0:O.title)?t:A,D=k.title||M.title;L=L&&"doc"===I?`${L} - ${D}`:D;let R=(null==O?void 0:O.description)||k.description||M.description,B=function(){var e,t;let{page:n,siteData:i}=(0,P.Vi)(),{frontmatter:r}=n,{themeConfig:o}=i,a=e$(),l=(0,T.TH)(),s=null!=(e=null==r?void 0:r.overview)&&e,d=()=>{var e,t;let n="undefined"==typeof window||window.top===window.self;return(null!=(t=null!=(e=null==r?void 0:r.outline)?e:null==o?void 0:o.outline)?t:n)&&!s},[c,u]=eU(),[h,p]=(0,N.useState)(d()),[m,f]=(0,N.useState)(null==(t=null==r?void 0:r.footer)||t),g=a.sidebar||{},x=(null==r?void 0:r.sidebar)!==!1&&Object.keys(g).length>0;return(0,N.useEffect)(()=>{p(d())},[n,i]),(0,N.useEffect)(()=>{let e=new URLSearchParams(l.search),t=document.documentElement.style,n=t.getPropertyValue("--rp-sidebar-width"),i=t.getPropertyValue("--rp-aside-width"),r=e.get("navbar"),o=e.get("sidebar"),a=e.get("outline"),s=e.get("footer");return"0"===r&&u(!1),"0"===o&&document.documentElement.style.setProperty("--rp-sidebar-width","0px"),"0"===a&&document.documentElement.style.setProperty("--rp-aside-width","0px"),"0"===s&&f(!1),()=>{document.documentElement.style.setProperty("--rp-sidebar-width",n),document.documentElement.style.setProperty("--rp-aside-width",i),u(c),f(m)}},[l.search]),{showAside:h,showNavbar:c,showSidebar:x,showDocFooter:m}}();return(0,E.jsxs)("div",{children:[(0,E.jsxs)(S.ql,{htmlAttributes:{lang:_||"en"},children:[L?(0,E.jsx)("title",{children:L}):null,R?(0,E.jsx)("meta",{name:"description",content:R}):null]}),n,"blank"!==I&&B.showNavbar&&(0,E.jsx)(C.JL,{beforeNavTitle:h,afterNavTitle:p,beforeNav:m,afterNavMenu:b}),(0,E.jsx)("section",{children:(()=>{switch(I){case"home":return(0,E.jsx)(C.ZP.HomeLayout,eN({},w));case"doc":return(0,E.jsx)(tj,e_(eN({},y),{uiSwitch:B}));case"404":return(0,E.jsx)(C.ZP.NotFoundLayout,{});case"custom":case"blank":return(0,E.jsx)(z.V,{});default:return(0,E.jsx)(tj,eN({},y))}})()}),i]})};function tP(e){let{beforeHero:t,afterHero:n,beforeFeatures:i,afterFeatures:r}=e,{page:{frontmatter:o}}=(0,P.Vi)();return(0,E.jsxs)("div",{className:"relative",style:{minHeight:"calc(100vh - var(--rp-nav-height))",paddingBottom:"80px"},children:[(0,E.jsxs)("div",{className:"pb-12",children:[t,(0,E.jsx)(C.xB,{frontmatter:o}),n,i,(0,E.jsx)(C.BZ,{frontmatter:o}),r]}),(0,E.jsx)(C.xK,{})]})}var tE={title:"title_3b154",blockquote:"blockquote_3b154",link:"link_3b154","inline-link":"inline-link_3b154"},tS=e=>(0,E.jsx)("h1",e_(eN({},e),{className:`text-3xl mb-10 leading-10 tracking-tight ${tE.title}`})),tC=e=>(0,E.jsx)("h2",e_(eN({},e),{className:`mt-12 mb-6 pt-8 text-2xl tracking-tight border-t-[1px] border-divider-light ${tE.title}`})),tz=e=>(0,E.jsx)("h3",e_(eN({},e),{className:`mt-10 mb-2 leading-7 text-xl ${tE.title}`})),tN=e=>(0,E.jsx)("h4",e_(eN({},e),{className:`mt-8 leading-6 text-base ${tE.title}`})),t_=e=>(0,E.jsx)("h5",e_(eN({},e),{className:tE.title})),tA=e=>(0,E.jsx)("h6",e_(eN({},e),{className:tE.title})),tT=e=>(0,E.jsx)("ol",e_(eN({},e),{className:"list-decimal pl-5 my-4 leading-7"})),tO=e=>(0,E.jsx)("ul",e_(eN({},e),{className:"list-disc pl-5 my-4 leading-7"})),tM=e=>(0,E.jsx)("li",e_(eN({},e),{className:"[&:not(:first-child)]:mt-2"})),tL=e=>(0,E.jsx)("table",e_(eN({},e),{className:"block border-collapse text-base my-5 overflow-x-auto leading-7 border-gray-light-2"})),tD=e=>(0,E.jsx)("tr",e_(eN({},e),{className:"border border-solid transition-colors duration-500 even:bg-soft border-gray-light-2"})),tR=e=>(0,E.jsx)("td",e_(eN({},e),{className:"border border-solid px-4 py-2 border-gray-light-2"})),tB=e=>(0,E.jsx)("th",e_(eN({},e),{className:"border border-solid px-4 py-2 text-text-1 text-base font-semibold border-gray-light-2"})),t$=e=>(0,E.jsx)("hr",e_(eN({},e),{className:"my-12 border-t border-solid border-divider-light"})),tF=e=>{let{href:t="",className:n=""}=e,{normalizeLinkHref:i}=eQ();return n.includes("header-anchor")||t.startsWith("#")?(0,E.jsx)("a",e_(eN({},e),{className:`${tE.link} ${n}`})):(0,E.jsx)(C.rU,e_(eN({},e),{className:`${n} ${tE.link} ${tE["inline-link"]}`,href:i(t)}))},tH=e=>(0,E.jsx)("p",e_(eN({},e),{className:"my-4 leading-7"})),tZ=e=>(0,E.jsx)("blockquote",e_(eN({},e),{className:`border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${tE.blockquote}`})),tW=e=>(0,E.jsx)("strong",e_(eN({},e),{className:"font-semibold"})),tU={"code-button-group":"code-button-group_15153",codeButtonGroup:"code-button-group_15153","code-copy-button":"code-copy-button_15153",codeCopyButton:"code-copy-button_15153","icon-success":"icon-success_15153",iconSuccess:"icon-success_15153","code-copied":"code-copied_15153",codeCopied:"code-copied_15153","icon-copy":"icon-copy_15153",iconCopy:"icon-copy_15153","icon-wrapped":"icon-wrapped_15153",iconWrapped:"icon-wrapped_15153","wrapped-btn":"wrapped-btn_15153",wrappedBtn:"wrapped-btn_15153","icon-wrap":"icon-wrap_15153",iconWrap:"icon-wrap_15153"},tq={doctype:{color:"var(--code-token-text)",fontStyle:"italic"},token:{color:"var(--code-token-text)"},comment:{color:"var(--code-token-comment)"},punctuation:{color:"var(--code-token-punctuation)"},property:{color:"var(--code-token-parameter)"},constant:{color:"var(--code-token-constant)"},string:{color:"var(--code-token-string)"},symbol:{color:"var(--code-token-symbol)"},variable:{color:"var(--code-token-variable)"},"attr-name":{color:"var(--code-token-symbol)"},"attr-value":{color:"var(--code-token-string-expression)"},builtin:{color:"var(--code-token-symbol)"},function:{color:"var(--code-token-function)"},keyword:{color:"var(--code-token-keyword)"},tag:{color:"var(--code-token-function)"},inserted:{color:"#22863a"},deleted:{color:"#b31d28"},regex:{color:"var(--code-token-keyword)"},key:{color:"var(--code-token-variable)"},title:{color:"var(--code-token-keyword)"},important:{color:"#EBCB8B",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},table:{display:"content"}},tV=!1;function tG(e){var t;let{siteData:n}=(0,P.Vi)(),{meta:i,language:r,codeWrap:o}=e,{showLineNumbers:a}=n.markdown,l="",s=[];return i&&(l=(null==(t=/{[\d,-]*}/i.exec(i))?void 0:t[0])||"")&&(s=l.replace(/[{}]/g,"").split(",").map(e=>{let[t,n]=e.split("-");return n?Array.from({length:Number(n)-Number(t)+1},(e,n)=>n+Number(t)):Number(t)}).flat()),!tV&&(Object.keys(G.Z).forEach(e=>{Y.Z.registerLanguage(e,G.Z[e])}),tV=!0),(0,E.jsx)(Y.Z,{language:r,style:tq,wrapLines:!0,className:"code",wrapLongLines:o,customStyle:{backgroundColor:"inherit"},showLineNumbers:a||s.length>0,lineProps:e=>({style:e_(eN({},s.includes(e)?{backgroundColor:"var(--rp-code-line-highlight-color)"}:{}),{display:"block",padding:"0 1.25rem"})}),children:String(e.children).trim()})}var tY=new Map;function tQ({codeBlockRef:e}){let t=(0,N.useRef)(null);return(0,E.jsxs)("button",{className:tU.codeCopyButton,onClick:()=>(function(e,t){let n="",i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),r=i.nextNode();for(;r;)!r.parentElement.classList.contains("linenumber")&&(n+=r.nodeValue),r=i.nextNode();if(Q(n)&&t){t.classList.add(tU.codeCopied),clearTimeout(tY.get(t));let e=setTimeout(()=>{t.classList.remove(tU.codeCopied),t.blur(),tY.delete(t)},2e3);tY.set(t,e)}})(e.current,t.current),ref:t,children:[(0,E.jsx)(tb,{icon:K.Z,className:tU.iconCopy}),(0,E.jsx)(tb,{icon:J.Z,className:tU.iconSuccess})]})}function tK(e){var t;let{siteData:n}=(0,P.Vi)(),i=null!=(t=e.codeHighlighter)?t:n.markdown.codeHighlighter,{defaultWrapCode:r}=n.markdown,[o,a]=(0,N.useState)(r),l=(0,N.useRef)(null),s=(0,N.useRef)(),{className:d}=e,c=null==d?void 0:d.replace(/language-/,"");if(!c)return(0,E.jsx)("code",eN({},e));let u=e=>{o?null==e||e.classList.remove(tU.wrappedBtn):null==e||e.classList.add(tU.wrappedBtn),a(!o)};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{ref:s,children:(()=>{if("prism"===i)return(0,E.jsx)(tG,e_(eN({},e),{language:c,codeWrap:o}));return(0,E.jsx)("code",eN({},e))})()}),(0,E.jsxs)("div",{className:tU.codeButtonGroup,children:[(0,E.jsxs)("button",{ref:l,className:tU.codeWrapButton,onClick:()=>u(l.current),children:[(0,E.jsx)(tb,{icon:V.Z,className:tU.iconWrapped}),(0,E.jsx)(tb,{icon:q.Z,className:tU.iconWrap})]}),(0,E.jsx)(tQ,{codeBlockRef:s})]})]})}function tJ({children:e}){let t=e=>{let{className:t,meta:n}=e.props,i=function(e){var t,n;if(!e)return"";let i=e,r=/{[\d,-]*}/i;return(null==(t=r.exec(e))?void 0:t[0])&&(i=e.replace(r,"").trim()),null==(i=null!=(n=i.split("=")[1])?n:"")?void 0:i.replace(/["'`]/g,"")}(n);return(0,E.jsxs)("div",{className:t||"language-bash",children:[i&&(0,E.jsx)("div",{className:"rspress-code-title",children:i}),(0,E.jsx)("div",{className:"rspress-code-content rspress-scrollbar",children:e})]})};return Array.isArray(e)?(0,E.jsx)("div",{children:e.map(e=>t(e))}):t(e)}var tX=e=>(0,E.jsx)("img",e_(eN({},e),{src:(0,O.i6)(e.src||"")}));function t0(){return{h1:tS,h2:tC,h3:tz,h4:tN,h5:t_,h6:tA,ul:tO,ol:tT,li:tM,table:tL,td:tR,th:tB,tr:tD,hr:t$,p:tH,blockquote:tZ,strong:tW,a:tF,code:tK,pre:tJ,img:tX}}var t1={badge:"badge_99dcf",info:"info_99dcf",warning:"warning_99dcf",danger:"danger_99dcf"};function t2(e){let{text:t,type:n="info"}=e;return(0,E.jsx)("span",{className:`inline-block rounded-full border border-solid border-transparent font-medium ${t1.badge} ${t1[n]}`,children:t})}var t3={button:"button_72e53",medium:"medium_72e53",big:"big_72e53",brand:"brand_72e53",alt:"alt_72e53"};function t4(e){let{theme:t="brand",size:n="big",href:i="/",external:r=!1,className:o=""}=e,a=null;return"button"===e.type?a="button":"a"===e.type&&(a=r?"a":C.rU),N.createElement(null!=a?a:"a",{className:`${t3.button} ${t3[t]} ${t3[n]} ${o}`,href:i},e.text)}var t5={editLink:"editLink_2a169"};function t6(){let e=eW();if(!e)return null;let{text:t,link:n}=e;return(0,E.jsx)("a",{href:n,target:"_blank",className:t5.editLink,children:t})}var t7={"grid-2":"grid-2_d48e3",grid2:"grid-2_d48e3","grid-4":"grid-4_d48e3",grid4:"grid-4_d48e3","grid-6":"grid-6_d48e3",grid6:"grid-6_d48e3","grid-3":"grid-3_d48e3",grid3:"grid-3_d48e3",featureCard:"featureCard_d48e3"},t8=e=>{let{span:t}=e;return`grid-${t||4}`};function t9({frontmatter:e}){let t=null==e?void 0:e.features;return(0,E.jsx)("div",{className:"overflow-hidden m-auto flex flex-wrap max-w-6xl",children:null==t?void 0:t.map(e=>{let{icon:t,title:n,details:i,link:r}=e;return(0,E.jsx)("div",{className:`${t7[t8(e)]} rounded hover:var(--rp-c-brand)`,children:(0,E.jsx)("div",{className:"h-full p-2",children:(0,E.jsxs)("article",{className:`rspress-home-feature-card ${t7.featureCard} h-full p-8 rounded-4xl border-transparent`,style:{cursor:r?"pointer":"auto"},onClick:()=>{r&&(window.location.href=r)},children:[t?(0,E.jsx)("div",{className:"flex-center",children:(0,E.jsx)("div",{className:"rspress-home-feature-icon w-12 h-12 text-3xl text-center",children:t})}):null,(0,E.jsx)("h2",{className:"rspress-home-feature-title font-bold text-center",children:n}),(0,E.jsx)("p",{className:"rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",children:tp(i)})]},n)})},n)})})}function ne(){let{siteData:e}=(0,P.Vi)(),{message:t}=e.themeConfig.footer||{};return(0,E.jsx)("footer",{className:"absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",children:(0,E.jsx)("div",{className:"m-auto w-full text-center",children:t&&(0,E.jsx)("div",{className:"font-meduim text-sm text-text-2",children:t})})})}var nt="clip_c867a",nn="mask_c867a",ni={name:"modern",text:"modern ssg",tagline:"modern ssg",actions:[],image:void 0};function nr({frontmatter:e}){var t,n,i,r,o;let a=(null==e?void 0:e.hero)||ni,l=void 0!==a.image,s=l?"sm:max-w-xl":"sm:max-w-4xl",d=a.text?a.text.toString().split(/\n/g).filter(e=>""!==e):[];return(0,E.jsxs)("div",{className:"m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16 relative",children:[(0,E.jsx)("div",{className:nn,style:{left:l?"75%":"50%"}}),(0,E.jsxs)("div",{className:"m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh] mt-12 sm:mt-0",children:[(0,E.jsxs)("div",{className:"flex flex-col justify-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1",children:[(0,E.jsx)("h1",{className:"font-bold text-3xl pb-2 sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-2 leading-tight z-10",children:(0,E.jsx)("span",{className:nt,style:{lineHeight:"1.3"},children:tp(a.name)})}),0!==d.length&&d.map(e=>(0,E.jsx)("p",{className:`rspress-home-hero-text mx-auto md:m-0 text-3xl sm:text-5xl md:text-6xl sm:pb-2 font-bold z-10 ${s}`,style:{lineHeight:"1.2"},children:tp(e)},e)),(0,E.jsx)("p",{className:`rspress-home-hero-tagline whitespace-pre-wrap pt-4 m-auto md:m-0 text-sm sm:tex-xl md:text-2xl text-text-2 font-medium z-10 ${s}`,children:tp(a.tagline)}),(null==(t=a.actions)?void 0:t.length)&&(0,E.jsx)("div",{className:"grid md:flex md:flex-wrap md:justify-center gap-3 m--1.5 pt-6 sm:pt-8 z-10",children:a.actions.map(e=>(0,E.jsx)("div",{className:"flex flex-shrink-0 p-1",children:(0,E.jsx)(C.zx,{type:"a",text:tp(e.text),href:(0,O.AP)(e.link),theme:e.theme,className:"w-full"})},e.link))})]}),l?(0,E.jsx)("div",{className:"rspress-home-hero-image md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",children:(0,E.jsx)("img",{src:(0,O.i6)(null==(n=a.image)?void 0:n.src),alt:null==(i=a.image)?void 0:i.alt,srcSet:no(null==(r=a.image)?void 0:r.srcset),sizes:no(null==(o=a.image)?void 0:o.sizes),width:375,height:375})}):null]})]})}function no(e){return(Array.isArray(e)?e:[e]).filter(Boolean).join(", ")||void 0}function na(){let{lastUpdatedText:e="Last Updated"}=e$(),{page:{lastUpdatedTime:t},siteData:n}=(0,P.Vi)(),{themeConfig:i}=n,r=(null==i?void 0:i.lastUpdatedText)||e;return(0,E.jsx)("div",{className:"flex text-sm text-text-2 leading-6 sm:leading-8 font-medium",children:(0,E.jsxs)("p",{children:[r,": ",(0,E.jsx)("span",{children:t})]})})}var nl={link:"link_03735"};function ns(e){let{href:t="/",children:n,className:i="",onNavigate:r,keepCurrentParams:o=!1}=e,a=eA(e,["href","children","className","onNavigate","keepCurrentParams"]),l=(0,M.xf)(t),s=l?"_blank":"",d=l?"noopener noreferrer":void 0,c=l?t:(0,O.pJ)((0,O.AP)(t)),u=(0,T.s0)(),{pathname:h,search:p}=(0,T.TH)(),m=o?c+p:c,f=(0,O.pV)(h,c);return l?(0,E.jsx)("a",e_(eN({},a),{href:c,target:s,rel:d,className:`${nl.link} ${i}`,children:n})):(0,E.jsx)("a",e_(eN({},a),{className:`${nl.link} ${i} cursor-pointer`,rel:d,target:s,onClick:e=>eR(this,null,function*(){if(0!==e.button||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return;e.preventDefault();let t=c.split("#")[1];if(!l&&f&&t){let e=document.getElementById(t);e&&eV(e,!0);return}if(!f){let e=(0,X.fp)(et.routes,(0,O.Tm)(c));if(null==e?void 0:e.length){let t=setTimeout(()=>{ee.start()},200);yield e[0].route.preload(),clearTimeout(t),ee.done()}null==r||r(),u(m,{replace:!1})}}),href:c,children:n}))}ee.configure({showSpinner:!1});var nd={hidden:"hidden_f6cde",container:"container_f6cde",navContainer:"navContainer_f6cde",leftNav:"leftNav_f6cde",rightNav:"rightNav_f6cde",singleItem:"singleItem_f6cde",activeItem:"activeItem_f6cde",navBarTitle:"navBarTitle_f6cde","social-links-icon":"social-links-icon_f6cde",socialLinksIcon:"social-links-icon_f6cde","menu-item":"menu-item_f6cde",menuItem:"menu-item_f6cde",mobileNavMenu:"mobileNavMenu_f6cde",mask:"mask_f6cde",docPage:"docPage_f6cde"};function nc(e){let{pathname:t,base:n}=e,i=new RegExp(e.activeMatch||e.link).test((0,M.tz)(t,n));return(0,E.jsx)(C.rU,{href:(0,O.AP)(e.link),children:(0,E.jsxs)("div",{className:`rspress-nav-menu-item ${nd.singleItem} ${i?nd.activeItem:""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,children:[(0,E.jsx)(C.Vp,{tag:e.tag}),e.text,e.rightIcon]},e.text)})}function nu({onClick:e}){let{theme:t,setTheme:n}=(0,N.useContext)(P.Ni);return(0,E.jsx)("div",{onClick:()=>{n("dark"===t?"light":"dark"),null==e||e()},className:"md:mr-2 rspress-nav-appearance",children:(0,E.jsxs)("div",{className:"p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300 w-7 h-7",children:[(0,E.jsx)(tb,{className:"dark:hidden",icon:er.Z,width:"18",height:"18",fill:"currentColor"}),(0,E.jsx)(tb,{className:"hidden dark:block",icon:eo.Z,width:"18",height:"18",fill:"currentColor"})]})})}var nh={socialLinksIcon:"social-links-icon_93d67",menuItem:"menu-item_93d67"},np={discord:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Discord"}),(0,E.jsx)("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]}),facebook:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Facebook"}),(0,E.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})]}),github:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"GitHub"}),(0,E.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),gitlab:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"GitLab"}),(0,E.jsx)("path",{fill:"currentColor",d:"m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"})]}),instagram:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Instagram"}),(0,E.jsx)("path",{d:"M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"})]}),linkedin:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"LinkedIn"}),(0,E.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})]}),slack:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Slack"}),(0,E.jsx)("path",{d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})]}),twitter:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Twitter"}),(0,E.jsx)("path",{d:"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"})]}),youtube:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"YouTube"}),(0,E.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})]}),juejin:(0,E.jsxs)("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg","data-spm-anchor-id":"a313x.7781069.0.i5",children:[(0,E.jsx)("path",{d:"M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z","data-spm-anchor-id":"a313x.7781069.0.i2"}),(0,E.jsx)("path",{d:"M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z","data-spm-anchor-id":"a313x.7781069.0.i3"})]}),qq:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"})}),wechat:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"})}),weibo:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"})}),zhihu:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"})}),bilibili:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"})}),lark:(0,E.jsxs)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Lark"}),(0,E.jsx)("path",{d:"M8.813 5.477c1.038.836 2.286 2.045 3.3 3.495.171.23.377.576.457.71l.034.056a8.803 8.803 0 0 0-.922 1.3l-.271-.494C9.655 7.53 6.3 5.477 6.137 5.377a.447.447 0 0 1-.006-.004l-.666-.393-.107-.086a.499.499 0 0 1 .306-.885L6.084 4h7.997c.159.006.318.037.47.092.174.064.317.174.458.308.134.143.272.296.403.448.622.675 1.324 1.688 1.324 1.688-.573.193-1.349.736-1.349.736a5.095 5.095 0 0 0-.348-.54 20.665 20.665 0 0 0-1.037-1.255H8.813Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M18.482 7.507a5.42 5.42 0 0 1 4.04.717c.248.168.788.635.242 1.233-1.7 1.67-2.194 3.225-2.63 4.599-.278.873-.541 1.697-1.066 2.424-1.813 2.508-4.114 4-6.837 4.434-.561.089-1.132.131-1.7.131-3.958 0-7.498-2.035-8.75-2.844h.003l-.161-.107c-.534-.378-.61-.723-.623-.989V7.055a.486.486 0 0 1 .827-.317l.482.589c5.082 6.201 9.126 8.063 11.626 8.53 2.246.424 3.631-.165 4.022-.37.333-.51.534-1.143.764-1.865l.006-.021c.406-1.276.898-2.821 2.322-4.477a3.93 3.93 0 0 0-2.28-.168c-1.761.394-3.403 1.96-4.89 4.643a8.27 8.27 0 0 0-.341.671c-.724-.107-1.334-.65-1.334-.65.128-.269.22-.455.345-.672 1.718-3.125 3.714-4.962 5.933-5.441ZM2.477 16.889c1.145.744 5.341 3.232 9.532 2.563 1.56-.247 2.963-.915 4.196-1.99-2.771.254-7.557-.753-13.728-7.666v7.093Z",fill:"currentColor"})]}),X:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"X"}),(0,E.jsx)("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})]})},nm=e=>{let{link:t,popperStyle:n={}}=e,{icon:i,mode:r="link",content:o}=t,a="object"==typeof i?(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:i.svg}}):np[i],[l,s]=(0,N.useState)(!1),d=()=>{s(!0)},c=()=>{s(!1)};return"link"===r?(0,E.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"social-links",children:(0,E.jsx)("div",{className:`${nh.socialLinksIcon}`,children:a})},o):"text"===r?(0,E.jsxs)("div",{className:`${nh.socialLinksIcon} cursor-pointer relative mx-3`,onMouseEnter:d,onMouseLeave:c,children:[a,l?(0,E.jsx)("div",{style:eN({boxShadow:"var(--rp-shadow-3)",border:"1px solid var(--rp-c-divider-light)"},n),className:"z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",children:(0,E.jsx)("div",{className:"text-md",children:o})}):null]}):"img"===r?(0,E.jsxs)("div",{className:`${nh.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[a,l?(0,E.jsx)("div",{className:"break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",style:eN({boxShadow:"var(--rp-shadow-3)"},n),children:(0,E.jsx)("img",{src:o,alt:"img"})}):null]}):(0,E.jsx)("div",{})},nf=e=>{let{links:t,moreIconVisible:n=!1,mouseEnter:i}=e;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"flex-center h-full gap-x-4 transition-colors duration-300 md:mr-2",children:t.map((e,t)=>(0,E.jsx)(nm,{link:e,popperStyle:{top:"2.5rem"}},t))}),n?(0,E.jsx)("div",{className:"md:ml-1 p-2",onMouseEnter:i,children:(0,E.jsx)(tb,{icon:ea.Z})}):null]})},ng=e=>{let{links:t}=e;return(0,E.jsx)("div",{style:{boxShadow:"var(--rp-shadow-3)",marginRight:"-2px",border:"1px solid var(--rp-c-divider-light)",background:"var(--rp-c-bg)"},className:"absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",children:t.map(e=>(0,E.jsx)(nm,{link:e,popperStyle:{top:"1.25rem"}},e.content))})},nx=({socialLinks:e})=>{let t=e.length>3,n=[],i=[];e.forEach((e,t)=>{t<3?n.push(e):i.push(e)});let[r,o]=(0,N.useState)(!1);return(0,E.jsxs)("div",{className:`social-links ${nh.menuItem} flex-center relative`,onMouseLeave:()=>o(!1),children:[(0,E.jsx)(nf,{links:n,moreIconVisible:t,mouseEnter:()=>o(!0)}),r?(0,E.jsx)(ng,{links:i}):null]})};function nv(){var e,t;let{siteData:n,page:i}=(0,P.Vi)(),r=(0,P.aw)(),{pathname:o,search:a}=(0,T.TH)(),l=n.lang||"",s=n.multiVersion.default||"",d=Object.values(n.locales||n.themeConfig.locales||{}),c=(null==(e=n.route)?void 0:e.cleanUrls)||!1,u=d.length>1,{lang:h}=i,{base:p}=n;return u?{text:(0,E.jsx)(tb,{icon:el.Z,style:{width:"18px",height:"18px"}}),items:d.map(e=>({text:null==e?void 0:e.label,link:(0,M.$U)(o+a,{current:h,target:e.lang,default:l},{current:r,default:s},p,c)})),activeValue:null==(t=d.find(e=>h===e.lang))?void 0:t.label}:null}function nb(){var e;let{siteData:t}=(0,P.Vi)(),n=(0,P.aw)(),{pathname:i}=(0,T.TH)(),r=(null==(e=t.route)?void 0:e.cleanUrls)||!1,o=t.multiVersion.default||"",a=t.multiVersion.versions||[],{base:l}=t;return{items:a.map(e=>({text:e,link:(0,M.xM)(i,{current:n,target:e,default:o},l,r)})),text:n,activeValue:n}}var ny={navScreen:"navScreen_457e8",active:"active_457e8",container:"container_457e8",navMenu:"navMenu_457e8",navMenuItem:"navMenuItem_457e8",navAppearance:"navAppearance_457e8",socialAndAppearance:"socialAndAppearance_457e8",navScreenMenuGroup:"navScreenMenuGroup_457e8",open:"open_457e8",button:"button_457e8",buttonSpan:"buttonSpan_457e8",items:"items_457e8",down:"down_457e8"};function nw(e){let{activeValue:t}=e,[n,i]=(0,N.useState)(!1);function r({item:e}){return(0,E.jsx)("div",{className:"p-1 text-center",children:(0,E.jsx)("span",{className:"text-brand",children:e.text})})}function o({item:e}){return(0,E.jsx)("div",{className:"py-1 font-medium",children:(0,E.jsx)(C.rU,{href:e.link,children:(0,E.jsx)("div",{children:(0,E.jsx)("div",{className:"flex justify-center",children:(0,E.jsx)("span",{children:e.text})})})})})}let a=e=>t===e.text?(0,E.jsx)(r,{item:e},e.link):(0,E.jsx)(o,{item:e},e.link),l=e=>(0,E.jsxs)("div",{children:["link"in e?a(e):(0,E.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(a)]});return(0,E.jsxs)("div",{className:`${n?ny.open:""} ${ny.navScreenMenuGroup} relative`,children:[(0,E.jsxs)("button",{className:ny.button,onClick:()=>{i(!n)},children:[(0,E.jsx)("span",{className:ny.buttonSpan,children:e.text}),(0,E.jsx)(es.Z,{className:`${n?ny.open:""} ${ny.down} `})]}),(0,E.jsx)("div",{children:(0,E.jsx)("div",{className:ny.items,children:e.items.map(e=>(0,E.jsx)("div",{children:"items"in e?l(e):a(e)},e.text))})})]})}function nk(){let{nav:e}=e$(),t=(0,P.aw)();return Array.isArray(e)?e:[...e[t.length>0?t:"default"]]}var nj=()=>{let e=nv();return(0,E.jsx)("div",{className:`${ny.navTranslations} flex text-sm font-bold justify-center`,children:(0,E.jsx)("div",{className:"mx-1.5 my-1",children:(0,E.jsx)(nw,eN({},e))})})},nI=()=>{let e=nb();return(0,E.jsx)("div",{className:`${ny.navTranslations} flex text-sm font-bold justify-center`,children:(0,E.jsx)("div",{className:"mx-1.5 my-1",children:(0,E.jsx)(nw,eN({},e))})})};function nP(e){var t;let{isScreenOpen:n,siteData:i,pathname:r}=e,o=(0,N.useRef)(null),a=i.themeConfig.locales||[],l=a.length>1,s=i.multiVersion.versions.length>1,d=nk(),c=!1!==i.themeConfig.darkMode,u=(null==(t=null==i?void 0:i.themeConfig)?void 0:t.socialLinks)||[],h=u.length>0,p=a.map(e=>e.lang||"zh")||[],{base:m}=i;return(0,N.useEffect)(()=>(o.current&&n&&(0,ei.Qp)(o.current,{reserveScrollBarGap:!0}),()=>{(0,ei.tP)()}),[n]),(0,E.jsx)("div",{className:`${ny.navScreen} ${n?ny.active:""}`,ref:o,id:"navScreen",children:(0,E.jsxs)("div",{className:ny.container,children:[(0,E.jsx)(({menuItems:e})=>(0,E.jsx)("div",{className:ny.navMenu,children:e.map(e=>(0,E.jsx)("div",{className:`${ny.navMenuItem} w-full`,children:"link"in e?(0,E.jsx)(nc,eN({pathname:r,base:m,langs:p},e),e.text):(0,E.jsx)("div",{className:"mx-3 last:mr-0",children:(0,E.jsx)(nw,e_(eN({},e),{items:"items"in e?e.items:e}))},e.text)},e.text))}),{menuItems:d}),(0,E.jsxs)("div",{className:"flex-center flex-col gap-2",children:[c&&(0,E.jsx)(()=>(0,E.jsx)("div",{className:`mt-2 ${ny.navAppearance} flex justify-center`,children:(0,E.jsx)(A.r,{children:(0,E.jsx)(nu,{})})}),{}),l&&(0,E.jsx)(nj,{}),s&&(0,E.jsx)(nI,{}),h&&(0,E.jsx)(nx,{socialLinks:u})]})]})})}var nE={navHamburger:"navHamburger_e7b06",active:"active_e7b06"};function nS(e){let{siteData:t,pathname:n}=e,{isScreenOpen:i,toggleScreen:r}=function(){let{pathname:e}=(0,T.TH)(),[t,n]=(0,N.useState)(!1);function i(){n(!0),window.addEventListener("resize",o)}function r(){n(!1),window.removeEventListener("resize",o)}function o(){window.outerWidth>=768&&r()}return(0,N.useEffect)(()=>{r()},[e]),{isScreenOpen:t,openScreen:i,closeScreen:r,toggleScreen:function(){t?r():i()}}}();return(0,E.jsxs)(N.Fragment,{children:[(0,E.jsx)(nP,{isScreenOpen:i,siteData:t,pathname:n}),(0,E.jsx)("button",{onClick:r,"aria-label":"mobile hamburger",className:`${i?nE.active:""} ${nE.navHamburger} text-gray-500`,children:(0,E.jsx)(tb,{icon:en.Z,fill:"currentColor"})})]})}function nC({item:e}){return(0,E.jsxs)("div",{className:"rounded-2xl my-1 flex",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:[e.tag&&(0,E.jsx)(C.Vp,{tag:e.tag}),(0,E.jsx)("span",{className:"text-brand",children:e.text})]},e.link)}function nz({item:e}){return(0,E.jsx)("div",{className:"font-medium my-1",children:(0,E.jsx)(C.rU,{href:e.link,children:(0,E.jsx)("div",{className:"rounded-2xl hover:bg-mute",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:(0,E.jsxs)("div",{className:"flex",children:[e.tag&&(0,E.jsx)(C.Vp,{tag:e.tag}),(0,E.jsx)("span",{children:e.text})]})})})},e.link)}function nN(e){let{activeValue:t,items:n,base:i="",link:r="",pathname:o=""}=e,[a,l]=(0,N.useState)(!1),s=e=>{let n=new RegExp(e.activeMatch||e.link).test((0,M.tz)(o,i));return t===e.text||!t&&n?(0,E.jsx)(nC,{item:e},e.link):(0,E.jsx)(nz,{item:e},e.link)},d=e=>(0,E.jsxs)("div",{children:["link"in e?s(e):(0,E.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(s)]});return(0,E.jsxs)("div",{className:"relative flex-center h-14",onMouseLeave:()=>l(!1),children:[(0,E.jsx)("button",{onMouseEnter:()=>l(!0),className:"rspress-nav-menu-group-button flex-center items-center font-medium text-sm text-text-1 hover:text-text-2 transition-colors duration-200",children:r?(0,E.jsx)(nc,e_(eN({},e),{rightIcon:(0,E.jsx)(tb,{icon:es.Z})})):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("span",{className:"text-sm font-medium flex",style:{marginRight:"2px"},children:[(0,E.jsx)(C.Vp,{tag:e.tag}),e.text]}),(0,E.jsx)(tb,{icon:es.Z})]})}),(0,E.jsx)("div",{className:"rspress-nav-menu-group-content absolute mx-0.8 transition-opacity duration-300",style:{opacity:a?1:0,visibility:a?"visible":"hidden",right:0,top:"52px"},children:(0,E.jsx)("div",{className:"p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",style:{boxShadow:"var(--rp-shadow-3)",zIndex:100,border:"1px solid var(--rp-c-divider-light)",borderRadius:"var(--rp-radius-large)",background:"var(--rp-c-bg)"},children:n.map(e=>(0,E.jsx)("div",{children:"items"in e?d(e):s(e)},e.text))})})]})}var n_=()=>{var e;let{siteData:t}=(0,P.Vi)(),n=e$(),{logo:i,logoText:r}=t,o=null!=(e=n.title)?e:t.title,a=(0,N.useMemo)(()=>i?"string"==typeof i?(0,E.jsx)("img",{src:(0,O.i6)(i),alt:"logo",id:"logo",className:"mr-4 rspress-logo"}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("img",{src:(0,O.i6)(i.light),alt:"logo",id:"logo",className:"mr-4 rspress-logo dark:hidden"}),(0,E.jsx)("img",{src:(0,O.i6)(i.dark),alt:"logo",id:"logo",className:"mr-4 rspress-logo hidden dark:block"})]}):null,[i]);return(0,E.jsx)("div",{className:`${nd.navBarTitle}`,children:(0,E.jsxs)("a",{href:(0,O.pJ)(n.langRoutePrefix||"/"),className:"flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",children:[a,r&&(0,E.jsx)("span",{children:r}),!a&&!r&&(0,E.jsx)("span",{children:o})]})})};function nA(){let e=nv();return(0,E.jsx)("div",{className:`translation ${nd.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,E.jsx)("div",{children:(0,E.jsx)(nN,eN({},e))})})}function nT(){let e=nb();return(0,E.jsx)("div",{className:`translation ${nd.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,E.jsx)("div",{children:(0,E.jsx)(nN,eN({},e))})})}function nO(e){var t;let{beforeNavTitle:n,afterNavTitle:i,beforeNav:r,afterNavMenu:o}=e,{siteData:a}=(0,P.Vi)(),{base:l}=a,{pathname:s}=(0,T.TH)(),[d,c]=(0,N.useState)(!1),u=eq(),h=Object.values(a.locales||a.themeConfig.locales||{}),p=h.length>1,m=a.multiVersion.versions.length>1,f=a.themeConfig.socialLinks||[],g=f.length>0,x=h.map(e=>e.lang||"")||[],v=()=>{c(th())};(0,N.useEffect)(()=>(window.addEventListener("resize",v),c(th()),()=>{window.removeEventListener("resize",v)}),[]);let b=({menuItems:e})=>(0,E.jsx)("div",{className:"rspress-nav-menu menu h-14",children:e.map(e=>"items"in e||Array.isArray(e)?(0,E.jsx)("div",{className:"mx-3 last:mr-0",children:(0,E.jsx)(nN,e_(eN({},e),{base:l,pathname:s,langs:x,items:"items"in e?e.items:e}))},e.text):(0,E.jsx)(nc,eN({pathname:s,langs:x,base:l},e),e.link))}),y=nk(),w=e=>{var t;return null!=(t=e.position)?t:"right"},k=y.filter(e=>"left"===w(e)),j=y.filter(e=>"right"===w(e)),I=(null==(t=null==a?void 0:a.themeConfig)?void 0:t.search)!==!1,S=!1!==a.themeConfig.darkMode;return(0,E.jsxs)(E.Fragment,{children:[r,(0,E.jsx)("div",{className:`${nd.navContainer} rspress-nav px-6 ${u&&!d?nd.hidden:""}`,style:{position:d?"relative":"sticky"},children:(0,E.jsxs)("div",{className:`${nd.container} flex justify-between items-center h-full`,children:[n,(0,E.jsx)(n_,{}),i,(0,E.jsxs)("div",{className:`${nd.content} flex flex-1 justify-end items-center`,children:[k.length>0?(0,E.jsx)("div",{className:nd.leftNav,children:(0,E.jsx)(b,{menuItems:k})}):null,(0,E.jsxs)("div",{className:nd.rightNav,children:[I&&(0,E.jsx)("div",{className:"flex sm:flex-1 items-center sm:pl-4 sm:pr-2",children:(0,E.jsx)(C.ol,{})}),(0,E.jsx)(b,{menuItems:j}),(0,E.jsxs)("div",{className:"flex-center flex-row",children:[p&&(0,E.jsx)(nA,{}),m&&(0,E.jsx)(nT,{}),S&&(0,E.jsx)("div",{className:"mx-2",children:(0,E.jsx)(nu,{})}),g&&(0,E.jsx)(nx,{socialLinks:f})]})]}),o,(0,E.jsxs)("div",{className:nd.mobileNavMenu,children:[d&&I&&(0,E.jsx)(C.ol,{}),(0,E.jsx)(nS,{siteData:a,pathname:s})]})]})]})})]})}var nM={"header-anchor":"header-anchor_8f375",headerAnchor:"header-anchor_8f375","overview-groups":"overview-groups_8f375",overviewGroups:"overview-groups_8f375","overview-group-li":"overview-group-li_8f375",overviewGroupLi:"overview-group-li_8f375","level-2":"level-2_8f375",level2:"level-2_8f375","level-3":"level-3_8f375",level3:"level-3_8f375","level-4":"level-4_8f375",level4:"level-4_8f375","overview-group":"overview-group_8f375",overviewGroup:"overview-group_8f375",header:"header_8f375"};function nL(e){let{siteData:t,page:{routePath:n,title:i,frontmatter:r}}=(0,P.Vi)(),{content:o,groups:a,defaultGroupTitle:l="Others"}=e,s=e=>(0,O.pJ)(e).startsWith(n.replace(/overview$/,""))&&!(0,O.pV)((0,O.pJ)(e),n),d=e=>"link"in e&&e.link?e.link:"items"in e?d(e.items[0]):"",c=(e,t,n)=>{for(let i of e){if((0,O.pJ)(i.link)===t)return[i];if(i.items){let e=c(i.items,t,n);if(e)return e}}return n},{pages:u}=t,h=u.filter(e=>s(e.routePath)),{items:p}=eH();function m(t,i,r){var o,a,l,s,c;if("dividerType"in t)return t;if((0,O.pJ)(t.link)===`${n}index`&&(null==r?void 0:r.overview)===!0)return!1;let u=null!=(s=null!=(l=null!=(a=null!=(o=null==e?void 0:e.overviewHeaders)?o:t.overviewHeaders)?a:null==r?void 0:r.overviewHeaders)?l:null==i?void 0:i.overviewHeaders)?s:[2],p=h.find(e=>(0,O.pV)(e.routePath,(0,O.pJ)(t.link||""))),m=d(t);return e_(eN({},t),{link:m,headers:(null==(c=null==p?void 0:p.toc)?void 0:c.filter(e=>u.some(t=>e.depth===t)))||[]})}p=c(p,n,p);let f=null!=a?a:(0,N.useMemo)(()=>{let e=p.filter(e=>"items"in e&&!!e.items&&e.items.filter(e=>s(d(e))).length>0).map(e=>({name:e.text||"",items:e.items.map(t=>m(t,e,r)).filter(Boolean)})),t=p.filter(e=>!("items"in e)&&s(e.link));return[...e,...t.length>0?[{name:l,items:t.map(e=>m(e))}]:[]]},[p,n,r]);return(0,E.jsxs)("div",{className:"overview-index mx-auto px-8",children:[(0,E.jsx)("div",{className:"flex items-center justify-between",children:!i&&(0,E.jsx)("h1",{className:"text-3xl leading-10 tracking-tight",children:"Overview"})}),o,f.map(e=>(0,E.jsxs)("div",{className:"mb-16",children:[e.name===l&&1===f.length?(0,E.jsx)("h2",{style:{paddingTop:0}}):(0,E.jsx)("h2",{children:tm(e.name)}),(0,E.jsx)("div",{className:nM.overviewGroups,children:e.items.map(e=>{var t;return(0,E.jsxs)("div",{className:nM.overviewGroup,children:[(0,E.jsx)("div",{className:"flex",children:(0,E.jsx)("h3",{style:{marginBottom:8},children:(0,E.jsx)(C.rU,{href:(0,O.AP)(e.link),children:tm(e.text)})})}),(0,E.jsx)("ul",{className:"list-none",children:null==(t=e.headers)?void 0:t.map(t=>(0,E.jsx)("li",{className:`${nM.overviewGroupLi} ${nM[`level${t.depth}`]} first:mt-2`,children:(0,E.jsx)(C.rU,{href:`${(0,O.AP)(e.link)}#${t.id}`,children:tm(t.text)})},t.id))})]},e.link)})})]},e.name))]})}function nD(e){return(0,E.jsxs)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256"},e),{children:[(0,E.jsx)("path",{fill:"#C12127",d:"M0 256V0h256v256z"}),(0,E.jsx)("path",{fill:"#FFF",d:"M48 48h160v160h-32V80h-48v128H48z"})]}))}function nR(e){return(0,E.jsx)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:(0,E.jsxs)("g",{fill:"#2c8ebb",children:[(0,E.jsx)("path",{d:"M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"}),(0,E.jsx)("path",{d:"M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"})]})}))}function nB(e){return(0,E.jsxs)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:[(0,E.jsx)("path",{fill:"#f8ab00",d:"M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"}),(0,E.jsx)("path",{fill:"#4c4c4c",d:"M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"})]}))}function n$(e){return(0,E.jsxs)("svg",e_(eN({id:"Bun",width:"1.2em",height:"1.2em",viewBox:"0 0 80 70"},e),{children:[(0,E.jsx)("path",{id:"Shadow",d:"M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"}),(0,E.jsxs)("g",{id:"Body",children:[(0,E.jsx)("path",{id:"Background",d:"M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z",style:{fill:"#fbf0df"}}),(0,E.jsx)("path",{id:"Bottom_Shadow","data-name":"Bottom Shadow",d:"M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z",style:{fill:"#f6dece"}}),(0,E.jsx)("path",{id:"Light_Shine","data-name":"Light Shine",d:"M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z",style:{fill:"#fffefc"}}),(0,E.jsx)("path",{id:"Top",d:"M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z",style:{fill:"#ccbea7",fillRule:"evenodd"}}),(0,E.jsx)("path",{id:"Outline",d:"M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"})]}),(0,E.jsxs)("g",{id:"Mouth",children:[(0,E.jsx)("g",{id:"Background-2","data-name":"Background",children:(0,E.jsx)("path",{d:"M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z",style:{fill:"#b71422"}})}),(0,E.jsxs)("g",{id:"Tongue",children:[(0,E.jsx)("path",{id:"Background-3","data-name":"Background",d:"M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z",style:{fill:"#ff6164"}}),(0,E.jsx)("path",{id:"Outline-2","data-name":"Outline",d:"M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"})]}),(0,E.jsx)("path",{id:"Outline-3","data-name":"Outline",d:"M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"})]}),(0,E.jsxs)("g",{id:"Face",children:[(0,E.jsx)("ellipse",{id:"Right_Blush","data-name":"Right Blush",cx:"53.22",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,E.jsx)("ellipse",{id:"Left_Bluch","data-name":"Left Bluch",cx:"22.95",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,E.jsx)("path",{id:"Eyes",d:"M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z",style:{fillRule:"evenodd"}}),(0,E.jsx)("path",{id:"Iris",d:"M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z",style:{fill:"#fff",fillRule:"evenodd"}})]})]}))}function nF(e){if(!(null==e?void 0:e.includes("install")))return e;let t=e.split(" ").filter(e=>!e.startsWith("-")&&!e.startsWith("--")).join(" ");return"yarn install"===t||"bun install"===t?e:e.replace("install","add")}function nH({command:e,additionalTabs:t=[]}){let n;let i={npm:(0,E.jsx)(nD,{}),yarn:(0,E.jsx)(nR,{}),pnpm:(0,E.jsx)(nB,{}),bun:(0,E.jsx)(n$,{})};return t.forEach(e=>{i[e.tool]=e.icon}),"string"==typeof e?(n={npm:`npm ${e}`,yarn:`yarn ${e}`,pnpm:`pnpm ${e}`,bun:`bun ${e}`},t.forEach(t=>{n[t.tool]=`${t.tool} ${e}`})):n=e,n.yarn&&(n.yarn=nF(n.yarn)),n.bun&&(n.bun=nF(n.bun)),(0,E.jsx)(C.mQ,{values:Object.entries(n).map(([e])=>(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:15},children:[i[e],(0,E.jsx)("span",{style:{marginLeft:6,marginBottom:2},children:e})]},e)),children:Object.entries(n).map(([e,t])=>(0,E.jsx)(C.OK,{children:(0,E.jsx)(tJ,{children:(0,E.jsx)(tK,{className:"language-js",codeHighlighter:"prism",children:t})})},e))})}var nZ={pagerLink:"pager-link_9b9a7",title:"title_9b9a7",next:"next_9b9a7",desc:"desc_9b9a7"};function nW(e){let{type:t,text:n,href:i}=e,{prevPageText:r="Previous Page",nextPageText:o="Next page"}=e$(),a="prev"===t?nZ.pagerLink:`${nZ.pagerLink} ${nZ.next}`;return(0,E.jsxs)(C.rU,{href:i,className:a,children:[(0,E.jsx)("span",{className:nZ.desc,children:"prev"===t?r:o}),(0,E.jsx)("span",{className:nZ.title,children:n})]})}var nU={scrollToTop:"scroll-to-top_1a167",entered:"entered_1a167"};function nq(){let[e,t]=(0,N.useState)(!1),n=()=>{t((window.scrollY||document.documentElement.scrollTop)>0)};return(0,N.useEffect)(()=>{window.addEventListener("scroll",n)},[]),(0,E.jsx)("button",{className:`${nU.scrollToTop} ${e?nU.entered:""}`,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},children:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,E.jsx)("path",{fillRule:"evenodd",d:"M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"})})})}var nV={mask:"mask_6e282",modal:"modal_6e282",inputForm:"inputForm_6e282",input:"input_6e282",close:"close_6e282",searchHits:"searchHits_6e282",groupTitle:"groupTitle_6e282",navSearchButton:"navSearchButton_6e282",searchWord:"searchWord_6e282",suggestItem:"suggestItem_6e282",suggestItemContainer:"suggestItemContainer_6e282",contentWrapper:"contentWrapper_6e282",mark:"mark_6e282",titleForContent:"titleForContent_6e282",actionIcon:"actionIcon_6e282",current:"current_6e282",tabClassName:"tabClassName_6e282",mobileNavSearchButton:"mobileNavSearchButton_6e282"},nG={container:"container_fa768",tabList:"tab-list_fa768",tab:"tab_fa768",notSelected:"not-selected_fa768",selected:"selected_fa768",noScrollbar:"no-scrollbar_fa768"},nY=e=>{var t;return(t=e)&&"object"==typeof t&&"label"in t?e.label||e.value:e},nQ=(0,N.forwardRef)((e,t)=>{let{values:n,defaultValue:i,onChange:r,children:o,groupId:a,tabPosition:l="left",tabContainerClassName:s}=e,d=N.Children.toArray(o).filter(e=>!("string"==typeof e&&""===e.trim())),c=n||[];0===c.length&&(c=N.Children.map(d,e=>{var t,n,i;return(0,N.isValidElement)(e)?{label:null==(t=e.props)?void 0:t.label,value:(null==(n=e.props)?void 0:n.value)||(null==(i=e.props)?void 0:i.label)}:{label:void 0,value:void 0}}));let{tabData:u,setTabData:h}=(0,N.useContext)(tw),p=0;a&&void 0!==u[a]?p=u[a]:i&&(p=c.findIndex(e=>"string"==typeof e?e===i:!!e&&"object"==typeof e&&"value"in e&&e.value===i));let[m,f]=(0,N.useState)(p);return(0,E.jsxs)("div",{className:nG.container,ref:t,children:[(0,E.jsx)("div",{className:s,children:c.length?(0,E.jsx)("div",{className:`${nG.tabList} ${nG.noScrollbar}`,style:{justifyContent:"center"===l?"center":"flex-start"},children:c.map((e,t)=>(0,E.jsx)("div",{className:`${nG.tab} ${m===t?nG.selected:nG.notSelected}`,onClick:()=>{null==r||r(t),f(t),a&&h(e_(eN({},u),{[a]:t}))},children:nY(e)},t))}):null}),(0,E.jsx)("div",{children:N.Children.toArray(d)[m]})]})});function nK(e){var{children:t}=e,n=eA(e,["children"]);return(0,E.jsx)("div",e_(eN({},n),{className:"rounded px-2",children:t}))}function nJ({query:e}){return(0,E.jsxs)("div",{className:"flex flex-col items-center pt-8 pb-2",children:[(0,E.jsx)(tb,{icon:eg.Z,className:"mb-4 opacity-80"}),(0,E.jsxs)("p",{className:"mb-2",children:["No results for ",(0,E.jsxs)("b",{children:['"',e,'"']}),"."]}),(0,E.jsx)("p",{children:"Please try again with a different keyword."})]})}var nX={title:ey.Z,header:eb.Z,content:ex.Z};function n0({suggestion:e,closeSearch:t,isCurrent:n,setCurrentSuggestionIndex:i,inCurrentDocIndex:r,scrollTo:o}){var a,l;let s=nX[e.type],d=r&&!(0,M.yv)()?e1(e.link):e.link,c=(0,N.useRef)(null);n&&o(null==(a=null==c?void 0:c.current)?void 0:a.offsetTop,null==(l=null==c?void 0:c.current)?void 0:l.offsetHeight);let u=(e,t)=>{let n=[],i=0;for(let l of t){var r,o,a;let{start:t,length:s}=l,d=e.slice(i,t);let c=(r=e,o=t,a=s,function(e,t,n){let i="",r=0,o=e.length;for(let a=0;a0+n);a++){;r>t&&(i+=e.charAt(a))}return i}(r.slice(o),0,a));n.push(d),n.push((0,E.jsx)("span",{className:nV.mark,children:c},t)),i=t+c.length}return i{if("header"===e.type||"title"===e.type){let{header:t,highlightInfoList:n}=e;return(0,E.jsx)("div",{className:"font-medium",children:u(t,n)})}return(0,E.jsx)("div",{className:"font-medium",children:e.header})})();break;case"content":h=(0,E.jsxs)(E.Fragment,{children:[(()=>{if("content"!==e.type)return(0,E.jsx)("div",{});let{statement:t,highlightInfoList:n}=e;return(0,E.jsx)("div",{className:"text-sm text-gray-light w-full",children:u(t,n)})})(),(0,E.jsx)("p",{className:nV.titleForContent,children:e.title})]})}return(0,E.jsx)("li",{className:`${nV.suggestItem} ${n?nV.current:""}`,onMouseEnter:i,ref:c,children:(0,E.jsx)("a",{href:d,onClick:e=>{t(),e.stopPropagation()},target:r?"_self":"_blank",children:(0,E.jsxs)("div",{className:nV.suggestItemContainer,children:[(0,E.jsx)("div",{className:nV.hitIcon,children:(0,E.jsx)(tb,{icon:s})}),(0,E.jsx)("div",{className:nV.contentWrapper,children:(0,E.jsx)("span",{children:h})}),(0,E.jsx)("div",{className:nV.actionIcon,children:(0,E.jsx)(tb,{icon:ev.Z})})]})})},e.link)}var n1={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter",SEARCH:"KeyK",ESC:"Escape"};function n2({focused:e,setFocused:t}){let[n,i]=(0,N.useState)(""),[r,o]=(0,N.useState)([]),a=(0,N.useRef)(null),[l,s]=(0,N.useState)(!0),[d,c]=(0,N.useState)(0),u=(0,N.useRef)(null),h=(0,N.useRef)(null),p=(0,N.useRef)(null),m=(0,N.useRef)(null),[f,g]=(0,N.useState)(!1),x=(e,t)=>{var n,i,o,a,l;if(f){let s=e+t-(null==(n=null==p?void 0:p.current)?void 0:n.offsetHeight)-(1===r.length?50:-10);s>(null==(i=null==p?void 0:p.current)?void 0:i.scrollTop)&&(null==(o=null==p?void 0:p.current)||o.scrollTo({top:s}));let d=1===r.length?e-70:e-10;d<(null==(a=null==p?void 0:p.current)?void 0:a.scrollTop)&&(null==(l=null==p?void 0:p.current)||l.scrollTo({top:d}))}},{siteData:v,page:{lang:b,version:y}}=(0,P.Vi)(),{sidebar:w}=e$(),{search:k,title:j}=v,I=k&&"remote"!==k.mode&&k.versioned,S=[{group:j,result:[],renderType:"default"}],[C,z]=(0,N.useState)([]),[_,A]=(0,N.useState)("default"),T=e=>eF(w,e).group;function O(){return eR(this,null,function*(){var e,t;if(!1===k)return;let n={currentLang:b,currentVersion:y,extractGroupName:T},i=new tn(eN(eN({indexName:j},k),n));u.current=i,h.current=n,yield Promise.all([u.current.init(),new Promise(e=>setTimeout(e,1e3))]),s(!1);let r=null==(e=a.current)?void 0:e.value;r&&o((yield null==(t=u.current)?void 0:t.match(r))||S)})}(0,N.useEffect)(()=>{let n=n=>{switch(n.code){case n1.SEARCH:(n.ctrlKey||n.metaKey)&&(n.preventDefault(),t(!e));break;case n1.ARROW_DOWN:e&&(n.preventDefault(),C&&"default"===_&&(g(!0),c((d+1)%C.length)));break;case n1.ARROW_UP:if(e&&(n.preventDefault(),"default"===_)){let e=C.length;g(!0),c((d-1+e)%e)}break;case n1.ENTER:if(d>=0&&"default"===_){let e=C[d];C===r[0].result?(window.location.href=(0,M.yv)()?e.link:e1(e.link),t(!1)):window.open(e.link)}break;case n1.ESC:t(!1)}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[c,t,C,d]),(0,N.useEffect)(()=>{e?(o(S),!u.current&&O()):i("")},[e]),(0,N.useEffect)(()=>{var e;let{currentLang:t,currentVersion:n}=null!=(e=h.current)?e:{},i=b!==t,r=I&&y!==n;!l&&(i||r)&&O()},[b,y,I]);let L=e=>eR(this,null,function*(){var t;let n=e;if(i(n),n){let e=[];if(ep.beforeSearch){let e=yield ep.beforeSearch(n);e&&(n=e)}let i=yield null==(t=u.current)?void 0:t.match(n);if(i&&e.push(...i),ep.H){let t=yield ep.H(n,e);t&&e.push(...t.map(e=>eN({renderType:"custom"},e)))}o(e||S),ep.afterSearch&&(yield ep.afterSearch(n,e)),e.length>0&&z(e[0].result)}}),D=(0,N.useMemo)(()=>(0,ec.Z)(L,150),[]),R=e=>(0,eu.Z)(e,"group"),B=-1,$=e=>{if(0===e.length&&!l)return(0,E.jsx)("div",{className:"mt-4 flex-center",children:(0,E.jsx)("div",{className:"p-2 font-bold text-md",style:{color:"#2c3e50"},children:"No results found"})});let n=R(e);return(0,E.jsx)("ul",{className:nV.suggestList,children:Object.keys(n).map(e=>{let i=n[e]||[];return(0,E.jsx)("li",{children:(0,E.jsx)("ul",{className:"pb-2",children:i.map(e=>{let n=++B;return(0,E.jsx)(n0,{suggestion:e,isCurrent:n===d,setCurrentSuggestionIndex:()=>{g(!1),c(n)},closeSearch:()=>t(!1),inCurrentDocIndex:C===r[0].result,scrollTo:x},`${e.title}-${n}`)})})},e)})})};return(0,E.jsx)(E.Fragment,{children:e&&(0,eh.createPortal)((0,E.jsx)("div",{className:nV.mask,onClick:()=>t(!1),children:(0,E.jsxs)("div",{className:`${nV.modal}`,onClick:e=>{t(!0),e.stopPropagation()},children:[(0,E.jsxs)("div",{className:"flex items-center",children:[(0,E.jsxs)("div",{className:nV.inputForm,children:[(0,E.jsx)("label",{children:(0,E.jsx)(tb,{icon:ed.Z})}),(0,E.jsx)("input",{className:nV.input,ref:a,placeholder:"Search Docs","aria-label":"Search",autoComplete:"off",autoFocus:!0,onChange:e=>D(e.target.value)}),(0,E.jsx)("label",{children:(0,E.jsx)(tb,{icon:em.Z,className:nV.close,onClick:e=>{a.current&&(e.stopPropagation(),n?(a.current.value="",i("")):t(!1))}})})]}),(0,E.jsx)("h2",{className:"text-brand ml-2 sm:hidden cursor-pointer",onClick:e=>{e.stopPropagation(),t(!1)},children:"Cancel"})]}),n?(0,E.jsx)("div",{className:`${nV.searchHits} rspress-scrollbar`,ref:p,children:((e,t)=>{if(1===e.length){let t=e[0].result;return 0===t.length?(0,E.jsx)(nJ,{query:n}):(0,E.jsx)("div",{ref:m,children:$(t)})}let i=e.map(e=>t&&"remote"===t.mode?e3(t.searchIndexes||[]).find(t=>t.value===e.group).label:e.group);return(0,E.jsx)(nQ,{values:i,tabContainerClassName:nV.tabClassName,onChange:t=>{z(e[t].result),c(0),A(e[t].renderType)},ref:m,children:e.map(e=>(0,E.jsxs)(nK,{children:["default"===e.renderType&&$(e.result),"custom"===e.renderType&&ep.render(e.result)]},e.group))})})(r,k)}):null,l&&(0,E.jsx)("div",{className:"flex-center",children:(0,E.jsx)("div",{className:"p-2 text-sm",children:(0,E.jsx)(tb,{icon:ef.Z})})})]})}),document.getElementById("search-container"))})}function n3(){let[e,t]=(0,N.useState)(!1),[n,i]=(0,N.useState)(null),{searchPlaceholderText:r="Search Docs"}=e$();return(0,N.useEffect)(()=>{i(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?"\u2318":"Ctrl")},[]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:`rspress-nav-search-button ${nV.navSearchButton}`,onClick:()=>t(!0),children:(0,E.jsxs)("button",{children:[(0,E.jsx)(tb,{icon:ed.Z,width:"18",height:"18"}),(0,E.jsx)("p",{className:nV.searchWord,children:r}),(0,E.jsxs)("div",{style:{opacity:n?1:0},children:[(0,E.jsx)("span",{children:n}),(0,E.jsx)("span",{children:"K"})]})]})}),(0,E.jsx)("div",{className:nV.mobileNavSearchButton,onClick:()=>t(!0),children:(0,E.jsx)(tb,{icon:ed.Z})}),(0,E.jsx)(n2,{focused:e,setFocused:t})]})}var n4={navTitleMask:"navTitleMask_71eca",sidebar:"sidebar_71eca",sidebarContainer:"sidebarContainer_71eca",sidebarContent:"sidebarContent_71eca",open:"open_71eca",menuLink:"menuLink_71eca",menuItem:"menuItem_71eca",collapseContainer:"collapseContainer_71eca",menuItemActive:"menuItemActive_71eca"};function n5(e){let{depth:t,dividerType:n}=e;return(0,E.jsx)("div",{className:`${"dashed"===n?"border-dashed":"border-solid"} border-t border-divider-light my-3`,style:{marginLeft:0===t?0:"18px"}})}function n6(e){var t;let{item:n,depth:i=0,activeMatcher:r,id:o,setSidebarData:a}=e,l=(0,T.s0)(),s=(0,N.useRef)(null),d=(0,N.useRef)(null),c=(0,N.useRef)(null),u=(0,N.useRef)(!0),h=(0,N.useRef)(n.collapsed),p=n.link&&r(n.link),{collapsed:m,collapsible:f=!0}=n,g=(0,E.jsx)("div",{style:{cursor:"pointer",transition:"transform 0.2s ease-out",transform:m?"rotate(0deg)":"rotate(90deg)"},children:(0,E.jsx)(tb,{icon:W.Z})});(0,N.useEffect)(()=>{if(u.current||!s.current||!c.current)return;d.current&&clearTimeout(d.current);let e=s.current,t=c.current,n=t.clientHeight+4;m?(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.5s",t.style.opacity="0",d.current=setTimeout(()=>{s.current&&(s.current.style.maxHeight="0px")},0)):(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.3s",t.style.opacity="1",d.current=setTimeout(()=>{s.current&&s.current.style.removeProperty("max-height")},300))},[m]),(0,N.useEffect)(()=>{u.current=!1},[]);let x=e=>{e.stopPropagation(),a(e=>{let t=[...e],n=o.split("-").map(Number),i=t[n.shift()];for(let e of n)i=i.items[e];return"items"in i&&(i.collapsed=!i.collapsed),t})};return(0,E.jsxs)("section",{className:"mt-0.5 block",style:{marginLeft:0===i?0:"18px"},children:[(0,E.jsxs)("div",{className:`flex justify-between items-center ${p?n4.menuItemActive:n4.menuItem}`,onMouseEnter:()=>n.link&&e.preloadLink(n.link),onClick:e=>{n.link?(l((0,O.pJ)((0,O.AP)(n.link))),m&&x(e)):f&&x(e)},style:{borderRadius:0===i?"0 var(--rp-radius) var(--rp-radius) 0":void 0,cursor:f||n.link?"pointer":"normal"},children:[(0,E.jsxs)("h2",{className:"py-2 px-3 text-sm font-medium flex",style:eN({},0===i?ii:{}),children:[(0,E.jsx)(C.Vp,{tag:n.tag}),(0,E.jsx)("span",{className:"flex-center",children:tm(n.text)})]}),f&&(0,E.jsx)("div",{className:`${n4.collapseContainer} p-2 rounded-xl`,onClick:x,children:g})]}),(0,E.jsx)("div",{ref:s,className:"transition-all duration-300 ease-in-out",style:{overflow:"hidden",maxHeight:h.current?0:void 0},children:(0,E.jsx)("div",{ref:c,className:"rspress-sidebar-group transition-opacity duration-500 ease-in-out",style:{opacity:h.current?0:1,marginLeft:0===i?"12px":0},children:null==(t=null==n?void 0:n.items)?void 0:t.map((t,n)=>"dividerType"in t?(0,E.jsx)(n5,{depth:i+1,dividerType:t.dividerType},n):(0,E.jsx)("div",{children:(0,E.jsx)(n8,e_(eN({},e),{item:t,depth:i+1,id:`${o}-${n}`,preloadLink:e.preloadLink}))},n))})})]},o)}var n7=e=>e.replace(/\.(mdx?)$/,"");function n8(e){let{item:t,depth:n=0,activeMatcher:i,id:r,setSidebarData:o}=e,a="link"in t&&t.link&&i(t.link),{page:l}=(0,P.Vi)(),s=(0,N.useRef)(null),d=(0,N.useRef)(t.text),c=function(){let[,e]=(0,N.useState)(0);return()=>{e(e=>e+1)}}();return((0,N.useEffect)(()=>{var e;a&&(null==(e=s.current)||e.scrollIntoView({block:"center"}))},[]),!(0,M.yv)()&&t._fileKey===n7(l.pagePath)&&l.title&&(d.current=l.title),(0,N.useEffect)(()=>{t.text!==d.current&&(d.current=t.text,c())},[t.text]),"items"in t)?(0,E.jsx)(n6,{id:r,item:t,depth:n,activeMatcher:i,collapsed:t.collapsed,setSidebarData:o,preloadLink:e.preloadLink},`${t.text}-${r}`):(0,E.jsx)(C.rU,{href:(0,O.AP)(t.link),className:n4.menuLink,children:(0,E.jsxs)("div",{ref:s,onMouseEnter:()=>e.preloadLink(t.link),className:`${a?n4.menuItemActive:n4.menuItem} mt-0.5 py-2 px-3 font-medium flex`,style:eN(eN({fontSize:0===n?"14px":"13px",marginLeft:0===n?0:"18px",borderRadius:"0 var(--rp-radius) var(--rp-radius) 0"},0===n?ii:{}),a?{color:"var(--rp-c-brand)"}:{}),children:[(0,E.jsx)(C.Vp,{tag:t.tag}),(0,E.jsx)("span",{children:tm(d.current)})]})})}function n9({sectionHeaderText:e,tag:t}){return(0,E.jsxs)("div",{className:"rspress-sidebar-section-header",children:[(0,E.jsx)(C.Vp,{tag:t}),(0,E.jsx)("span",{children:tm(e)})]})}var ie=e=>"dividerType"in e,it=e=>"sectionHeaderText"in e,ii={fontSize:"14px",paddingLeft:"24px",fontWeight:"bold"},ir=new WeakMap;function io(e){let{isSidebarOpen:t,beforeSidebar:n,afterSidebar:i,uiSwitch:r}=e,{items:o}=eH(),a=e$(),{pathname:l}=(0,T.TH)(),s=(0,M.Kw)(a.langRoutePrefix||""),[d,c]=(0,N.useState)(o.filter(Boolean).flat()),u=decodeURIComponent(l);(0,N.useEffect)(()=>{if(o===d)return;ir=new WeakMap;let e=t=>ir.has(t)?ir.get(t):"link"in t&&t.link&&p(t.link)||"items"in t&&t.items.some(t=>e(t))?(ir.set(t,!0),!0):(ir.set(t,!1),!1),t=n=>{"items"in n&&(n.items.forEach(t),e(n)&&(n.collapsed=!1))},n=o.filter(Boolean).flat();n.forEach(t),c(n)},[o,u]);let h=e=>e.replace(s,""),p=e=>tu((0,O.E9)(h(u)),h(e),!0),m=e=>{let t=(0,X.fp)(et.routes,e);if(null==t?void 0:t.length){let{route:e}=t[0];e.preload()}};return(0,E.jsx)("aside",{className:`${n4.sidebar} rspress-sidebar ${t?n4.open:""}`,children:(0,E.jsxs)("div",{className:`${n4.sidebarContainer}`,children:[r.showNavbar?(0,E.jsx)("div",{className:n4.navTitleMask,children:(0,E.jsx)(n_,{})}):null,(0,E.jsx)("div",{className:`mt-1 ${n4.sidebarContent}`,children:(0,E.jsx)("div",{className:"rspress-scrollbar",style:{maxHeight:"calc(100vh - var(--rp-nav-height) - 8px)",overflow:"auto"},children:(0,E.jsxs)("nav",{className:"pb-2",children:[n,d.map((e,t)=>{var n;return ie(e)?(0,E.jsx)(n5,{depth:0,dividerType:e.dividerType},t):it(e)?(0,E.jsx)(n9,{sectionHeaderText:e.sectionHeaderText,tag:e.tag},t):(0,E.jsx)(n8,{id:String(t),item:e,depth:0,activeMatcher:p,collapsed:null==(n=e.collapsed)||n,setSidebarData:c,preloadLink:m},t)}),i]})})})]})})}var ia="sourceCode_bf1b0";function il(e){let{href:t,platform:n="github"}=e,{sourceCodeText:i="Source"}=e$();return(0,E.jsx)("div",{className:`inline-block rounded border border-solid border-gray-300 text-gray-400 ${ia}`,children:(0,E.jsxs)("a",{href:t,target:"_blank",className:"flex items-center content-center transition-all duration-300 text-xs block px-2 py-1 ",children:[(0,E.jsx)("span",{className:"mr-2 inline-flex w-4 h-4",children:(0,E.jsx)(tb,{icon:"gitlab"===n?ek.Z:ew.Z})}),(0,E.jsx)("span",{children:i})]})})}var is="rspressSteps_38f64";function id({children:e}){return(0,E.jsx)("div",{className:`ml-4 mb-11 border-l pl-6 ${is} [counter-reset:step]`,children:e})}var ic=({tag:e})=>e?e.trim().startsWith("(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:`#${e.id}`,className:"rspress-toc-link sm:text-normal text-sm",style:{marginLeft:(e.depth-2)*12},onClick:n=>{n.preventDefault(),window.location.hash=e.id;let i=document.getElementById(e.id);i&&eV(i,!1),null==t||t(e)},children:(0,E.jsx)("span",{className:"rspress-toc-link-text block",children:tm(e.text)})})},e.id);function ih({onItemClick:e}){let{page:t}=(0,P.Vi)();return(0,E.jsx)("ul",{children:t.toc.map(t=>(0,E.jsx)(iu,{header:t,onItemClick:e},t.id))})}var ip={Layout:tI,NotFoundLayout:eB,HomeLayout:tP,setup:eY}},71895:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}}),n("93201");var i=n("23657")},49555:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var i=n("13393");let r=/\s?|(]*>|]*>|]+>)+/i,o=RegExp(i.map(e=>`<${e}\\b[^>]*>`).join("|"),"i");function a(e){return e=e.trim().slice(0,1e3),r.test(e)||o.test(e)}},10924:function(e){"use strict";e.exports=JSON.parse('{"AElig":"\xc6","AMP":"&","Aacute":"\xc1","Acirc":"\xc2","Agrave":"\xc0","Aring":"\xc5","Atilde":"\xc3","Auml":"\xc4","COPY":"\xa9","Ccedil":"\xc7","ETH":"\xd0","Eacute":"\xc9","Ecirc":"\xca","Egrave":"\xc8","Euml":"\xcb","GT":">","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},33222:function(e){"use strict";e.exports=JSON.parse('{"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"}')},48606:function(e){"use strict";e.exports=JSON.parse('["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]')}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/333.7fcb1a81.js.LICENSE.txt b/modern-js/module-tools/static/js/1362.3be3fc30.js.LICENSE.txt similarity index 99% rename from modern-js/module-tools/static/js/333.7fcb1a81.js.LICENSE.txt rename to modern-js/module-tools/static/js/1362.3be3fc30.js.LICENSE.txt index 8eef42d610..61c3965127 100644 --- a/modern-js/module-tools/static/js/333.7fcb1a81.js.LICENSE.txt +++ b/modern-js/module-tools/static/js/1362.3be3fc30.js.LICENSE.txt @@ -1,956 +1,956 @@ -/*! ./info */ - /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/why-module-engineering-solution.md */ -/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ +/*! @theme-assets/arrow-right */ /*! react */ -/*! @rspress/runtime */ +/*! ./TransitionGroupContext */ /*! react */ -/*! ./util/create */ - -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-node-polyfill.mdx */ - -/*! htmr */ +/*! @theme */ -/*! @rspress/shared */ +/*! ./html */ -/*! react-syntax-highlighter/dist/esm/languages/prism/markdown */ +/*! refractor/lang/diff.js */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/release-module-doc.mdx */ - -/*! ./types */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/external-dependency.mdx */ -/*! react-dom */ +/*! @theme-assets/title */ -/*! @theme-assets/moon */ +/*! @theme-assets/copy */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/testing.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/before-getting-started.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/test.mdx */ +/*! core-js/modules/esnext.iterator.find.js */ -/*! @theme-assets/success */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/welcome.md */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-vue.mdx */ -/*! react/jsx-runtime */ +/*! refractor/lang/bash.js */ -/*! ./typescript.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-build.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/before-getting-started.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-babel.mdx */ -/*! react/jsx-runtime */ +/*! ./util/case-insensitive-transform */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/welcome.md */ +/*! copy-to-clipboard */ -/*! @theme-assets/github */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/build.mdx */ -/*! @theme-assets/sun */ +/*! react-syntax-highlighter/dist/esm/languages/prism/markdown */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-test.mdx */ +/*! ./lib/xmlns */ -/*! @babel/runtime/helpers/defineProperty */ +/*! react */ -/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ +/*! react-syntax-highlighter */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-build.md */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/index.md */ +/*! nprogress */ -/*! is-alphabetical */ +/*! dom-helpers/removeClass */ -/*! core-js/modules/esnext.async-iterator.find.js */ +/*! refractor/lang/typescript.js */ -/*! @theme-assets/small-menu */ +/*! ./hooks */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-micro-generator.md */ +/*! refractor/lang/markdown.js */ -/*! core-js/modules/web.url-search-params.delete.js */ +/*! react */ -/*! @theme-assets/arrow-right */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-dev-command.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/plugin-api/plugin-hooks.md */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/getting-started.mdx */ -/*! virtual-site-data */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-micro-generator.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-test.mdx */ +/*! refractor/lang/xml-doc.js */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-build.md */ -/*! @rspress/shared */ +/*! is-decimal */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/overview.md */ +/*! virtual-routes */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/build.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/release-module-doc.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/publish-your-project.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-exception.mdx */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/using-storybook.mdx */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/overview.md */ /*! react */ -/*! @theme-assets/title */ +/*! @theme-assets/jump */ -/*! @theme-assets/copy */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-exception.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-other.mdx */ +/*! react */ -/*! ./lib/html */ +/*! refractor/lang/javascript.js */ -/*! /home/runner/work/modern.js/modern.js/node_modules/.pnpm/@rspress+plugin-medium-zoom@1.18.2_@rspress+runtime@1.18.2/node_modules/@rspress/plugin-medium-zoom/src/components/MediumZoom.tsx */ +/*! react */ -/*! @rspress/runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/getting-started.mdx */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/setup-function.mdx */ +/*! ./highlight */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-dev-command.md */ +/*! @theme-assets/file */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/using-storybook.mdx */ -/*! property-information/normalize */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/build-umd.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/node_modules/.pnpm/@rspress+plugin-medium-zoom@1.18.2_@rspress+runtime@1.18.2/node_modules/@rspress/plugin-medium-zoom/src/components/MediumZoom.tsx */ -/*! @rspress/runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-vue.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-exception.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/getting-started.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/plugin-api/plugin-hooks.md */ +/*! @rspress/runtime */ -/*! copy-to-clipboard */ +/*! dom-helpers/addClass */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/using-storybook.mdx */ +/*! virtual-prism-languages */ -/*! react */ +/*! refractor/core */ -/*! react-syntax-highlighter */ +/*! @rspress/core/theme */ -/*! @babel/runtime/helpers/extends */ +/*! @theme-assets/empty */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-babel.mdx */ -/*! ./checkForListedLanguage */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/setup-function.mdx */ -/*! nprogress */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/basic.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/index.md */ +/*! refractor/lang/scss.js */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/index.md */ +/*! ./html-tags.json */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/getting-started.mdx */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-babel.mdx */ +/*! virtual-site-data */ -/*! react-syntax-highlighter/dist/esm/languages/prism/yaml */ +/*! refractor/lang/json.js */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/basic.mdx */ - -/*! /home/runner/work/modern.js/modern.js/node_modules/.pnpm/@rspress+plugin-container-syntax@1.18.2/node_modules/@rspress/plugin-container-syntax/container.css */ +/*! react-syntax-highlighter/dist/esm/languages/prism/yaml */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/using-storybook.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/publish-emo.mdx */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-test.mdx */ +/*! ./jsx.js */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/asset.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/plugins.md */ -/*! virtual-routes */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/build-umd.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-micro-generator.md */ +/*! /home/runner/work/modern.js/modern.js/node_modules/.pnpm/@rspress+plugin-container-syntax@1.18.2/node_modules/@rspress/plugin-container-syntax/container.css */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-build.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-micro-generator.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-vue.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/why-module-engineering-solution.md */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/overview.md */ -/*! react */ +/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */ -/*! @theme-assets/jump */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-build.md */ -/*! react */ +/*! core-js/modules/web.url-search-params.size.js */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-product.mdx */ +/*! @rspress/theme-default */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/build-umd.mdx */ +/*! ./lib/util/defined-info */ -/*! react-router-dom */ +/*! nprogress/nprogress.css */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-product.mdx */ -/*! virtual-site-data */ +/*! refractor/lang/yaml.js */ -/*! @rspress/runtime */ +/*! ./lib/util/info */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/command-preview.md */ -/*! @rspress/runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/getting-started.mdx */ -/*! ./lib/ReactPropTypesSecret */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-banner.mdx */ -/*! ./util/create */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/build-umd.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/copy.md */ -/*! @theme-assets/file */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-other.mdx */ -/*! react-router-dom */ +/*! ./util/types */ -/*! refractor/lang/css.js */ +/*! ./util/create */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/publish-emo.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/getting-started.mdx */ -/*! @babel/runtime/helpers/objectWithoutProperties */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/register-esbuild-plugin.mdx */ -/*! react/jsx-runtime */ +/*! ./create-element */ -/*! react-syntax-highlighter/dist/esm/languages/prism/diff */ +/*! react */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/command-preview.md */ - -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/getting-started.mdx */ - -/*! virtual-prism-languages */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-dev-command.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/basic.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/basic.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/copy.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-babel.mdx */ -/*! @theme-assets/empty */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/getting-started.mdx */ -/*! property-information/find */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-banner.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-product.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-node-polyfill.mdx */ -/*! virtual-global-components */ +/*! @rspress/runtime */ -/*! xtend */ +/*! react-syntax-highlighter/dist/esm/languages/prism/diff */ -/*! virtual-site-data */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/basic.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/before-getting-started.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/register-esbuild-plugin.mdx */ +/*! react */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/storybook.mdx */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/before-getting-started.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/command-preview.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-dev-command.md */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/basic.mdx */ +/*! @babel/runtime/helpers/defineProperty */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/command-preview.md */ +/*! ./Transition */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/using-storybook.mdx */ -/*! ./defined-info */ +/*! ./schema */ -/*! nprogress/nprogress.css */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-polyfill.mdx */ -/*! ../../normalize */ +/*! ./util/create */ -/*! @theme */ +/*! @rspress/runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/publish-emo.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-banner.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-polyfill.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-storybook.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-product.mdx */ +/*! flexsearch */ -/*! is-hexadecimal */ +/*! @theme-assets/wrap */ -/*! ./factoryWithThrowingShims */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/why-module-engineering-solution.md */ -/*! react-syntax-highlighter/dist/esm/languages/prism/xml-doc */ +/*! ./App */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/asset.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/dev.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-storybook.mdx */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/plugins.md */ +/*! react/jsx-runtime */ -/*! virtual-global-styles */ +/*! ./lang/css */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/plugin-api/plugin-hooks.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-node-polyfill.mdx */ -/*! parse-entities */ +/*! react-dom/client */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/getting-started.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/getting-started.mdx */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/plugin-object.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/index.md */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/release-module-doc.mdx */ -/*! character-reference-invalid */ +/*! ./lang/javascript */ -/*! ./utils */ +/*! react-transition-group */ -/*! react-dom */ +/*! ./schema */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/components.mdx */ +/*! ./hasClass */ -/*! core-js/modules/esnext.iterator.map.js */ +/*! @babel/runtime/helpers/toConsumableArray */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/register-esbuild-plugin.mdx */ +/*! react-syntax-highlighter/dist/esm/languages/prism/xml-doc */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/plugin-object.mdx */ -/*! space-separated-tokens */ +/*! react */ + +/*! react/jsx-runtime */ + +/*! ./factory */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-node-polyfill.mdx */ -/*! refractor/lang/tsx.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-babel.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/release-module-doc.mdx */ +/*! is-decimal */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/dev.md */ +/*! core-js/modules/web.url-search-params.has.js */ -/*! ./TransitionGroupContext */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/use-tailwindcss.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/components.mdx */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/copy.md */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/use-tailwindcss.mdx */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-polyfill.mdx */ /*! react */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-exception.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-babel.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/testing.md */ -/*! react-syntax-highlighter/dist/esm/languages/prism/typescript */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/testing.md */ -/** - * Prism: Lightweight, robust, elegant syntax highlighting - * - * @license MIT - * @author Lea Verou - * @namespace - * @public - */ +/*! react */ -/*! @theme */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/external-dependency.mdx */ +/*! ./lib/xlink */ -/*! @rspress/runtime */ +/*! virtual-routes */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/using-storybook.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/use-tailwindcss.mdx */ - -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-polyfill.mdx */ +/*! body-scroll-lock */ -/*! flexsearch */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/publish-your-project.mdx */ -/*! @theme-assets/wrap */ +/*! ./MediumZoom.css */ -/*! core-js/modules/esnext.iterator.find.js */ +/*! react-syntax-highlighter/dist/esm/languages/prism/typescript */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/use-tailwindcss.mdx */ +/*! ./util/create */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/testing.md */ +/*! virtual-site-data */ /*! react/jsx-runtime */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/asset.mdx */ -/*! react */ +/*! hast-util-parse-selector */ -/*! react-transition-group */ +/*! react/jsx-runtime */ -/*! ./html */ +/*! react */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/setup-function.mdx */ -/*! refractor/lang/diff.js */ - -/*! react-syntax-highlighter/dist/esm/languages/prism/less */ - /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/publish-your-project.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/testing.md */ /*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/testing.md */ - -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/external-dependency.mdx */ - -/*! refractor/lang/bash.js */ - -/*! ./util/case-insensitive-transform */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/plugin-object.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/setup-function.mdx */ -/*! dom-helpers/removeClass */ +/*! character-entities-legacy */ -/*! ./lib/xmlns */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/components.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/plugin-api/plugin-hooks.md */ -/*! refractor/lang/typescript.js */ +/*! ./lib/xml */ -/*! ./hooks */ +/*! shallowequal */ -/*! refractor/lang/markdown.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-storybook.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/copy.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-test.mdx */ /*! react */ -/*! react */ +/*! ./utils/reflow */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/asset.mdx */ +/*! react-syntax-highlighter/dist/esm/languages/prism/less */ -/*! body-scroll-lock */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-preset.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/testing.md */ +/*! core-js/modules/esnext.async-iterator.map.js */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/test.mdx */ -/*! react-lazy-with-preload */ +/*! react/jsx-runtime */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-module-doc.mdx */ -/*! refractor/lang/xml-doc.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/components.mdx */ -/*! is-decimal */ +/*! prop-types */ -/*! react/jsx-runtime */ +/*! ./bundle.css */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-exception.mdx */ +/*! virtual-routes */ -/*! @babel/runtime/helpers/esm/inheritsLoose */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/asset.mdx */ -/*! react-syntax-highlighter/dist/esm/languages/prism/scss */ +/*! @theme-assets/search */ /*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/asset.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/copy.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/publish-your-project.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/build.mdx */ /*! react */ -/*! @rspress/runtime */ - -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/publish-your-project.mdx */ -/*! refractor/lang/javascript.js */ +/*! ./lib/aria */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-other.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/command-preview.md */ -/*! ./highlight */ +/*! ./config */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/release-module-doc.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-module-doc.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-exception.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-test.mdx */ -/*! react-syntax-highlighter/dist/esm/languages/prism/javascript */ +/*! @rspress/runtime */ -/*! dom-helpers/addClass */ +/*! react/jsx-runtime */ -/*! react */ +/*! react-lazy-with-preload */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-module-doc.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/setup-function.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-dev-command.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/dev.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/register-esbuild-plugin.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/plugin-api/plugin-hooks.md */ +/*! @rspress/runtime */ /*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/getting-started.mdx */ - -/*! ./jsx.js */ +/*! invariant */ -/*! ./bundle.css */ +/*! @babel/runtime/helpers/esm/inheritsLoose */ -/*! refractor/core */ +/*! react-syntax-highlighter/dist/esm/languages/prism/scss */ -/*! core-js/modules/web.url-search-params.size.js */ +/*! @rspress/shared */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/build.mdx */ -/*! @theme-assets/search */ +/*! react */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-vue.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/modify-output-product.md */ -/*! refractor/lang/scss.js */ - -/*! ./html-tags.json */ - -/*! refractor/lang/json.js */ - -/*! react-syntax-highlighter/dist/esm/languages/prism/css */ +/*! @rspress/runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/before-getting-started.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/index.md */ -/*! @babel/runtime/helpers/esm/inheritsLoose */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/plugin-object.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-vue.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/overview.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-import.mdx */ +/*! react */ -/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */ +/*! react-syntax-highlighter/dist/esm/languages/prism/javascript */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/test.mdx */ /*! @rspress/runtime */ -/*! react/jsx-runtime */ - -/*! ./lib/util/defined-info */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/dev.md */ -/*! @rspress/runtime */ +/*! @babel/runtime/helpers/esm/extends */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-other.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/storybook.mdx */ +/*! ./util/case-insensitive-transform */ -/*! refractor/lang/yaml.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/storybook.mdx */ -/*! medium-zoom */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-product.mdx */ /*! react/jsx-runtime */ -/*! ./lib/util/info */ +/*! ./decode-entity */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-dev-command.md */ +/*! comma-separated-tokens */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-config.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/before-getting-started.md */ -/*! @rspress/shared */ +/*! react-helmet-async */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-other.mdx */ +/*! @babel/runtime/helpers/esm/inheritsLoose */ -/*! @rspress/runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/register-esbuild-plugin.mdx */ -/*! react */ +/*! virtual-search-index-hash */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-product.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-test.mdx */ -/*! ./util/types */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-product.mdx */ -/*! ./util/create */ +/*! react-syntax-highlighter/dist/esm/languages/prism/css */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/why-module-engineering-solution.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-polyfill.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/plugins.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/release-module-doc.mdx */ -/*! ./create-element */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/publish-emo.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-import.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/in-depth-about-dev-command.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/getting-started.mdx */ +/*! lodash-es */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-polyfill.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/basic.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/register-esbuild-plugin.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/plugins.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-import.mdx */ +/*! react-dom */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-import.mdx */ +/*! is-alphanumerical */ /*! react */ -/*! ./Transition */ +/*! ./case-sensitive-transform */ -/*! ./App */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-config.mdx */ /*! react/jsx-runtime */ +/*! @theme-assets/wrapped */ + /*! react-helmet-async */ -/*! virtual-search-index-hash */ +/*! virtual-site-data */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/release-module-doc.mdx */ +/*! @rspress/runtime */ -/*! ./lang/css */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/storybook.mdx */ -/*! react-dom/client */ +/*! prismjs/components/prism-core */ -/*! @babel/runtime/helpers/defineProperty */ +/*! ./lang/markup */ -/*! ./schema */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/basic.mdx */ -/*! ./lang/javascript */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-preset.mdx */ -/*! ./util/create */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/welcome.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-preset.mdx */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/why-module-engineering-solution.md */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/index.md */ +/*! react-fast-compare */ -/*! lodash-es */ +/*! ./util/types */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-build.md */ +/*! ./normalize */ -/*! core-js/modules/web.url-search-params.has.js */ +/*! virtual-search-hooks */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/welcome.md */ +/*! html-tags */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/build-umd.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-storybook.mdx */ +/*! @theme */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/publish-emo.mdx */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/build-umd.mdx */ + +/*! property-information/html */ /*! react/jsx-runtime */ -/*! ./schema */ +/*! ./utils/reflow */ -/*! ./hasClass */ +/*! ./lang/clike */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/publish-emo.mdx */ +/*! @theme-assets/gitlab */ -/*! @theme-assets/wrapped */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/plugins.md */ -/*! @babel/runtime/helpers/toConsumableArray */ +/*! core-js/modules/esnext.iterator.constructor.js */ -/*! ./factory */ +/*! react/jsx-runtime */ -/*! react-syntax-highlighter/dist/esm/languages/prism/bash */ +/*! refractor/lang/less.js */ -/*! is-decimal */ +/*! toggle-selection */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-preset.mdx */ -/*! react */ +/*! @rspress/runtime */ -/*! react/jsx-runtime */ +/*! react-syntax-highlighter/dist/esm/languages/prism/bash */ -/*! react/jsx-runtime */ +/*! ./lib/util/merge */ + +/*! hastscript */ /*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-banner.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-micro-generator.md */ -/*! ./lib/xlink */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/plugin-object.mdx */ -/*! virtual-search-hooks */ +/*! react/jsx-runtime */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/index.md */ + +/*! ./info */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/use-tailwindcss.mdx */ -/*! virtual-routes */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-preset.mdx */ -/*! html-tags */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/build-umd.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/welcome.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-exception.mdx */ +/*! @rspress/shared */ -/*! @theme */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/publish-your-project.mdx */ /*! ./util/create */ -/*! virtual-site-data */ - -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/publish-your-project.mdx */ - -/*! hast-util-parse-selector */ +/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ -/*! ./utils/reflow */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/index.md */ /*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/plugin-api/plugin-hooks.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/why-module-engineering-solution.md */ -/*! core-js/modules/esnext.async-iterator.map.js */ +/*! @rspress/shared */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/overview.md */ -/*! @theme-assets/gitlab */ +/*! ./types */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-micro-generator.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/modify-output-product.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/plugin-object.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/modify-output-product.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/test.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-storybook.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-micro-generator.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/plugin-object.mdx */ +/*! is-html */ /*! react/jsx-runtime */ -/*! character-entities-legacy */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/release-module-doc.mdx */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/index.md */ -/*! virtual-routes */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/build-umd.mdx */ +/*! @theme-assets/header */ -/*! ./lib/xml */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/dev.md */ -/*! shallowequal */ +/*! @babel/runtime/helpers/defineProperty */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/build.mdx */ +/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/modify-output-product.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-test.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/copy.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-exception.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-preset.mdx */ +/*! is-alphabetical */ -/*! @rspress/runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/components.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/intro/why-module-engineering-solution.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/components.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/overview.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/testing.md */ -/*! ./config */ +/*! ./typescript.js */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/use-tailwindcss.mdx */ -/*! prop-types */ +/*! @mdx-js/react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-preset.mdx */ +/*! @rspress/runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/index.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/getting-started.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/modify-output-product.md */ +/*! ./lib/html */ -/*! react/jsx-runtime */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/publish-your-project.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/dev.md */ +/*! @theme-assets/menu */ -/*! react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/plugin-api/plugin-hooks.md */ -/*! ./lib/aria */ +/*! core-js/modules/esnext.async-iterator.find.js */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-micro-generator.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/index.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-babel.mdx */ +/*! property-information/normalize */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/use-tailwindcss.mdx */ +/*! @theme-assets/down */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-build.md */ +/*! core-js/modules/web.url-search-params.delete.js */ -/*! @rspress/runtime */ +/*! react */ /*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/best-practices/components.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/external-dependency.mdx */ -/*! invariant */ +/*! virtual-site-data */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/best-practices/components.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/external-dependency.mdx */ -/*! @rspress/core/theme */ +/*! @rspress/shared */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-dev-command.md */ +/*! lodash-es */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/register-esbuild-plugin.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/plugins.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/external-dependency.mdx */ +/*! @babel/runtime/helpers/extends */ -/*! is-html */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-import.mdx */ + +/*! ./checkForListedLanguage */ + +/*! react/jsx-runtime */ + +/*! @theme-assets/translator */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/test.mdx */ -/*! @theme-assets/header */ +/*! @rspress/runtime */ -/*! @babel/runtime/helpers/esm/extends */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-build-other.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/external-dependency.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-config.mdx */ -/*! @rspress/theme-default */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/before-getting-started.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-test.mdx */ +/*! lodash-es */ -/*! ./util/case-insensitive-transform */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-polyfill.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-config.mdx */ +/*! ./bundle */ -/*! ./decode-entity */ +/*! Bundled license information: -/*! comma-separated-tokens */ +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) +*/ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/use-module-doc.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/plugin-object.mdx */ +/*! @theme-assets/loading */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-other.mdx */ +/*! react */ -/*! @mdx-js/react */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/asset.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/before-getting-started.md */ +/*! react-router-dom */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/plugins.md */ +/*! virtual-site-data */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/test.mdx */ +/*! react */ -/*! @rspress/runtime */ +/*! ./lib/ReactPropTypesSecret */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-banner.mdx */ +/*! ./util/create */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/overview.md */ +/*! react-router-dom */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/setup-function.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/index.md */ -/*! @theme-assets/menu */ +/*! refractor/lang/css.js */ -/*! react-helmet-async */ +/*! @babel/runtime/helpers/objectWithoutProperties */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/publish-emo.mdx */ +/*! react/jsx-runtime */ -/*! @theme-assets/down */ +/*! medium-zoom */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/plugins.md */ +/*! property-information/find */ -/*! virtual-site-data */ +/*! @theme-assets/arrow-down */ + +/*! xtend */ + +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-import.mdx */ /*! @rspress/runtime */ -/*! react/jsx-runtime */ +/*! @rspress/runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/index.md */ +/*! lodash-es */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-polyfill.mdx */ +/*! @theme-assets/close */ -/*! react-dom */ +/*! react-syntax-highlighter/dist/esm/languages/prism/json */ -/*! prismjs/components/prism-core */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/publish-emo.mdx */ -/*! lodash-es */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/in-depth-about-build.md */ -/*! is-alphanumerical */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-config.mdx */ -/*! ./case-sensitive-transform */ +/*! react/jsx-runtime */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/getting-started.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/storybook.mdx */ -/*! ./lang/markup */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/advance/asset.mdx */ -/*! react-syntax-highlighter/dist/esm/languages/prism/json */ +/*! virtual-global-components */ -/*! react/jsx-runtime */ +/*! ./defined-info */ -/*! @theme-assets/translator */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-storybook.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-babel.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-storybook.mdx */ -/*! lodash-es */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-module-doc.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-node-polyfill.mdx */ +/*! ../../normalize */ -/*! ./bundle */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/plugin-api/plugin-hooks.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-banner.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/welcome.md */ -/*! Bundled license information: +/*! is-hexadecimal */ -lodash-es/lodash.js: - (** - * @license - * Lodash (Custom Build) - * Build: `lodash modularize exports="es" -o ./` - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - *) -*/ +/*! ./factoryWithThrowingShims */ -/*! @theme-assets/loading */ +/*! react */ -/*! react-fast-compare */ +/*! @rspress/runtime */ -/*! ./lang/clike */ +/*! react */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/use-module-doc.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/external-dependency.mdx */ -/*! ./util/types */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/faq-build-product.mdx */ -/*! core-js/modules/esnext.iterator.constructor.js */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/guide/getting-started.mdx */ -/*! ./normalize */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-config.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/intro/welcome.md */ +/*! htmr */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/storybook.mdx */ +/*! character-reference-invalid */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-banner.mdx */ -/*! ./utils/reflow */ +/*! @theme */ /*! react-syntax-highlighter/dist/esm/languages/prism/tsx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/api/config/build-config.mdx */ - -/*! react/jsx-runtime */ - -/*! property-information/html */ +/*! react */ -/*! hastscript */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-import.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/faq/build.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-config.mdx */ +/*! ./utils */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/basic/modify-output-product.md */ -/*! @theme-assets/arrow-down */ +/*! react-dom */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/build-preset.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-vue.mdx */ -/*! lodash-es */ +/*! space-separated-tokens */ -/*! @theme-assets/close */ +/*! virtual-global-styles */ -/*! refractor/lang/less.js */ +/*! @theme-assets/moon */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-import.mdx */ +/*! refractor/lang/tsx.js */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-node-polyfill.mdx */ +/*! @theme-assets/success */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/components/faq-storybook.mdx */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/dev.md */ -/*! toggle-selection */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/plugins/official-list/plugin-node-polyfill.mdx */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/official-list/plugin-vue.mdx */ +/*! parse-entities */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/plugins/guide/getting-started.mdx */ +/*! react/jsx-runtime */ -/*! @rspress/shared */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/components/register-esbuild-plugin.mdx */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/faq/storybook.mdx */ -/*! ./lib/util/merge */ +/*! react/jsx-runtime */ -/*! ./MediumZoom.css */ +/*! @theme-assets/github */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/api/config/dev.md */ +/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/copy.md */ + +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */ + +/*! @theme-assets/sun */ /*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/en/guide/basic/command-preview.md */ -/*! /home/runner/work/modern.js/modern.js/packages/document/module-doc/docs/zh/guide/advance/copy.md */ \ No newline at end of file +/*! react */ + +/*! react-dom */ + +/*! core-js/modules/esnext.iterator.map.js */ + +/*! @theme-assets/small-menu */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/333.7fcb1a81.js b/modern-js/module-tools/static/js/333.7fcb1a81.js deleted file mode 100644 index 68b71d41e5..0000000000 --- a/modern-js/module-tools/static/js/333.7fcb1a81.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 333.7fcb1a81.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["333"],{95929:function(e,t,n){"use strict";n.d(t,{V:function(){return h}});var i=n("39980"),r=n("2363"),o=n("8319"),a=n("11207"),l=n("13328"),s=n("92688"),d=n("51812");let{routes:c}=n("99593"),u=(0,r.memo)(function(e){let t=e.el;return l.Z?.themeConfig?.enableContentAnimation&&(t=(0,d.n_)(e.el)),t},(e,t)=>e.el===t.el),h=({fallback:e=(0,i.jsx)(i.Fragment,{})})=>{let{pathname:t}=(0,o.TH)(),n=(0,a.fp)(c,(0,s.Tm)(t));if(!n)return(0,i.jsx)("div",{});let l=n[0].route.element;return(0,i.jsx)(r.Suspense,{fallback:e,children:(0,i.jsx)(u,{el:l})})}},40741:function(e,t,n){"use strict";n.d(t,{r:function(){return o}});var i=n("39980"),r=n("2363");function o(e){let{children:t}=e,[n,o]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{o(!0)},[]),n)?(0,i.jsx)(i.Fragment,{children:t}):null}},51812:function(e,t,n){"use strict";n.d(t,{Jr:function(){return s},Ni:function(){return a},R0:function(){return o},Vi:function(){return l},aw:function(){return d},n_:function(){return c}});var i=n("2363"),r=n("61850");let o=(0,i.createContext)({}),a=(0,i.createContext)({});function l(){return(0,i.useContext)(o).data}function s(){return(0,i.useContext)(o).data.page.lang||""}function d(){return(0,i.useContext)(o).data.page.version||""}function c(e){let[t,n]=(0,i.useState)(e);return(0,i.useLayoutEffect)(()=>{document.startViewTransition&&t!==e?document.startViewTransition(()=>{(0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent"))}):((0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent")))},[e]),t}},92688:function(e,t,n){"use strict";n.d(t,{AP:function(){return d},E9:function(){return l},Tm:function(){return o},i6:function(){return c},pJ:function(){return a},pV:function(){return s}});var i=n("13328"),r=n("72855");function o(e){return decodeURIComponent(e).replace(/\.html$/,"").replace(/\/index$/,"/")}function a(e="/"){return(0,r.pJ)(e,i.Z.base)}function l(e){return(0,r.E9)(e,i.Z.base)}function s(e,t){return a(d((0,r.lm)(e)))===a(d((0,r.lm)(t)))}function d(e){let t=!!i.Z?.route?.cleanUrls;return(0,r.yc)(e,t)}function c(e){return!(0,r.yv)()||(0,r.xf)(e)||(0,r.pZ)(e)?e:a(e)}},12555:function(e,t,n){"use strict";n.d(t,{Qp:function(){return v},tP:function(){return b}});var i=!1;if("undefined"!=typeof window){var r={get passive(){i=!0;return}};window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),a=[],l=!1,s=-1,d=void 0,c=void 0,u=void 0,h=function(e){return a.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))||!1})},p=function(e){var t=e||window.event;return!!h(t.target)||!!(t.touches.length>1)||(t.preventDefault&&t.preventDefault(),!1)},m=function(e){if(void 0===u){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);u=document.body.style.paddingRight,document.body.style.paddingRight=i+n+"px"}}void 0===d&&(d=document.body.style.overflow,document.body.style.overflow="hidden")},f=function(){void 0!==u&&(document.body.style.paddingRight=u,u=void 0),void 0!==d&&(document.body.style.overflow=d,d=void 0)},g=function(){if(void 0!==c){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=c.position,document.body.style.top=c.top,document.body.style.left=c.left,window.scrollTo(t,e),c=void 0}},x=function(e,t){var n,i=e.targetTouches[0].clientY-s;if(h(e.target))return!1;if(t&&0===t.scrollTop&&i>0)return p(e);return(n=t)&&n.scrollHeight-n.scrollTop<=n.clientHeight&&i<0?p(e):(e.stopPropagation(),!0)},v=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}!a.some(function(t){return t.targetElement===e})&&(a=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t=i&&(document.body.style.top=-(t+e))})},300)}}):m(t),o&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(s=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&x(t,e)},!l&&(document.addEventListener("touchmove",p,i?{passive:!1}:void 0),l=!0)))},b=function(){o&&(a.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),l&&(document.removeEventListener("touchmove",p,i?{passive:!1}:void 0),l=!1),s=-1),o?g():f(),a=[]}},429:function(e,t){"use strict";t.parse=function(e){for(var t,n=[],i=String(e||""),r=i.indexOf(","),o=0,a=!1;!a;)-1===r&&(r=i.length,a=!0),((t=i.slice(o,r).trim())||!a)&&n.push(t),o=r+1,r=i.indexOf(",",o);return n};function n(e,t){var n=t||{},i=!1===n.padLeft?"":" ",r=n.padRight?" ":"";return""===e[e.length-1]&&(e=e.concat("")),e.join(r+","+i).trim()}},79522:function(e,t,n){"use strict";var i=n("48456"),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,o,a,l,s,d,c,u,h=!1;!t&&(t={}),a=t.debug||!1;try{if(s=i(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(n){if(n.stopPropagation(),t.format){if(n.preventDefault(),void 0===n.clipboardData){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e)}t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");h=!0}catch(i){a&&console.error("unable to copy using execCommand: ",i),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(i){;a&&console.error("unable to copy using clipboardData: ",i),a&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",o=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C",l=n.replace(/#{\s*key\s*}/g,o),window.prompt(l,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}},34532:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var i=n("37302");function r(e,t){e.classList?e.classList.add(t):!(0,i.Z)(e,t)&&("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}},37302:function(e,t,n){"use strict";function i(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}n.d(t,{Z:function(){return i}})},72523:function(e,t,n){"use strict";function i(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function r(e,t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=i(e.className,t):e.setAttribute("class",i(e.className&&e.className.baseVal||"",t))}n.d(t,{Z:function(){return r}})},85653:function(e,t){"use strict";var n,i,r;let o;n="FlexSearch",i=function e(t){let n;function i(e,t){let n=t?t.id:e&&e.id;this.id=n||0===n?n:z++,this.init(e,t),l(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)}),l(this,"length",function(){return this.index.length})}function r(e,t,n,i){return this.u!==this.g&&(this.o=this.o.concat(n),this.u++,i&&this.o.length>=i&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(t,this.o),this.F&&this.F(this.o))),this}function o(e,t){let n=e.length,i=y(t),r=[];for(let o=0,a=0;o=a&&((e=(e=e[l-(r+.5>>0)])[n]||(e[n]=[]))[e.length]=i),r)}function u(e,t){if(e){let n=Object.keys(e);for(let i=0,r=n.length;i(e=e.length-t.length)?1:e?-1:0}function m(e,t){return e=e[n],e<(t=t[n])?-1:e>t?1:0}function f(e,t){let i=n.length;for(let r=0;rt?1:0}function g(e,t,n){return e?{page:e,next:t?""+t:null,result:n}:n}function x(e,t,n,i,r,o,a){let l,s=[];if(!0===n){n="0";var d=""}else d=n&&n.split(":");let c=e.length;if(1a&&(d=0),(l=(d=d||0)+t)=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:e,content:t}),this.c[a]=""+this.C,n&&n(),this;if(!r){if(this.async&&"function"!=typeof importScripts){let r=this;return(a=new Promise(function(n){setTimeout(function(){r.add(e,t,null,i,!0),r=null,n()})}),n)?(a.then(n),this):a}if(n)return this.add(e,t,null,i,!0),n(),this}if(!(t=this.encode(t)).length)return this;r=y(n=this.f)?n(t):t.split(this.split),this.filter&&(r=o(r,this.filter));let p=I();p._ctx=I();let m=r.length,f=this.threshold,g=this.depth,x=this.b,v=this.i,b=this.D;for(let t=0;th;n--)c(v,p,u=l.substring(h,n),e,t,d,f,x-1)}break;default:if(s=c(v,p,l,e,1,d,f,x-1),g&&1=f)for(s=p._ctx[l]||(p._ctx[l]=I()),l=this.h[l]||(this.h[l]=j(x-(f||0))),0>(d=t-g)&&(d=0),(u=t+g+1)>m&&(u=m);dr;n--)i=o[n-1],o[n]=i,t[i]=n;o[r]=e,t[e]=r}}}return t},e}();return i}(function(){let e={},t="undefined"!=typeof Blob&&"undefined"!=typeof URL&&URL.createObjectURL;return function(n,i,r,o,a){return r=t?URL.createObjectURL(new Blob(["("+r.toString()+")()"],{type:"text/javascript"})):n+".min.js",e[n+="-"+i]||(e[n]=[]),e[n][a]=new Worker(r),e[n][a].onmessage=o,e[n][a]}}()),r=this,(o=r.define)&&o.amd?o([],function(){return i}):(o=r.modules)?o[n.toLowerCase()]=i:"object"==typeof t?e.exports=i:r[n]=i},43451:function(e){"use strict";e.exports=function(e,n){for(var i,r,o,a=e||"",l=n||"div",s={},d=0;d-1}var a=["itemScope"];function l(t,n,i,r){void 0===r&&(r=null);var o=i[t],a=i._;return o?e.createElement(o,n,r):a?a(t,n,r):e.createElement(t,n,r)}return function(e,i){if(void 0===i&&(i={}),"string"!=typeof e)throw TypeError("Expected HTML string");var o=document.createElement("div");o.innerHTML=e.trim();var a=Array.from(o.childNodes).map(function(e,o){return function e(i,o,a){var s,d,c,u,h=a.transform||{},p=a.preserveAttributes||[],m=a.dangerouslySetChildren||["style"],f=h._;if(8===i.nodeType)return null;if(3===i.nodeType){var g=i.textContent;return f?f(g):g}for(var x={},v=i.attributes,b=0;b1){var r,a=(r=i[0].trim(),/^-ms-/.test(r)&&(r=r.substr(1)),r.startsWith("--")?r:t(r)),l=(n=i.slice(1).join(":").trim(),/^\d+$/.test(n)?Number(n):n.replace(/'/g,'"'));o[a]=l}}),o);else{var l=d[n],h=""===l||String(l).toLowerCase()===i.toLowerCase();e[a.name]=a.isBoolean?h:l}return e},{})),k=Array.from(i.childNodes).map(function(t,i){return n.indexOf(y)>-1&&3===t.nodeType&&(t.textContent=t.textContent.trim(),""===t.textContent)?null:e(t,o+"."+i,a)}).filter(Boolean);if(m.indexOf(y)>-1){var j=i.innerHTML;return j&&("style"!==y&&"script"!==y&&(j=j.replace(/"/g,""")),w.dangerouslySetInnerHTML={__html:j.trim()}),l(y,w,h)}return l(y,w,h,0===k.length?null:k)}(e,String(o),i)}).filter(Boolean);return 1===a.length?a[0]:a}},"object"==typeof t?e.exports=r(n("2363")):"function"==typeof define&&define.amd?define(["react"],r):(i=i||self).htmr=r(i.React)},24546:function(e){"use strict";e.exports=function(e,t,n,i,r,o,a,l){if(!e){var s;if(void 0===t)s=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,i,r,o,a,l],c=0;(s=Error(t.replace(/%s/g,function(){return d[c++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}}},54761:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},29975:function(e,t,n){"use strict";var i=n("54761"),r=n("67525");e.exports=function(e){return i(e)||r(e)}},67525:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},72201:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},60366:function(e,t){"use strict";var n=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},c=window.Promise||function(e){function t(){}e(t,t)},u=function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,i=function(){var e={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},t=void 0,i=void 0;if(b.container){if(b.container instanceof Object)t=(e=n({},e,b.container)).width-e.left-e.right-2*b.margin,i=e.height-e.top-e.bottom-2*b.margin;else{var a=(r(b.container)?b.container:document.querySelector(b.container)).getBoundingClientRect();e=n({},e,{width:a.width,height:a.height,left:a.left,top:a.top})}}t=t||e.width-2*b.margin,i=i||e.height-2*b.margin;var l=y.zoomedHd||y.original,s=o(l)?t:l.naturalWidth||t,d=o(l)?i:l.naturalHeight||i,c=l.getBoundingClientRect(),u=c.top,h=c.left,p=c.width,m=c.height,f=Math.min(Math.min(Math.max(p,s),t)/p,Math.min(Math.max(m,d),i)/m),g=(-h+(t-p)/2+b.margin+e.left)/f,x=(-u+(i-m)/2+b.margin+e.top)/f,v="scale("+f+") translate3d("+g+"px, "+x+"px, 0)";y.zoomed.style.transform=v,y.zoomedHd&&(y.zoomedHd.style.transform=v)};return new c(function(e){if(t&&-1===f.indexOf(t)){e(k);return}if(y.zoomed){e(k);return}if(t)y.original=t;else if(f.length>0){var n=f;y.original=n[0]}else{e(k);return}if(y.original.dispatchEvent(d("medium-zoom:open",{detail:{zoom:k}})),v=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,x=!0,y.zoomed=s(y.original),document.body.appendChild(w),b.template){var o=r(b.template)?b.template:document.querySelector(b.template);y.template=document.createElement("div"),y.template.appendChild(o.content.cloneNode(!0)),document.body.appendChild(y.template)}if(y.original.parentElement&&"PICTURE"===y.original.parentElement.tagName&&y.original.currentSrc&&(y.zoomed.src=y.original.currentSrc),document.body.appendChild(y.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),y.original.classList.add("medium-zoom-image--hidden"),y.zoomed.classList.add("medium-zoom-image--opened"),y.zoomed.addEventListener("click",p),y.zoomed.addEventListener("transitionend",function t(){x=!1,y.zoomed.removeEventListener("transitionend",t),y.original.dispatchEvent(d("medium-zoom:opened",{detail:{zoom:k}})),e(k)}),y.original.getAttribute("data-zoom-src")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("srcset"),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading"),y.zoomedHd.src=y.zoomed.getAttribute("data-zoom-src"),y.zoomedHd.onerror=function(){clearInterval(a),console.warn("Unable to reach the zoom image target "+y.zoomedHd.src),y.zoomedHd=null,i()};var a=setInterval(function(){y.zoomedHd.complete&&(clearInterval(a),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",p),document.body.appendChild(y.zoomedHd),i())},10)}else if(y.original.hasAttribute("srcset")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading");var l=y.zoomedHd.addEventListener("load",function(){y.zoomedHd.removeEventListener("load",l),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",p),document.body.appendChild(y.zoomedHd),i()})}else i()})},p=function(){return new c(function(e){if(x||!y.original){e(k);return}x=!0,document.body.classList.remove("medium-zoom--opened"),y.zoomed.style.transform="",y.zoomedHd&&(y.zoomedHd.style.transform=""),y.template&&(y.template.style.transition="opacity 150ms",y.template.style.opacity=0),y.original.dispatchEvent(d("medium-zoom:close",{detail:{zoom:k}})),y.zoomed.addEventListener("transitionend",function t(){y.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(y.zoomed),y.zoomedHd&&document.body.removeChild(y.zoomedHd),document.body.removeChild(w),y.zoomed.classList.remove("medium-zoom-image--opened"),y.template&&document.body.removeChild(y.template),x=!1,y.zoomed.removeEventListener("transitionend",t),y.original.dispatchEvent(d("medium-zoom:closed",{detail:{zoom:k}})),y.original=null,y.zoomed=null,y.zoomedHd=null,y.template=null,e(k)})})},m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target;return y.original?p():h({target:t})},f=[],g=[],x=!1,v=0,b=i,y={original:null,zoomed:null,zoomedHd:null,template:null};"[object Object]"===Object.prototype.toString.call(t)?b=t:(t||"string"==typeof t)&&u(t);var w=l((b=n({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},b)).background);document.addEventListener("click",function(e){var t=e.target;if(t===w){p();return}-1!==f.indexOf(t)&&m({target:t})}),document.addEventListener("keyup",function(e){var t=e.key||e.keyCode;("Escape"===t||"Esc"===t||27===t)&&p()}),document.addEventListener("scroll",function(){if(!x&&y.original){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(v-e)>b.scrollOffset&&setTimeout(p,150)}}),window.addEventListener("resize",p);var k={open:h,close:p,toggle:m,update:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.background&&(w.style.background=e.background),e.container&&e.container instanceof Object&&(e.container=n({},b.container,e.container)),e.template){var t=r(e.template)?e.template:document.querySelector(e.template);e.template=t}return b=n({},b,e),f.forEach(function(e){e.dispatchEvent(d("medium-zoom:update",{detail:{zoom:k}}))}),k},clone:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(n({},b,t))},attach:u,detach:function(){for(var e=arguments.length,t=Array(e),n=0;n0?t.reduce(function(e,t){return[].concat(e,a(t))},[]):f;return i.forEach(function(e){e.classList.remove("medium-zoom-image"),e.dispatchEvent(d("medium-zoom:detach",{detail:{zoom:k}}))}),f=f.filter(function(e){return -1===i.indexOf(e)}),k},on:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(i){i.addEventListener("medium-zoom:"+e,t,n)}),g.push({type:"medium-zoom:"+e,listener:t,options:n}),k},off:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(i){i.removeEventListener("medium-zoom:"+e,t,n)}),g=g.filter(function(n){return!(n.type==="medium-zoom:"+e&&n.listener.toString()===t.toString())}),k},getOptions:function(){return b},getImages:function(){return f},getZoomedImage:function(){return y.original}};return k}},47841:function(e,t){var n,i;n=this,i=function(){var e,t,n,i={};i.version="0.2.0";var r=i.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
                  '};function o(e,t,n){return en?n:e}function a(e){return(-1+e)*100}i.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},i.status=null,i.set=function(e){var t=i.isStarted();e=o(e,r.minimum,1),i.status=1===e?null:e;var n=i.render(!t),a=n.querySelector(r.barSelector),d=r.speed,c=r.easing;return n.offsetWidth,l(function(t){""===r.positionUsing&&(r.positionUsing=i.getPositioningCSS()),s(a,function(e,t,n){var i;if("translate3d"===r.positionUsing)i={transform:"translate3d("+(-1+e)*100+"%,0,0)"};else if("translate"===r.positionUsing)i={transform:"translate("+(-1+e)*100+"%,0)"};else i={"margin-left":(-1+e)*100+"%"};return i.transition="all "+t+"ms "+n,i}(e,d,c)),1===e?(s(n,{transition:"none",opacity:1}),n.offsetWidth,setTimeout(function(){s(n,{transition:"all "+d+"ms linear",opacity:0}),setTimeout(function(){i.remove(),t()},d)},d)):setTimeout(t,d)}),this},i.isStarted=function(){return"number"==typeof i.status},i.start=function(){!i.status&&i.set(0);var e=function(){setTimeout(function(){i.status&&(i.trickle(),e())},r.trickleSpeed)};return r.trickle&&e(),this},i.done=function(e){return e||i.status?i.inc(.3+.5*Math.random()).set(1):this},i.inc=function(e){var t=i.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),i.set(t)):i.start()},i.trickle=function(){return i.inc(Math.random()*r.trickleRate)},e=0,t=0,i.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&i.start(),e++,t++,n.always(function(){0==--t?(e=0,i.done()):i.set((e-t)/e)}),this):this},i.render=function(e){if(i.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var n,o=t.querySelector(r.barSelector),a=e?"-100":function(e){return(-1+e)*100}(i.status||0),l=document.querySelector(r.parent);return s(o,{transition:"all 0 linear",transform:"translate3d("+a+"%,0,0)"}),!r.showSpinner&&(n=t.querySelector(r.spinnerSelector))&&p(n),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},i.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},i.isRendered=function(){return!!document.getElementById("nprogress")},i.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective" in e?"translate3d":t+"Transform" in e?"translate":"margin"};var l=(n=[],function(e){n.push(e),1==n.length&&!function e(){var t=n.shift();t&&t(e)}()}),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n,i,r){i=function(n){return t[n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var i,r=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((i=e[r]+o)in n)return i;return t}(n))}(i),n.style[i]=r}return function(e,t){var i,r,o=arguments;if(2==o.length)for(i in t)void 0!==(r=t[i])&&t.hasOwnProperty(i)&&n(e,i,r);else n(e,o[1],o[2])}}();function d(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=h(e),i=n+t;!d(n,t)&&(e.className=i.substring(1))}function u(e,t){var n,i=h(e);d(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return i},"function"==typeof define&&define.amd?define(i):"object"==typeof t?e.exports=i():n.NProgress=i()},55144:function(e){"use strict";var t;e.exports=function(e){var n,i="&"+e+";";return(t=t||document.createElement("i")).innerHTML=i,(59!==(n=t.textContent).charCodeAt(n.length-1)||"semi"===e)&&n!==i&&n}},82668:function(e,t,n){"use strict";var i=n("10924"),r=n("33222"),o=n("67525"),a=n("72201"),l=n("29975"),s=n("55144");e.exports=function(e,t){var n,o,a={};for(o in!t&&(t={}),h)n=t[o],a[o]=null==n?h[o]:n;return(a.position.indent||a.position.start)&&(a.indent=a.position.indent||[],a.position=a.position.start),function(e,t){var n,o,a,h,b,y,w,k,j,I,P,E,S,C,z,N,_,A,T,O=t.additional,M=t.nonTerminated,L=t.text,D=t.reference,R=t.warning,B=t.textContext,$=t.referenceContext,F=t.warningContext,H=t.position,Z=t.indent||[],W=e.length,U=0,q=-1,V=H.column||1,G=H.line||1,Y="",Q=[];for("string"==typeof O&&(O=O.charCodeAt(0)),N=K(),k=R?function(e,t){var n=K();n.column+=t,n.offset+=t,R.call(F,v[e],n,e)}:u,U--,W++;++U=55296&&e<=57343||e>1114111}(y=parseInt(h,g[C]))?(k(7,A),y=c(65533)):y in r?(k(6,A),y=r[y]):(I="",function(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(65535&e)==65535||(65535&e)==65534}(y)&&k(6,A),y>65535&&(y-=65536,I+=c(y>>>10|55296),y=56320|1023&y),y=I+c(y))):C!==p&&k(4,A);y?(J(),N=K(),U=T-1,V+=T-S+1,Q.push(y),_=K(),_.offset++,D&&D.call($,y,{start:N,end:_},e.slice(S-1,T)),N=_):(h=e.slice(S-1,T),Y+=h,V+=h.length,U=T-1)}else 10===b&&(G++,q++,V=0),b==b?(Y+=c(b),V++):J();return Q.join("");function K(){return{line:G,column:V,offset:U+(H.offset||0)}}function J(){Y&&(Q.push(Y),L&&L.call(B,Y,{start:N,end:K()}),Y="")}}(e,a)};var d={}.hasOwnProperty,c=String.fromCharCode,u=Function.prototype,h={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",f="decimal",g={};g[m]=16,g[f]=10;var x={};x[p]=l,x[f]=o,x[m]=a;var v={};v[1]="Named character references must be terminated by a semicolon",v[2]="Numeric character references must be terminated by a semicolon",v[3]="Named character references cannot be empty",v[4]="Numeric character references cannot be empty",v[5]="Named character references must be known",v[6]="Numeric character references cannot be disallowed",v[7]="Numeric character references cannot be outside the permissible Unicode range"},3921:function(e,t,n){var i=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach));k+=w.value.length,w=w.next){var j,I=w.value;if(n.length>t.length)return;if(!(I instanceof o)){var P=1;if(x){if(!(j=a(y,k,t,g))||j.index>=t.length)break;var E=j.index,S=j.index+j[0].length,C=k;for(C+=w.value.length;E>=C;)C+=(w=w.next).value.length;if(C-=w.value.length,k=C,w.value instanceof o)continue;for(var z=w;z!==n.tail&&(Cc.reach&&(c.reach=T);var O=w.prev;if(_&&(O=s(n,O,_),k+=_.length),function(e,t,n){for(var i=t.next,r=0;r1){var M={cause:u+","+p,reach:T};e(t,n,i,w.prev,k,M),c&&M.reach>c.reach&&(c.reach=M.reach)}}}}}}(e,d,t,d.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(d)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,o=0;i=n[o++];)i(t)}},Token:o};function o(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function a(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var o=r[1].length;r.index+=o,r[0]=r[0].slice(o)}return r}e.Prism=r,o.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach(function(t){i+=e(t,n)}),i}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},a=t.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(o.classes,a):o.classes.push(a)),r.hooks.run("wrap",o);var l="";for(var s in o.attributes)l+=" "+s+'="'+(o.attributes[s]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+""};function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}if(!e.document)return e.addEventListener?(!r.disableWorkerMessageHandler&&e.addEventListener("message",function(t){var n=JSON.parse(t.data),i=n.language,o=n.code,a=n.immediateClose;e.postMessage(r.highlight(o,r.languages[i],i)),a&&e.close()},!1),r):r;var d=r.util.currentScript();function c(){!r.manual&&r.highlightAll()}if(d&&(r.filename=d.src,d.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var u=document.readyState;"loading"===u||"interactive"===u&&d&&d.defer?document.addEventListener("DOMContentLoaded",c):window.requestAnimationFrame?window.requestAnimationFrame(c):window.setTimeout(c,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=i),void 0!==n.g&&(n.g.Prism=i)},52504:function(e,t,n){"use strict";var i=n("62265");function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,a){if(a!==i){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},23698:function(e,t,n){e.exports=n("52504")()},62265:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},62616:function(e,t,n){"use strict";var i=n("22275"),r=n("6492"),o=n("23811"),a="data";e.exports=function(e,t){var n=i(t),h=t,p=o;return n in e.normal?e.property[e.normal[n]]:(n.length>4&&n.slice(0,4)===a&&l.test(t)&&("-"===t.charAt(4)?h=function(e){var t=e.slice(5).replace(s,u);return a+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);return s.test(t)?e:("-"!==(t=t.replace(d,c)).charAt(0)&&(t="-"+t),a+t)}(t),p=r),new p(h,t))};var l=/^data[-\w.:]+$/i,s=/-[a-z]/g,d=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function u(e){return e.charAt(1).toUpperCase()}},46093:function(e,t,n){"use strict";var i=n("96399"),r=n("59283"),o=n("87430"),a=n("62376"),l=n("35531"),s=n("51581");e.exports=i([o,r,a,l,s])},35531:function(e,t,n){"use strict";var i=n("13077"),r=n("79469"),o=i.booleanish,a=i.number,l=i.spaceSeparated;e.exports=r({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:o,ariaAutoComplete:null,ariaBusy:o,ariaChecked:o,ariaColCount:a,ariaColIndex:a,ariaColSpan:a,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:o,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:o,ariaFlowTo:l,ariaGrabbed:o,ariaHasPopup:null,ariaHidden:o,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:a,ariaLive:null,ariaModal:o,ariaMultiLine:o,ariaMultiSelectable:o,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:a,ariaPressed:o,ariaReadOnly:o,ariaRelevant:null,ariaRequired:o,ariaRoleDescription:l,ariaRowCount:a,ariaRowIndex:a,ariaRowSpan:a,ariaSelected:o,ariaSetSize:a,ariaSort:null,ariaValueMax:a,ariaValueMin:a,ariaValueNow:a,ariaValueText:null,role:null}})},51581:function(e,t,n){"use strict";var i=n("13077"),r=n("79469"),o=n("12561"),a=i.boolean,l=i.overloadedBoolean,s=i.booleanish,d=i.number,c=i.spaceSeparated,u=i.commaSeparated;e.exports=r({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:o,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:u,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:a,allowPaymentRequest:a,allowUserMedia:a,alt:null,as:null,async:a,autoCapitalize:null,autoComplete:c,autoFocus:a,autoPlay:a,capture:a,charSet:null,checked:a,cite:null,className:c,cols:d,colSpan:null,content:null,contentEditable:s,controls:a,controlsList:c,coords:d|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:a,defer:a,dir:null,dirName:null,disabled:a,download:l,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:a,formTarget:null,headers:c,height:d,hidden:a,high:d,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:u,inputMode:null,integrity:null,is:null,isMap:a,itemId:null,itemProp:c,itemRef:c,itemScope:a,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:a,low:d,manifest:null,max:null,maxLength:d,media:null,method:null,min:null,minLength:d,multiple:a,muted:a,name:null,nonce:null,noModule:a,noValidate:a,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:a,optimum:d,pattern:null,ping:c,placeholder:null,playsInline:a,poster:null,preload:null,readOnly:a,referrerPolicy:null,rel:c,required:a,reversed:a,rows:d,rowSpan:d,sandbox:c,scope:null,scoped:a,seamless:a,selected:a,shape:null,size:d,sizes:null,slot:null,span:d,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:u,start:d,step:null,style:null,tabIndex:d,target:null,title:null,translate:null,type:null,typeMustMatch:a,useMap:null,value:s,width:d,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:d,borderColor:null,bottomMargin:d,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:a,declare:a,event:null,face:null,frame:null,frameBorder:null,hSpace:d,leftMargin:d,link:null,longDesc:null,lowSrc:null,marginHeight:d,marginWidth:d,noResize:a,noHref:a,noShade:a,noWrap:a,object:null,profile:null,prompt:null,rev:null,rightMargin:d,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:d,valueType:null,version:null,vAlign:null,vLink:null,vSpace:d,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:a,disableRemotePlayback:a,prefix:null,property:null,results:d,security:null,unselectable:null}})},12561:function(e,t,n){"use strict";var i=n("56073");e.exports=function(e,t){return i(e,t.toLowerCase())}},56073:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},79469:function(e,t,n){"use strict";var i=n("22275"),r=n("23673"),o=n("6492");e.exports=function(e){var t,n,a=e.space,l=e.mustUseProperty||[],s=e.attributes||{},d=e.properties,c=e.transform,u={},h={};for(t in d)n=new o(t,c(s,t),d[t],a),-1!==l.indexOf(t)&&(n.mustUseProperty=!0),u[t]=n,h[i(t)]=t,h[i(n.attribute)]=t;return new r(u,h,a)}},6492:function(e,t,n){"use strict";var i=n("23811"),r=n("13077");e.exports=l,l.prototype=new i,l.prototype.defined=!0;var o=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],a=o.length;function l(e,t,n,l){var s,d=-1;for(function(e,t,n){n&&(e[t]=n)}(this,"space",l),i.call(this,e,t);++d=0||(r[n]=e[n]);return r}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},x={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},b={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},y=Object.keys(g).map(function(e){return g[e]}),w={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(w).reduce(function(e,t){return e[w[t]]=t,e},{}),j=function(e,t){for(var n=e.length-1;n>=0;n-=1){var i=e[n];if(Object.prototype.hasOwnProperty.call(i,t))return i[t]}return null},I=function(e){var t=j(e,g.TITLE),n=j(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,function(){return t});var i=j(e,"defaultTitle");return t||i||void 0},P=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return h({},e,t)},{})},E=function(e,t,n){var i={};return n.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,n){var r={};n.filter(function(e){for(var n,o=Object.keys(e),a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")},T=function(e){return Object.keys(e).reduce(function(t,n){var i=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+i:i},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,n){return t[w[n]||n]=e[n],t},t)},M=function(e,t){return t.map(function(t,n){var r,o=((r={key:n})["data-rh"]=!0,r);return Object.keys(t).forEach(function(e){var n=w[e]||e;"innerHTML"===n||"cssText"===n?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[n]=t[e]}),i.createElement(e,o)})},L=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){var e,n,r,o;return n=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,o=O(n,r),[i.createElement(g.TITLE,o,e)]},toString:function(){var i,r,o,a,l,s;return i=e,r=t.title,o=t.titleAttributes,a=n,l=T(o),s=C(r),l?"<"+i+' data-rh="true" '+l+">"+A(s,a)+"":"<"+i+' data-rh="true">'+A(s,a)+""}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(t)},toString:function(){return T(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){var i,r,o;return i=e,r=t,o=n,r.reduce(function(e,t){var n=Object.keys(t).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,n){var i=void 0===t[n]?n:n+'="'+A(t[n],o)+'"';return e?e+" "+i:i},""),r=t.innerHTML||t.cssText||"",a=-1===_.indexOf(i);return e+"<"+i+' data-rh="true" '+n+(a?"/>":">"+r+"")},"")}}}},D=function(e){var t=e.baseTag,n=e.bodyAttributes,i=e.encode,r=e.htmlAttributes,o=e.noscriptTags,a=e.styleTags,l=e.title,s=e.titleAttributes,d=e.linkTags,c=e.metaTags,u=e.scriptTags,h={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var p,m,f,y,w,k,j,I=(m=(p=e).linkTags,f=p.scriptTags,y=p.encode,w=z(p.metaTags,b),k=z(m,x),j=z(f,v),{priorityMethods:{toComponent:function(){return[].concat(M(g.META,w.priority),M(g.LINK,k.priority),M(g.SCRIPT,j.priority))},toString:function(){return L(g.META,w.priority,y)+" "+L(g.LINK,k.priority,y)+" "+L(g.SCRIPT,j.priority,y)}},metaTags:w.default,linkTags:k.default,scriptTags:j.default});h=I.priorityMethods,d=I.linkTags,c=I.metaTags,u=I.scriptTags}return{priority:h,base:L(g.BASE,t,i),bodyAttributes:L("bodyAttributes",n,i),htmlAttributes:L("htmlAttributes",r,i),link:L(g.LINK,d,i),meta:L(g.META,c,i),noscript:L(g.NOSCRIPT,o,i),script:L(g.SCRIPT,u,i),style:L(g.STYLE,a,i),title:L(g.TITLE,{title:void 0===l?"":l,titleAttributes:s},i)}},R=[],B=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?R:n.instances},add:function(e){(n.canUseDOM?R:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?R:n.instances).indexOf(e);(n.canUseDOM?R:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=D({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},$=i.createContext({}),F=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),H=function(e){function t(n){var i;return(i=e.call(this,n)||this).helmetData=new B(i.props.context,t.canUseDOM),i}return p(t,e),t.prototype.render=function(){return i.createElement($.Provider,{value:this.helmetData.value},this.props.children)},t}(i.Component);H.canUseDOM="undefined"!=typeof document,H.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},H.defaultProps={context:{}},H.displayName="HelmetProvider";var Z=function(e,t){var n,i=document.head||document.querySelector(g.HEAD),r=i.querySelectorAll(e+"[data-rh]"),o=[].slice.call(r),a=[];return t&&t.length&&t.forEach(function(t){var i=document.createElement(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("innerHTML"===r?i.innerHTML=t.innerHTML:"cssText"===r?i.styleSheet?i.styleSheet.cssText=t.cssText:i.appendChild(document.createTextNode(t.cssText)):i.setAttribute(r,void 0===t[r]?"":t[r]));i.setAttribute("data-rh","true"),o.some(function(e,t){return n=t,i.isEqualNode(e)})?o.splice(n,1):a.push(i)}),o.forEach(function(e){return e.parentNode.removeChild(e)}),a.forEach(function(e){return i.appendChild(e)}),{oldTags:o,newTags:a}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var i=n.getAttribute("data-rh"),r=i?i.split(","):[],o=[].concat(r),a=Object.keys(t),l=0;l=0;u-=1)n.removeAttribute(o[u]);r.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==a.join(",")&&n.setAttribute("data-rh",a.join(","))}},U=function(e,t){var n,i,r=e.baseTag,o=e.htmlAttributes,a=e.linkTags,l=e.metaTags,s=e.noscriptTags,d=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,h=e.title,p=e.titleAttributes;W(g.BODY,e.bodyAttributes),W(g.HTML,o),n=h,i=p,void 0!==n&&document.title!==n&&(document.title=C(n)),W(g.TITLE,i);var m={baseTag:Z(g.BASE,r),linkTags:Z(g.LINK,a),metaTags:Z(g.META,l),noscriptTags:Z(g.NOSCRIPT,s),scriptTags:Z(g.SCRIPT,c),styleTags:Z(g.STYLE,u)},f={},x={};Object.keys(m).forEach(function(e){var t=m[e],n=t.newTags,i=t.oldTags;n.length&&(f[e]=n),i.length&&(x[e]=m[e].oldTags)}),t&&t(),d(e,f,x)},q=null,V=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,i=e.arrayTypeChildren;return h({},i,((t={})[n.type]=[].concat(i[n.type]||[],[h({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,i=e.child,r=e.newProps,o=e.newChildProps,a=e.nestedChildren;switch(i.type){case g.TITLE:return h({},r,((t={})[i.type]=a,t.titleAttributes=h({},o),t));case g.BODY:return h({},r,{bodyAttributes:h({},o)});case g.HTML:return h({},r,{htmlAttributes:h({},o)});default:return h({},r,((n={})[i.type]=h({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=h({},t);return Object.keys(e).forEach(function(t){var i;n=h({},n,((i={})[t]=e[t],i))}),n},n.warnOnInvalidChildren=function(e,t){return d()(y.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+y.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),d()(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``} ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,r={};return i.Children.forEach(e,function(e){if(e&&e.props){var i=e.props,o=i.children,a=f(i,G),l=Object.keys(a).reduce(function(e,t){return e[k[t]||t]=a[t],e},{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,o),s){case g.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:l,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:o})}}}),this.mapArrayTypeChildrenToProps(r,t)},n.render=function(){var e=this.props,t=e.children,n=f(e,Y),r=h({},n),o=n.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!o||o instanceof B||(o=new B(o.context,o.instances)),o?i.createElement(V,h({},r,{context:o.value,helmetData:void 0})):i.createElement($.Consumer,null,function(e){return i.createElement(V,h({},r,{context:e}))})},t}(i.Component);Q.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},Q.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},Q.displayName="Helmet"},22897:function(e,t,n){"use strict";t.lazyWithPreload=void 0;var i,r=n("2363");function o(e){var t,n,i=(0,r.lazy)(e),o=(0,r.forwardRef)(function(e,n){var o=(0,r.useRef)(null!=t?t:i);return(0,r.createElement)(o.current,Object.assign(n?{ref:n}:{},e))});return o.preload=function(){return!n&&(n=e().then(function(e){return t=e.default})),n},o}t.lazyWithPreload=o},68965:function(e,t,n){"use strict";function i(e,t){return -1!==e.listLanguages().indexOf(t)}n.d(t,{Z:function(){return i}})},51414:function(e,t,n){"use strict";n.d(t,{ZP:function(){return c}});var i=n("90107"),r=n("26037"),o=n("2363");function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,n,i=e.join(".");if(!s[i]){;s[i]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0}return s[i]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return l(l({},e),n[t])},t)}(u.className,Object.assign({},u.style,void 0===r?{}:r),n)})}else v=l(l({},u),{},{className:u.className.join(" ")});var j=b(t.children);return o.createElement(p,(0,i.Z)({key:d},v),j)}}},40458:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var i=n("95775"),r=n("29618"),o=n("26037"),a=n("2363"),l=n("51414"),s=n("68965"),d=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function u(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=0;o2&&void 0!==arguments[2]?arguments[2]:[];return t||a.length>0?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return g({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:l,showInlineLineNumbers:o,lineProps:n,className:r,showLineNumbers:i,wrapLongLines:d})}(e,r,a):function(e,t){if(i&&t&&o){var n=f(s,t,l);e.unshift(m(t,n))}return e}(e,r)}for(;v>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=i.variable[1].inside,a=0;a]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}e.exports=t,t.displayName="clike",t.aliases=[]},17520:function(e){"use strict";function t(e){var t,n,i;n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,(t=e).languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css,(i=t.languages.markup)&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}e.exports=t,t.displayName="css",t.aliases=[]},63610:function(e){"use strict";function t(e){var t,n;(t=e).languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]},Object.keys(n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"}).forEach(function(e){var i=n[e],r=[];!/^\w+$/.test(e)&&r.push(/\w+/.exec(e)[0]),"diff"===e&&r.push("bold"),t.languages.diff[e]={pattern:RegExp("^(?:["+i+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(e)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})}e.exports=t,t.displayName="diff",t.aliases=[]},59551:function(e){"use strict";function t(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|")+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}e.exports=t,t.displayName="javascript",t.aliases=["js"]},7091:function(e){"use strict";function t(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}e.exports=t,t.displayName="json",t.aliases=["webmanifest"]},17942:function(e){"use strict";function t(e){!function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function o(e,t){return RegExp(e=e.replace(//g,function(){return n}).replace(//g,function(){return i}).replace(//g,function(){return r}),t)}r=o(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var a=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(a).join(""):""},l=function(t){for(var n=[],i=0;i0&&n[n.length-1].tagName===a(r.content[0].content[1])&&n.pop():"/>"===r.content[r.content.length-1].content||n.push({tagName:a(r.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===r.type&&"{"===r.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof r)&&n.length>0&&0===n[n.length-1].openedBraces){var s=a(r);i0&&("string"==typeof t[i-1]||"plain-text"===t[i-1].type)&&(s=a(t[i-1])+s,t.splice(i-1,1),i--),t[i]=new e.Token("plain-text",s,null,s)}r.content&&"string"!=typeof r.content&&l(r.content)}};e.hooks.add("after-tokenize",function(e){("jsx"===e.language||"tsx"===e.language)&&l(e.tokens)})}(e)}e.exports=t,t.displayName="jsx",t.aliases=[]},89693:function(e){"use strict";function t(e){e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}e.exports=t,t.displayName="less",t.aliases=[]},19463:function(e){"use strict";function t(e){!function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+o+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+o+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add("after-tokenize",function(e){("markdown"===e.language||"md"===e.language)&&function e(t){if(t&&"string"!=typeof t)for(var n=0,i=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(e)}e.exports=t,t.displayName="markdown",t.aliases=["md"]},47264:function(e){"use strict";function t(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var i={};i["language-"+n]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[n]},i.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:i}};r["language-"+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var o={};o[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},e.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}e.exports=t,t.displayName="markup",t.aliases=["html","mathml","svg","xml","ssml","atom","rss"]},31337:function(e){"use strict";function t(e){e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}e.exports=t,t.displayName="scss",t.aliases=[]},89455:function(e,t,n){"use strict";var i=n("17942"),r=n("63847");function o(e){var t,n,o;e.register(i),e.register(r),n=(t=e).util.clone(t.languages.typescript),t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"],(o=t.languages.tsx.tag).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+o.pattern.source+")",o.pattern.flags),o.lookbehind=!0}e.exports=o,o.displayName="tsx",o.aliases=[]},63847:function(e){"use strict";function t(e){var t,n;(t=e).languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"],n=t.languages.extend("typescript",{}),delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript}e.exports=t,t.displayName="typescript",t.aliases=["ts"]},14646:function(e){"use strict";function t(e){!function(e){function t(t,n){e.languages[t]&&e.languages.insertBefore(t,"comment",{"doc-comment":n})}var n=e.languages.markup.tag,i={pattern:/\/\/\/.*/,greedy:!0,alias:"comment",inside:{tag:n}};t("csharp",i),t("fsharp",i),t("vbnet",{pattern:/'''.*/,greedy:!0,alias:"comment",inside:{tag:n}})}(e)}e.exports=t,t.displayName="xmlDoc",t.aliases=[]},70660:function(e){"use strict";function t(e){!function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,i="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function a(e,t){return t=(t||"").replace(/m/g,"")+"m",RegExp(/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return e}),t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return i})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return"(?:"+r+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:a(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:a(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:a(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:a(o),lookbehind:!0,greedy:!0},number:{pattern:a(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(e)}e.exports=t,t.displayName="yaml",t.aliases=["yml"]},65241:function(e){e.exports=function(e,t,n,i){var r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s{let n=e=>e.replace(/\/$/,"").toLowerCase();return(0,l.pV)(n(t.routePath),n(e))}),d=encodeURIComponent(a),c=(null===(r=n.default.__RSPRESS_PAGE_META)||void 0===r?void 0:r[d])||{},{toc:u=[],title:p="",frontmatter:m={},...f}=h.kv.test(t.filePath)?c:n;return{siteData:o.Z,page:{...f,pagePath:a,...s,pageType:(null==m?void 0:m.pageType)||"doc",title:p,frontmatter:m,toc:u}}}return{siteData:o.Z,page:{pagePath:"",pageType:"404",routePath:"/404",lang:o.Z.lang||"",frontmatter:{},title:"404",toc:[],version:"",_filepath:"",_relativePath:""}}}function x(e){let{helmetContext:t}=e,{setData:n,data:i}=(0,u.useContext)(s.R0),o=i.page.frontmatter||{},{pathname:a,search:h}=(0,d.TH)(),f=new URLSearchParams(h),x="globalUIComponents",v=!1===o[x]||"0"===f.get(x);return(0,u.useLayoutEffect)(()=>{(async function e(){try{let e=await g((0,l.Tm)(a));n(e)}catch(e){console.log(e)}})()},[a,n]),(0,r.jsxs)(c.B6,{context:t,children:[(0,r.jsx)(m.ZP.Layout,{}),!v&&p.Z.map((e,t)=>{if(Array.isArray(e)){let[n,i]=e;return u.createElement(n,{key:t,...i})}return u.createElement(e,{key:t})})]})}},70474:function(e,t,n){"use strict";var i=n("39980"),r=n("2363"),o=n("72855"),a=n("13328"),l=n("92688"),s=n("51812"),d=n("35383"),c=n("94573");let u=a.Z.ssg,{default:h,useThemeState:p}=n("92919");(async function e(){let e=document.getElementById("root"),t=async()=>{let e=await (0,c.$X)((0,l.Tm)(window.location.pathname));return function(){let[t,n]=(0,r.useState)(e),[o,a]=p();return(0,i.jsx)(s.Ni.Provider,{value:(0,r.useMemo)(()=>({theme:o,setTheme:a}),[o,a]),children:(0,i.jsx)(s.R0.Provider,{value:(0,r.useMemo)(()=>({data:t,setData:n}),[t,n]),children:(0,i.jsx)(d.VK,{children:(0,i.jsx)(c.gV,{})})})})}},a=await t();{let{createRoot:t,hydrateRoot:r}=n("30417");(0,o.yv)()&&u?r(e,(0,i.jsx)(a,{})):t(e).render((0,i.jsx)(a,{}))}})().then(()=>{h.setup()})},1134:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}});var i=n("71895")},8951:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var i=n("8319"),r=n("60366"),o=n("2363");function a(e){let{pathname:t}=(0,i.TH)(),{selector:n=".rspress-doc img",options:a={}}=e;return(0,o.useEffect)(()=>{let e;let t=setTimeout(()=>{let t=document.querySelectorAll(n);e=(0,r.Z)(t,{...a,background:"var(--rp-c-bg)"})},100);return()=>{clearTimeout(t),null==e||e.detach(),null==e||e.close()}},[t]),null}n("48097")},99849:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}});var i=n("1134")},49915:function(e,t,n){"use strict";var i=n("8951");t.Z=[[i.Z,{}]]},54345:function(e,t,n){"use strict";n("60817")},16288:function(e,t,n){"use strict";var i=n("68450"),r=n("78036"),o=n("35009"),a=n("69611"),l=n("41143"),s=n("51088"),d=n("89648"),c=n("94744"),u=n("12417"),h=n("61691"),p=n("29027"),m=n("5646");t.Z={js:i.Z,ts:r.Z,jsx:o.Z,tsx:o.Z,json:a.Z,css:l.Z,scss:s.Z,less:d.Z,xml:c.Z,diff:u.Z,yaml:h.Z,md:p.Z,mdx:o.Z,bash:m.Z}},99593:function(e,t,n){"use strict";n.r(t),n.d(t,{routes:function(){return eY}});var i=n("2363"),r=n("22897");let o=(0,r.lazyWithPreload)(()=>n.e("5562").then(n.bind(n,"73009"))),a=(0,r.lazyWithPreload)(()=>n.e("240").then(n.bind(n,"76107"))),l=(0,r.lazyWithPreload)(()=>n.e("5185").then(n.bind(n,"927"))),s=(0,r.lazyWithPreload)(()=>n.e("2436").then(n.bind(n,"81573"))),d=(0,r.lazyWithPreload)(()=>n.e("4159").then(n.bind(n,"28487"))),c=(0,r.lazyWithPreload)(()=>n.e("2509").then(n.bind(n,"81570"))),u=(0,r.lazyWithPreload)(()=>n.e("2454").then(n.bind(n,"24389"))),h=(0,r.lazyWithPreload)(()=>n.e("8175").then(n.bind(n,"80838"))),p=(0,r.lazyWithPreload)(()=>n.e("7767").then(n.bind(n,"63921"))),m=(0,r.lazyWithPreload)(()=>n.e("952").then(n.bind(n,"34550"))),f=(0,r.lazyWithPreload)(()=>n.e("4273").then(n.bind(n,"15027"))),g=(0,r.lazyWithPreload)(()=>n.e("7626").then(n.bind(n,"8659"))),x=(0,r.lazyWithPreload)(()=>n.e("5605").then(n.bind(n,"48672"))),v=(0,r.lazyWithPreload)(()=>n.e("5037").then(n.bind(n,"30867"))),b=(0,r.lazyWithPreload)(()=>n.e("8200").then(n.bind(n,"82555"))),y=(0,r.lazyWithPreload)(()=>n.e("4888").then(n.bind(n,"58682"))),w=(0,r.lazyWithPreload)(()=>n.e("28").then(n.bind(n,"73323"))),k=(0,r.lazyWithPreload)(()=>n.e("5567").then(n.bind(n,"59168"))),j=(0,r.lazyWithPreload)(()=>n.e("6760").then(n.bind(n,"45077"))),I=(0,r.lazyWithPreload)(()=>n.e("9343").then(n.bind(n,"33082"))),P=(0,r.lazyWithPreload)(()=>n.e("8738").then(n.bind(n,"60701"))),E=(0,r.lazyWithPreload)(()=>n.e("978").then(n.bind(n,"35423"))),S=(0,r.lazyWithPreload)(()=>n.e("4465").then(n.bind(n,"41060"))),C=(0,r.lazyWithPreload)(()=>n.e("8439").then(n.bind(n,"15755"))),z=(0,r.lazyWithPreload)(()=>n.e("2232").then(n.bind(n,"98505"))),N=(0,r.lazyWithPreload)(()=>n.e("679").then(n.bind(n,"29868"))),_=(0,r.lazyWithPreload)(()=>n.e("9602").then(n.bind(n,"43102"))),A=(0,r.lazyWithPreload)(()=>n.e("9092").then(n.bind(n,"50417"))),T=(0,r.lazyWithPreload)(()=>n.e("7371").then(n.bind(n,"11354"))),O=(0,r.lazyWithPreload)(()=>n.e("4248").then(n.bind(n,"56401"))),M=(0,r.lazyWithPreload)(()=>n.e("1342").then(n.bind(n,"30669"))),L=(0,r.lazyWithPreload)(()=>n.e("3760").then(n.bind(n,"6470"))),D=(0,r.lazyWithPreload)(()=>n.e("3777").then(n.bind(n,"16013"))),R=(0,r.lazyWithPreload)(()=>n.e("3351").then(n.bind(n,"77419"))),B=(0,r.lazyWithPreload)(()=>n.e("4053").then(n.bind(n,"64219"))),$=(0,r.lazyWithPreload)(()=>n.e("7524").then(n.bind(n,"52637"))),F=(0,r.lazyWithPreload)(()=>n.e("6844").then(n.bind(n,"75534"))),H=(0,r.lazyWithPreload)(()=>n.e("2458").then(n.bind(n,"46859"))),Z=(0,r.lazyWithPreload)(()=>n.e("7948").then(n.bind(n,"28112"))),W=(0,r.lazyWithPreload)(()=>n.e("638").then(n.bind(n,"89769"))),U=(0,r.lazyWithPreload)(()=>n.e("2974").then(n.bind(n,"3561"))),q=(0,r.lazyWithPreload)(()=>n.e("8842").then(n.bind(n,"44746"))),V=(0,r.lazyWithPreload)(()=>n.e("3637").then(n.bind(n,"74040"))),G=(0,r.lazyWithPreload)(()=>n.e("3293").then(n.bind(n,"1910"))),Y=(0,r.lazyWithPreload)(()=>n.e("8484").then(n.bind(n,"7992"))),Q=(0,r.lazyWithPreload)(()=>n.e("8773").then(n.bind(n,"55348"))),K=(0,r.lazyWithPreload)(()=>n.e("6917").then(n.bind(n,"88364"))),J=(0,r.lazyWithPreload)(()=>n.e("3253").then(n.bind(n,"98069"))),X=(0,r.lazyWithPreload)(()=>n.e("1276").then(n.bind(n,"67982"))),ee=(0,r.lazyWithPreload)(()=>n.e("3934").then(n.bind(n,"16770"))),et=(0,r.lazyWithPreload)(()=>n.e("6955").then(n.bind(n,"33800"))),en=(0,r.lazyWithPreload)(()=>n.e("1881").then(n.bind(n,"58082"))),ei=(0,r.lazyWithPreload)(()=>n.e("5102").then(n.bind(n,"68687"))),er=(0,r.lazyWithPreload)(()=>n.e("5608").then(n.bind(n,"84194"))),eo=(0,r.lazyWithPreload)(()=>n.e("9826").then(n.bind(n,"67903"))),ea=(0,r.lazyWithPreload)(()=>n.e("865").then(n.bind(n,"96948"))),el=(0,r.lazyWithPreload)(()=>n.e("5994").then(n.bind(n,"17936"))),es=(0,r.lazyWithPreload)(()=>n.e("21").then(n.bind(n,"93335"))),ed=(0,r.lazyWithPreload)(()=>n.e("1980").then(n.bind(n,"42137"))),ec=(0,r.lazyWithPreload)(()=>n.e("2326").then(n.bind(n,"65560"))),eu=(0,r.lazyWithPreload)(()=>n.e("301").then(n.bind(n,"67541"))),eh=(0,r.lazyWithPreload)(()=>n.e("81").then(n.bind(n,"3620"))),ep=(0,r.lazyWithPreload)(()=>n.e("3747").then(n.bind(n,"1445"))),em=(0,r.lazyWithPreload)(()=>n.e("6111").then(n.bind(n,"13207"))),ef=(0,r.lazyWithPreload)(()=>n.e("6458").then(n.bind(n,"56040"))),eg=(0,r.lazyWithPreload)(()=>n.e("9587").then(n.bind(n,"46824"))),ex=(0,r.lazyWithPreload)(()=>n.e("4327").then(n.bind(n,"39511"))),ev=(0,r.lazyWithPreload)(()=>n.e("8954").then(n.bind(n,"37902"))),eb=(0,r.lazyWithPreload)(()=>n.e("3718").then(n.bind(n,"44914"))),ey=(0,r.lazyWithPreload)(()=>n.e("7227").then(n.bind(n,"53336"))),ew=(0,r.lazyWithPreload)(()=>n.e("8993").then(n.bind(n,"83503"))),ek=(0,r.lazyWithPreload)(()=>n.e("3497").then(n.bind(n,"45849"))),ej=(0,r.lazyWithPreload)(()=>n.e("8506").then(n.bind(n,"76141"))),eI=(0,r.lazyWithPreload)(()=>n.e("5055").then(n.bind(n,"17754"))),eP=(0,r.lazyWithPreload)(()=>n.e("5575").then(n.bind(n,"32053"))),eE=(0,r.lazyWithPreload)(()=>n.e("7586").then(n.bind(n,"32195"))),eS=(0,r.lazyWithPreload)(()=>n.e("5110").then(n.bind(n,"77048"))),eC=(0,r.lazyWithPreload)(()=>n.e("6356").then(n.bind(n,"50049"))),ez=(0,r.lazyWithPreload)(()=>n.e("9983").then(n.bind(n,"48982"))),eN=(0,r.lazyWithPreload)(()=>n.e("9001").then(n.bind(n,"89774"))),e_=(0,r.lazyWithPreload)(()=>n.e("358").then(n.bind(n,"81705"))),eA=(0,r.lazyWithPreload)(()=>n.e("840").then(n.bind(n,"12761"))),eT=(0,r.lazyWithPreload)(()=>n.e("2217").then(n.bind(n,"51963"))),eO=(0,r.lazyWithPreload)(()=>n.e("3016").then(n.bind(n,"68544"))),eM=(0,r.lazyWithPreload)(()=>n.e("8683").then(n.bind(n,"54076"))),eL=(0,r.lazyWithPreload)(()=>n.e("7836").then(n.bind(n,"6129"))),eD=(0,r.lazyWithPreload)(()=>n.e("1831").then(n.bind(n,"94626"))),eR=(0,r.lazyWithPreload)(()=>n.e("721").then(n.bind(n,"14078"))),eB=(0,r.lazyWithPreload)(()=>n.e("5977").then(n.bind(n,"93265"))),e$=(0,r.lazyWithPreload)(()=>n.e("9492").then(n.bind(n,"35457"))),eF=(0,r.lazyWithPreload)(()=>n.e("1671").then(n.bind(n,"61778"))),eH=(0,r.lazyWithPreload)(()=>n.e("5388").then(n.bind(n,"69553"))),eZ=(0,r.lazyWithPreload)(()=>n.e("2377").then(n.bind(n,"76279"))),eW=(0,r.lazyWithPreload)(()=>n.e("6408").then(n.bind(n,"930"))),eU=(0,r.lazyWithPreload)(()=>n.e("281").then(n.bind(n,"47778"))),eq=(0,r.lazyWithPreload)(()=>n.e("6148").then(n.bind(n,"87327"))),eV=(0,r.lazyWithPreload)(()=>n.e("433").then(n.bind(n,"72246"))),eG=(0,r.lazyWithPreload)(()=>n.e("4521").then(n.bind(n,"42563"))),eY=[{path:"/module-tools/en/api/config/build-config",element:i.createElement(o),filePath:"en/api/config/build-config.mdx",preload:async()=>(await o.preload(),n.e("5562").then(n.bind(n,"73009"))),lang:"en",version:""},{path:"/module-tools/en/api/config/build-preset",element:i.createElement(a),filePath:"en/api/config/build-preset.mdx",preload:async()=>(await a.preload(),n.e("240").then(n.bind(n,"76107"))),lang:"en",version:""},{path:"/module-tools/en/api/config/dev",element:i.createElement(l),filePath:"en/api/config/dev.md",preload:async()=>(await l.preload(),n.e("5185").then(n.bind(n,"927"))),lang:"en",version:""},{path:"/module-tools/en/api/config/plugins",element:i.createElement(s),filePath:"en/api/config/plugins.md",preload:async()=>(await s.preload(),n.e("2436").then(n.bind(n,"81573"))),lang:"en",version:""},{path:"/module-tools/en/api/config/testing",element:i.createElement(d),filePath:"en/api/config/testing.md",preload:async()=>(await d.preload(),n.e("4159").then(n.bind(n,"28487"))),lang:"en",version:""},{path:"/module-tools/en/api/",element:i.createElement(c),filePath:"en/api/index.md",preload:async()=>(await c.preload(),n.e("2509").then(n.bind(n,"81570"))),lang:"en",version:""},{path:"/module-tools/en/api/plugin-api/plugin-hooks",element:i.createElement(u),filePath:"en/api/plugin-api/plugin-hooks.md",preload:async()=>(await u.preload(),n.e("2454").then(n.bind(n,"24389"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-exception",element:i.createElement(h),filePath:"en/components/faq-build-exception.mdx",preload:async()=>(await h.preload(),n.e("8175").then(n.bind(n,"80838"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-other",element:i.createElement(p),filePath:"en/components/faq-build-other.mdx",preload:async()=>(await p.preload(),n.e("7767").then(n.bind(n,"63921"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-product",element:i.createElement(m),filePath:"en/components/faq-build-product.mdx",preload:async()=>(await m.preload(),n.e("952").then(n.bind(n,"34550"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-storybook",element:i.createElement(f),filePath:"en/components/faq-storybook.mdx",preload:async()=>(await f.preload(),n.e("4273").then(n.bind(n,"15027"))),lang:"en",version:""},{path:"/module-tools/en/components/faq-test",element:i.createElement(g),filePath:"en/components/faq-test.mdx",preload:async()=>(await g.preload(),n.e("7626").then(n.bind(n,"8659"))),lang:"en",version:""},{path:"/module-tools/en/components/publish-emo",element:i.createElement(x),filePath:"en/components/publish-emo.mdx",preload:async()=>(await x.preload(),n.e("5605").then(n.bind(n,"48672"))),lang:"en",version:""},{path:"/module-tools/en/components/register-esbuild-plugin",element:i.createElement(v),filePath:"en/components/register-esbuild-plugin.mdx",preload:async()=>(await v.preload(),n.e("5037").then(n.bind(n,"30867"))),lang:"en",version:""},{path:"/module-tools/en/components/release-module-doc",element:i.createElement(b),filePath:"en/components/release-module-doc.mdx",preload:async()=>(await b.preload(),n.e("8200").then(n.bind(n,"82555"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/asset",element:i.createElement(y),filePath:"en/guide/advance/asset.mdx",preload:async()=>(await y.preload(),n.e("4888").then(n.bind(n,"58682"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/build-umd",element:i.createElement(w),filePath:"en/guide/advance/build-umd.mdx",preload:async()=>(await w.preload(),n.e("28").then(n.bind(n,"73323"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/copy",element:i.createElement(k),filePath:"en/guide/advance/copy.md",preload:async()=>(await k.preload(),n.e("5567").then(n.bind(n,"59168"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/external-dependency",element:i.createElement(j),filePath:"en/guide/advance/external-dependency.mdx",preload:async()=>(await j.preload(),n.e("6760").then(n.bind(n,"45077"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-build",element:i.createElement(I),filePath:"en/guide/advance/in-depth-about-build.md",preload:async()=>(await I.preload(),n.e("9343").then(n.bind(n,"33082"))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-dev-command",element:i.createElement(P),filePath:"en/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await P.preload(),n.e("8738").then(n.bind(n,"60701"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/before-getting-started",element:i.createElement(E),filePath:"en/guide/basic/before-getting-started.md",preload:async()=>(await E.preload(),n.e("978").then(n.bind(n,"35423"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/command-preview",element:i.createElement(S),filePath:"en/guide/basic/command-preview.md",preload:async()=>(await S.preload(),n.e("4465").then(n.bind(n,"41060"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/modify-output-product",element:i.createElement(C),filePath:"en/guide/basic/modify-output-product.md",preload:async()=>(await C.preload(),n.e("8439").then(n.bind(n,"15755"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/publish-your-project",element:i.createElement(z),filePath:"en/guide/basic/publish-your-project.mdx",preload:async()=>(await z.preload(),n.e("2232").then(n.bind(n,"98505"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-micro-generator",element:i.createElement(N),filePath:"en/guide/basic/use-micro-generator.md",preload:async()=>(await N.preload(),n.e("679").then(n.bind(n,"29868"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-module-doc",element:i.createElement(_),filePath:"en/guide/basic/use-module-doc.mdx",preload:async()=>(await _.preload(),n.e("9602").then(n.bind(n,"43102"))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/using-storybook",element:i.createElement(A),filePath:"en/guide/basic/using-storybook.mdx",preload:async()=>(await A.preload(),n.e("9092").then(n.bind(n,"50417"))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/components",element:i.createElement(T),filePath:"en/guide/best-practices/components.mdx",preload:async()=>(await T.preload(),n.e("7371").then(n.bind(n,"11354"))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/use-tailwindcss",element:i.createElement(O),filePath:"en/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await O.preload(),n.e("4248").then(n.bind(n,"56401"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/basic",element:i.createElement(M),filePath:"en/guide/faq/basic.mdx",preload:async()=>(await M.preload(),n.e("1342").then(n.bind(n,"30669"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/build",element:i.createElement(L),filePath:"en/guide/faq/build.mdx",preload:async()=>(await L.preload(),n.e("3760").then(n.bind(n,"6470"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/",element:i.createElement(D),filePath:"en/guide/faq/index.md",preload:async()=>(await D.preload(),n.e("3777").then(n.bind(n,"16013"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/storybook",element:i.createElement(R),filePath:"en/guide/faq/storybook.mdx",preload:async()=>(await R.preload(),n.e("3351").then(n.bind(n,"77419"))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/test",element:i.createElement(B),filePath:"en/guide/faq/test.mdx",preload:async()=>(await B.preload(),n.e("4053").then(n.bind(n,"64219"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/getting-started",element:i.createElement($),filePath:"en/guide/intro/getting-started.mdx",preload:async()=>(await $.preload(),n.e("7524").then(n.bind(n,"52637"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/welcome",element:i.createElement(F),filePath:"en/guide/intro/welcome.md",preload:async()=>(await F.preload(),n.e("6844").then(n.bind(n,"75534"))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/why-module-engineering-solution",element:i.createElement(H),filePath:"en/guide/intro/why-module-engineering-solution.md",preload:async()=>(await H.preload(),n.e("2458").then(n.bind(n,"46859"))),lang:"en",version:""},{path:"/module-tools/en/",element:i.createElement(Z),filePath:"en/index.md",preload:async()=>(await Z.preload(),n.e("7948").then(n.bind(n,"28112"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/getting-started",element:i.createElement(W),filePath:"en/plugins/guide/getting-started.mdx",preload:async()=>(await W.preload(),n.e("638").then(n.bind(n,"89769"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/plugin-object",element:i.createElement(U),filePath:"en/plugins/guide/plugin-object.mdx",preload:async()=>(await U.preload(),n.e("2974").then(n.bind(n,"3561"))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/setup-function",element:i.createElement(q),filePath:"en/plugins/guide/setup-function.mdx",preload:async()=>(await q.preload(),n.e("8842").then(n.bind(n,"44746"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/overview",element:i.createElement(V),filePath:"en/plugins/official-list/overview.md",preload:async()=>(await V.preload(),n.e("3637").then(n.bind(n,"74040"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-babel",element:i.createElement(G),filePath:"en/plugins/official-list/plugin-babel.mdx",preload:async()=>(await G.preload(),n.e("3293").then(n.bind(n,"1910"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-banner",element:i.createElement(Y),filePath:"en/plugins/official-list/plugin-banner.mdx",preload:async()=>(await Y.preload(),n.e("8484").then(n.bind(n,"7992"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-import",element:i.createElement(Q),filePath:"en/plugins/official-list/plugin-import.mdx",preload:async()=>(await Q.preload(),n.e("8773").then(n.bind(n,"55348"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-node-polyfill",element:i.createElement(K),filePath:"en/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await K.preload(),n.e("6917").then(n.bind(n,"88364"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-polyfill",element:i.createElement(J),filePath:"en/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await J.preload(),n.e("3253").then(n.bind(n,"98069"))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-vue",element:i.createElement(X),filePath:"en/plugins/official-list/plugin-vue.mdx",preload:async()=>(await X.preload(),n.e("1276").then(n.bind(n,"67982"))),lang:"en",version:""},{path:"/module-tools/api/config/build-config",element:i.createElement(ee),filePath:"zh/api/config/build-config.mdx",preload:async()=>(await ee.preload(),n.e("3934").then(n.bind(n,"16770"))),lang:"zh",version:""},{path:"/module-tools/api/config/build-preset",element:i.createElement(et),filePath:"zh/api/config/build-preset.mdx",preload:async()=>(await et.preload(),n.e("6955").then(n.bind(n,"33800"))),lang:"zh",version:""},{path:"/module-tools/api/config/dev",element:i.createElement(en),filePath:"zh/api/config/dev.md",preload:async()=>(await en.preload(),n.e("1881").then(n.bind(n,"58082"))),lang:"zh",version:""},{path:"/module-tools/api/config/plugins",element:i.createElement(ei),filePath:"zh/api/config/plugins.md",preload:async()=>(await ei.preload(),n.e("5102").then(n.bind(n,"68687"))),lang:"zh",version:""},{path:"/module-tools/api/config/testing",element:i.createElement(er),filePath:"zh/api/config/testing.md",preload:async()=>(await er.preload(),n.e("5608").then(n.bind(n,"84194"))),lang:"zh",version:""},{path:"/module-tools/api/",element:i.createElement(eo),filePath:"zh/api/index.md",preload:async()=>(await eo.preload(),n.e("9826").then(n.bind(n,"67903"))),lang:"zh",version:""},{path:"/module-tools/api/plugin-api/plugin-hooks",element:i.createElement(ea),filePath:"zh/api/plugin-api/plugin-hooks.md",preload:async()=>(await ea.preload(),n.e("865").then(n.bind(n,"96948"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-exception",element:i.createElement(el),filePath:"zh/components/faq-build-exception.mdx",preload:async()=>(await el.preload(),n.e("5994").then(n.bind(n,"17936"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-other",element:i.createElement(es),filePath:"zh/components/faq-build-other.mdx",preload:async()=>(await es.preload(),n.e("21").then(n.bind(n,"93335"))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-product",element:i.createElement(ed),filePath:"zh/components/faq-build-product.mdx",preload:async()=>(await ed.preload(),n.e("1980").then(n.bind(n,"42137"))),lang:"zh",version:""},{path:"/module-tools/components/faq-storybook",element:i.createElement(ec),filePath:"zh/components/faq-storybook.mdx",preload:async()=>(await ec.preload(),n.e("2326").then(n.bind(n,"65560"))),lang:"zh",version:""},{path:"/module-tools/components/faq-test",element:i.createElement(eu),filePath:"zh/components/faq-test.mdx",preload:async()=>(await eu.preload(),n.e("301").then(n.bind(n,"67541"))),lang:"zh",version:""},{path:"/module-tools/components/publish-emo",element:i.createElement(eh),filePath:"zh/components/publish-emo.mdx",preload:async()=>(await eh.preload(),n.e("81").then(n.bind(n,"3620"))),lang:"zh",version:""},{path:"/module-tools/components/register-esbuild-plugin",element:i.createElement(ep),filePath:"zh/components/register-esbuild-plugin.mdx",preload:async()=>(await ep.preload(),n.e("3747").then(n.bind(n,"1445"))),lang:"zh",version:""},{path:"/module-tools/components/release-module-doc",element:i.createElement(em),filePath:"zh/components/release-module-doc.mdx",preload:async()=>(await em.preload(),n.e("6111").then(n.bind(n,"13207"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/asset",element:i.createElement(ef),filePath:"zh/guide/advance/asset.mdx",preload:async()=>(await ef.preload(),n.e("6458").then(n.bind(n,"56040"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/build-umd",element:i.createElement(eg),filePath:"zh/guide/advance/build-umd.mdx",preload:async()=>(await eg.preload(),n.e("9587").then(n.bind(n,"46824"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/copy",element:i.createElement(ex),filePath:"zh/guide/advance/copy.md",preload:async()=>(await ex.preload(),n.e("4327").then(n.bind(n,"39511"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/external-dependency",element:i.createElement(ev),filePath:"zh/guide/advance/external-dependency.mdx",preload:async()=>(await ev.preload(),n.e("8954").then(n.bind(n,"37902"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-build",element:i.createElement(eb),filePath:"zh/guide/advance/in-depth-about-build.md",preload:async()=>(await eb.preload(),n.e("3718").then(n.bind(n,"44914"))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-dev-command",element:i.createElement(ey),filePath:"zh/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await ey.preload(),n.e("7227").then(n.bind(n,"53336"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/before-getting-started",element:i.createElement(ew),filePath:"zh/guide/basic/before-getting-started.md",preload:async()=>(await ew.preload(),n.e("8993").then(n.bind(n,"83503"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/command-preview",element:i.createElement(ek),filePath:"zh/guide/basic/command-preview.md",preload:async()=>(await ek.preload(),n.e("3497").then(n.bind(n,"45849"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/modify-output-product",element:i.createElement(ej),filePath:"zh/guide/basic/modify-output-product.md",preload:async()=>(await ej.preload(),n.e("8506").then(n.bind(n,"76141"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/publish-your-project",element:i.createElement(eI),filePath:"zh/guide/basic/publish-your-project.mdx",preload:async()=>(await eI.preload(),n.e("5055").then(n.bind(n,"17754"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-micro-generator",element:i.createElement(eP),filePath:"zh/guide/basic/use-micro-generator.md",preload:async()=>(await eP.preload(),n.e("5575").then(n.bind(n,"32053"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-module-doc",element:i.createElement(eE),filePath:"zh/guide/basic/use-module-doc.mdx",preload:async()=>(await eE.preload(),n.e("7586").then(n.bind(n,"32195"))),lang:"zh",version:""},{path:"/module-tools/guide/basic/using-storybook",element:i.createElement(eS),filePath:"zh/guide/basic/using-storybook.mdx",preload:async()=>(await eS.preload(),n.e("5110").then(n.bind(n,"77048"))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/components",element:i.createElement(eC),filePath:"zh/guide/best-practices/components.mdx",preload:async()=>(await eC.preload(),n.e("6356").then(n.bind(n,"50049"))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/use-tailwindcss",element:i.createElement(ez),filePath:"zh/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await ez.preload(),n.e("9983").then(n.bind(n,"48982"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/basic",element:i.createElement(eN),filePath:"zh/guide/faq/basic.mdx",preload:async()=>(await eN.preload(),n.e("9001").then(n.bind(n,"89774"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/build",element:i.createElement(e_),filePath:"zh/guide/faq/build.mdx",preload:async()=>(await e_.preload(),n.e("358").then(n.bind(n,"81705"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/",element:i.createElement(eA),filePath:"zh/guide/faq/index.md",preload:async()=>(await eA.preload(),n.e("840").then(n.bind(n,"12761"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/storybook",element:i.createElement(eT),filePath:"zh/guide/faq/storybook.mdx",preload:async()=>(await eT.preload(),n.e("2217").then(n.bind(n,"51963"))),lang:"zh",version:""},{path:"/module-tools/guide/faq/test",element:i.createElement(eO),filePath:"zh/guide/faq/test.mdx",preload:async()=>(await eO.preload(),n.e("3016").then(n.bind(n,"68544"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/getting-started",element:i.createElement(eM),filePath:"zh/guide/intro/getting-started.mdx",preload:async()=>(await eM.preload(),n.e("8683").then(n.bind(n,"54076"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/welcome",element:i.createElement(eL),filePath:"zh/guide/intro/welcome.md",preload:async()=>(await eL.preload(),n.e("7836").then(n.bind(n,"6129"))),lang:"zh",version:""},{path:"/module-tools/guide/intro/why-module-engineering-solution",element:i.createElement(eD),filePath:"zh/guide/intro/why-module-engineering-solution.md",preload:async()=>(await eD.preload(),n.e("1831").then(n.bind(n,"94626"))),lang:"zh",version:""},{path:"/module-tools/",element:i.createElement(eR),filePath:"zh/index.md",preload:async()=>(await eR.preload(),n.e("721").then(n.bind(n,"14078"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/getting-started",element:i.createElement(eB),filePath:"zh/plugins/guide/getting-started.mdx",preload:async()=>(await eB.preload(),n.e("5977").then(n.bind(n,"93265"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/plugin-object",element:i.createElement(e$),filePath:"zh/plugins/guide/plugin-object.mdx",preload:async()=>(await e$.preload(),n.e("9492").then(n.bind(n,"35457"))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/setup-function",element:i.createElement(eF),filePath:"zh/plugins/guide/setup-function.mdx",preload:async()=>(await eF.preload(),n.e("1671").then(n.bind(n,"61778"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/overview",element:i.createElement(eH),filePath:"zh/plugins/official-list/overview.md",preload:async()=>(await eH.preload(),n.e("5388").then(n.bind(n,"69553"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-babel",element:i.createElement(eZ),filePath:"zh/plugins/official-list/plugin-babel.mdx",preload:async()=>(await eZ.preload(),n.e("2377").then(n.bind(n,"76279"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-banner",element:i.createElement(eW),filePath:"zh/plugins/official-list/plugin-banner.mdx",preload:async()=>(await eW.preload(),n.e("6408").then(n.bind(n,"930"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-import",element:i.createElement(eU),filePath:"zh/plugins/official-list/plugin-import.mdx",preload:async()=>(await eU.preload(),n.e("281").then(n.bind(n,"47778"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-node-polyfill",element:i.createElement(eq),filePath:"zh/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await eq.preload(),n.e("6148").then(n.bind(n,"87327"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-polyfill",element:i.createElement(eV),filePath:"zh/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await eV.preload(),n.e("433").then(n.bind(n,"72246"))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-vue",element:i.createElement(eG),filePath:"zh/plugins/official-list/plugin-vue.mdx",preload:async()=>(await eG.preload(),n.e("4521").then(n.bind(n,"42563"))),lang:"zh",version:""}]},51801:function(e,t,n){"use strict";n.d(t,{H:function(){return i}});let i=()=>{}},25756:function(e,t){"use strict";t.Z={"###en":"2cd9fa42","###zh":"678be30e"}},13328:function(e,t){"use strict";t.Z={title:"Modern.js Module",description:"",icon:"https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png",themeConfig:{footer:{message:"Copyright \xa9 2023 ByteDance."},socialLinks:[{icon:"github",mode:"link",content:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools"}],locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.52.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"},{text:"testing",link:"/module-tools/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"},{text:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.52.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"},{text:"testing",link:"/module-tools/en/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"},{text:"Test FAQ",link:"/module-tools/en/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],editLink:{docRepoBaseUrl:"https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs",text:"Edit this page on GitHub"}},base:"/module-tools/",lang:"zh",locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.52.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"},{text:"testing",link:"/module-tools/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"},{text:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.52.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"},{text:"testing",link:"/module-tools/en/api/config/testing"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"},{text:"Test FAQ",link:"/module-tools/en/guide/faq/test"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],logo:"",logoText:"",ssg:!0,multiVersion:{default:"",versions:[]},search:{},pages:[{title:"buildConfig",routePath:"/module-tools/en/api/config/build-config",lang:"en",toc:[{text:"alias",id:"alias",depth:2,charIndex:378},{text:"asset",id:"asset",depth:2,charIndex:1054},{text:"asset.name",id:"assetname",depth:2,charIndex:1113},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:1571},{text:"asset.path",id:"assetpath",depth:2,charIndex:2045},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:2149},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:2336},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:2783},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:2901},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:3018},{text:"autoExtension",id:"autoextension",depth:2,charIndex:3299},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:4498},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:5006},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:5142},{text:"banner",id:"banner",depth:2,charIndex:5273},{text:"buildType",id:"buildtype",depth:2,charIndex:5514},{text:"copy",id:"copy",depth:2,charIndex:5674},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:5850},{text:"copy.options",id:"copyoptions",depth:2,charIndex:5908},{text:"define",id:"define",depth:2,charIndex:6133},{text:"dts",id:"dts",depth:2,charIndex:7312},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:7435},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:7919},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:8081},{text:"dts.only",id:"dtsonly",depth:2,charIndex:8508},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:8664},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:8793},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:9225},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:10401},{text:"externals",id:"externals",depth:2,charIndex:10923},{text:"footer",id:"footer",depth:2,charIndex:11113},{text:"format",id:"format",depth:2,charIndex:11209},{text:"format: esm",id:"format-esm",depth:3,charIndex:11396},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:11536},{text:"format: iife",id:"format-iife",depth:3,charIndex:11732},{text:"format: umd",id:"format-umd",depth:3,charIndex:12026},{text:"hooks",id:"hooks",depth:2,charIndex:12329},{text:"input",id:"input",depth:2,charIndex:12816},{text:"jsx",id:"jsx",depth:2,charIndex:13845},{text:"metafile",id:"metafile",depth:2,charIndex:14380},{text:"minify",id:"minify",depth:2,charIndex:14809},{text:"outDir",id:"outdir",depth:2,charIndex:14952},{text:"platform",id:"platform",depth:2,charIndex:15046},{text:"redirect",id:"redirect",depth:2,charIndex:15277},{text:"resolve",id:"resolve",depth:2,charIndex:15793},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:15838},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:16333},{text:"shims",id:"shims",depth:2,charIndex:16798},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:17219},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:18068},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:18326},{text:"sourceType",id:"sourcetype",depth:2,charIndex:18437},{text:"splitting",id:"splitting",depth:2,charIndex:18664},{text:"style",id:"style",depth:2,charIndex:18827},{text:"style.less",id:"styleless",depth:2,charIndex:18875},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:18917},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:19042},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:19163},{text:"style.sass",id:"stylesass",depth:2,charIndex:19508},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:19551},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:19657},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:19789},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:20129},{text:"style.inject",id:"styleinject",depth:2,charIndex:20477},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:21490},{text:"style.modules",id:"stylemodules",depth:2,charIndex:21837},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:22137},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3,charIndex:22251},{text:"Type",id:"type",depth:3,charIndex:22460},{text:"Notes",id:"notes",depth:3,charIndex:22765},{text:"target",id:"target",depth:2,charIndex:23348},{text:"transformImport",id:"transformimport",depth:2,charIndex:23712},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:24068},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:24569},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:24674},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:24985}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/en/api/config/build-preset",lang:"en",toc:[{text:"`npm-library`",id:"npm-library",depth:3,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:3,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:3,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:3,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:3,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:1651}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/en/api/config/dev",lang:"en",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:93},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:239},{text:"Configure Manager App",id:"configure-manager-app",depth:4,charIndex:506},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:686}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/en/api/config/plugins",lang:"en",toc:[{text:"Plugin Execution Order",id:"plugin-execution-order",depth:2,charIndex:140},{text:"Developing Plugins",id:"developing-plugins",depth:2,charIndex:584},{text:"Example",id:"example",depth:2,charIndex:680},{text:"Using Plugins from npm",id:"using-plugins-from-npm",depth:3,charIndex:691},{text:"Using Local Plugins",id:"using-local-plugins",depth:4,charIndex:837},{text:"Plugin Configuration",id:"plugin-configuration",depth:3,charIndex:960}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/api/config/plugins.md"},{title:"testing",routePath:"/module-tools/en/api/config/testing",lang:"en",toc:[{text:"jest",id:"jest",depth:2,charIndex:133},{text:"transformer",id:"transformer",depth:2,charIndex:482}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/api/config/testing.md"},{title:"Overview",routePath:"/module-tools/en/api/",lang:"en",toc:[],frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1},version:"",_relativePath:"en/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/en/api/plugin-api/plugin-hooks",lang:"en",toc:[{text:"Config hooks",id:"config-hooks",depth:2,charIndex:509},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"build hooks",id:"build-hooks",depth:2,charIndex:596},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2,charIndex:1494},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"Dev Hooks",id:"dev-hooks",depth:2,charIndex:2796},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/en/components/faq-build-exception",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-other",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-product",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/en/components/faq-storybook",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/en/components/faq-test",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-test.mdx"},{title:"",routePath:"/module-tools/en/components/publish-emo",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/en/components/register-esbuild-plugin",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/en/components/release-module-doc",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/release-module-doc.mdx"},{title:"Handle static assets",routePath:"/module-tools/en/guide/advance/asset",lang:"en",toc:[{text:"Default behavior",id:"default-behavior",depth:2,charIndex:139},{text:"Example",id:"example",depth:2,charIndex:571}],frontmatter:{sidebar_position:6},version:"",_relativePath:"en/guide/advance/asset.mdx"},{title:"Build umd artifacts",routePath:"/module-tools/en/guide/advance/build-umd",lang:"en",toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2,charIndex:412},{text:"Example",id:"example",depth:3,charIndex:716},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3,charIndex:1171},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2,charIndex:1831}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/advance/build-umd.mdx"},{title:"Use the Copy Tools",routePath:"/module-tools/en/guide/advance/copy",lang:"en",toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2,charIndex:171},{text:"API Description",id:"api-description",depth:2,charIndex:335},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2,charIndex:1783},{text:"Copying Files",id:"copying-files",depth:3,charIndex:1818},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3,charIndex:1837},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3,charIndex:1871},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3,charIndex:1912},{text:"Using Glob",id:"using-glob",depth:3,charIndex:1948}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/advance/copy.md"},{title:"Handle third-party dependencies",routePath:"/module-tools/en/guide/advance/external-dependency",lang:"en",toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2,charIndex:811},{text:"Example",id:"example",depth:3,charIndex:1373},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2,charIndex:1643}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/advance/external-dependency.mdx"},{title:"In-depth understanding of build",routePath:"/module-tools/en/guide/advance/in-depth-about-build",lang:"en",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"use swc",id:"use-swc",depth:2,charIndex:2845},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2,charIndex:3803},{text:"Hook type",id:"hook-type",depth:3,charIndex:4183},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:4195},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:4334},{text:"Hook API",id:"hook-api",depth:3,charIndex:4431},{text:"load",id:"load",depth:4,charIndex:4442},{text:"transform",id:"transform",depth:4,charIndex:4626},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:4837},{text:"dts",id:"dts",depth:2,charIndex:5071},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3,charIndex:5154},{text:"Build type files",id:"build-type-files",depth:3,charIndex:5357},{text:"Alias Conversion",id:"alias-conversion",depth:3,charIndex:6424},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3,charIndex:-1},{text:"Build process",id:"build-process",depth:2,charIndex:6764},{text:"Build errors",id:"build-errors",depth:2,charIndex:7057},{text:"Debug mode",id:"debug-mode",depth:2,charIndex:7582}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/advance/in-depth-about-build.md"},{title:"In-depth understanding of the dev command",routePath:"/module-tools/en/guide/advance/in-depth-about-dev-command",lang:"en",toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2,charIndex:92},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2,charIndex:806}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/advance/in-depth-about-dev-command.md"},{title:"Before you start",routePath:"/module-tools/en/guide/basic/before-getting-started",lang:"en",toc:[{text:"Environment preparation",id:"environment-preparation",depth:2,charIndex:3},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2,charIndex:424},{text:"npm package type project",id:"npm-package-type-project",depth:2,charIndex:906},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2,charIndex:1922},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2,charIndex:3606},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3,charIndex:3643},{text:"`scripts`",id:"scripts",depth:3,charIndex:-1},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:5883},{text:"npm package manager",id:"npm-package-manager",depth:2,charIndex:6585},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2,charIndex:6850}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/basic/before-getting-started.md"},{title:"CLI Commands",routePath:"/module-tools/en/guide/basic/command-preview",lang:"en",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern test`",id:"modern-test",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/basic/command-preview.md"},{title:"Modify the output",routePath:"/module-tools/en/guide/basic/modify-output-product",lang:"en",toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2,charIndex:3},{text:"buildPreset",id:"buildpreset",depth:2,charIndex:818},{text:"buildConfig",id:"buildconfig",depth:2,charIndex:1639},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2,charIndex:4390}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/basic/modify-output-product.md"},{title:"Versioning and Publishing",routePath:"/module-tools/en/guide/basic/publish-your-project",lang:"en",toc:[{text:"Tracking changes",id:"tracking-changes",depth:2,charIndex:610},{text:"Version update",id:"version-update",depth:2,charIndex:1355},{text:"Publish",id:"publish",depth:2,charIndex:1780},{text:"Pre-releases",id:"pre-releases",depth:2,charIndex:2468}],frontmatter:{sidebar_position:7},version:"",_relativePath:"en/guide/basic/publish-your-project.mdx"},{title:"Using the Microgenerator",routePath:"/module-tools/en/guide/basic/use-micro-generator",lang:"en",toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2,charIndex:431},{text:"Storybook",id:"storybook",depth:2,charIndex:895},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2,charIndex:1243},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2,charIndex:1528}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/basic/use-micro-generator.md"},{title:"Developing Module documentation",routePath:"/module-tools/en/guide/basic/use-module-doc",lang:"en",toc:[{text:"Before we start",id:"before-we-start",depth:2,charIndex:98},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3,charIndex:117},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3,charIndex:451},{text:"Basic site structure",id:"basic-site-structure",depth:2,charIndex:686},{text:"Configure sidebar",id:"configure-sidebar",depth:3,charIndex:1493},{text:"Writing Documentation",id:"writing-documentation",depth:2,charIndex:2109},{text:"Component preview",id:"component-preview",depth:2,charIndex:2329},{text:"Example",id:"example",depth:3,charIndex:2514},{text:"Mobile Preview",id:"mobile-preview",depth:3,charIndex:3121},{text:"Using external demos",id:"using-external-demos",depth:3,charIndex:3451},{text:"Using built-in components",id:"using-built-in-components",depth:2,charIndex:3691},{text:"API",id:"api",depth:3,charIndex:3837},{text:"Parse file",id:"parse-file",depth:4,charIndex:3883},{text:"Content generation",id:"content-generation",depth:4,charIndex:3981},{text:"Using the component",id:"using-the-component",depth:4,charIndex:5005},{text:"Overview",id:"overview",depth:3,charIndex:5154},{text:"Plugin options",id:"plugin-options",depth:2,charIndex:5675},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:5693},{text:"doc",id:"doc",depth:3,charIndex:5817},{text:"entries",id:"entries",depth:3,charIndex:5833},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:6040},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:6320},{text:"previewMode",id:"previewmode",depth:3,charIndex:6408},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:6599},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:6746},{text:"Scripts",id:"scripts",depth:2,charIndex:6967},{text:"Advanced guide",id:"advanced-guide",depth:2,charIndex:7130}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/use-module-doc.mdx"},{title:"Using Storybook",routePath:"/module-tools/en/guide/basic/using-storybook",lang:"en",toc:[{text:"V7 (Recommended)",id:"v7-recommended",depth:2,charIndex:511},{text:"Enable Storybook",id:"enable-storybook",depth:3,charIndex:531},{text:"Enable Debug output",id:"enable-debug-output",depth:3,charIndex:985},{text:"Enable Rspack build",id:"enable-rspack-build",depth:3,charIndex:2036},{text:"Configurations",id:"configurations",depth:3,charIndex:2361},{text:"bundler",id:"bundler",depth:4,charIndex:2441},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:2579},{text:"Command",id:"command",depth:3,charIndex:2782},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:2850},{text:"storybook build",id:"storybook-build",depth:4,charIndex:2890},{text:"Migrate from V6 to V7",id:"migrate-from-v6-to-v7",depth:2,charIndex:2948},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:3767},{text:"Start Storybook",id:"start-storybook",depth:3,charIndex:4013},{text:"Configure Storybook",id:"configure-storybook",depth:3,charIndex:4352},{text:"Build Storybook Output",id:"build-storybook-output",depth:3,charIndex:5092}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/using-storybook.mdx"},{title:"Developing Components",routePath:"/module-tools/en/guide/best-practices/components",lang:"en",toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2,charIndex:93},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2,charIndex:406},{text:"Developing Styles",id:"developing-styles",depth:2,charIndex:505},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:711},{text:"Less",id:"less",depth:3,charIndex:1098},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:1251},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:1414},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:1488},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2,charIndex:1852},{text:"Releasing components",id:"releasing-components",depth:2,charIndex:2666}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/best-practices/components.mdx"},{title:"Using Tailwind CSS",routePath:"/module-tools/en/guide/best-practices/use-tailwindcss",lang:"en",toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2,charIndex:252},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2,charIndex:1105},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3,charIndex:1889},{text:"Build Modes",id:"build-modes",depth:2,charIndex:2460},{text:"Bundle Mode",id:"bundle-mode",depth:3,charIndex:2728},{text:"Bundleless Mode",id:"bundleless-mode",depth:3,charIndex:3091},{text:"Class Name Prefix",id:"class-name-prefix",depth:2,charIndex:3254},{text:"Usage Guide",id:"usage-guide",depth:2,charIndex:3641},{text:"HTML Class Names",id:"html-class-names",depth:3,charIndex:3703},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:4211},{text:"Less",id:"less",depth:4,charIndex:4413},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/best-practices/use-tailwindcss.mdx"},{title:"General Questions",routePath:"/module-tools/en/guide/faq/basic",lang:"en",toc:[{text:"What is the relationship between Modern.js Module and Rsbuild?",id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",depth:2,charIndex:3},{text:"Can Modern.js Module use webpack plugins or loaders?",id:"can-modernjs-module-use-webpack-plugins-or-loaders",depth:2,charIndex:210}],frontmatter:{},version:"",_relativePath:"en/guide/faq/basic.mdx"},{title:"Build FAQ",routePath:"/module-tools/en/guide/faq/build",lang:"en",toc:[{text:"Product FAQ",id:"product-faq",depth:2,charIndex:301},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3,charIndex:316},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3,charIndex:-1},{text:"Cannot find module http",id:"cannot-find-module-http",depth:3,charIndex:2578},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2,charIndex:2993},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:3011},{text:"Problem Description",id:"problem-description",depth:4,charIndex:3057},{text:"Solution",id:"solution",depth:4,charIndex:3285},{text:"Reference Links",id:"reference-links",depth:4,charIndex:3790},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:4558},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:5204},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3,charIndex:-1},{text:"Other FAQ",id:"other-faq",depth:2,charIndex:5956},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3,charIndex:5969},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3,charIndex:6443},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3,charIndex:7171}],frontmatter:{},version:"",_relativePath:"en/guide/faq/build.mdx"},{title:"FAQ",routePath:"/module-tools/en/guide/faq/",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/guide/faq/index.md"},{title:"Storybook FAQ",routePath:"/module-tools/en/guide/faq/storybook",lang:"en",toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2,charIndex:3},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2,charIndex:104},{text:"Cannot find module 'react-dom/package.json",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:519},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2,charIndex:680},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2,charIndex:899},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2,charIndex:1199}],frontmatter:{},version:"",_relativePath:"en/guide/faq/storybook.mdx"},{title:"Test FAQ",routePath:"/module-tools/en/guide/faq/test",lang:"en",toc:[{text:"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/guide/faq/test.mdx"},{title:"Quick Start",routePath:"/module-tools/en/guide/intro/getting-started",lang:"en",toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2,charIndex:3},{text:"Create new project",id:"create-new-project",depth:3,charIndex:209},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3,charIndex:855},{text:"Core npm Package",id:"core-npm-package",depth:3,charIndex:1577},{text:"View official example",id:"view-official-example",depth:3,charIndex:2272},{text:"Let's get started",id:"lets-get-started",depth:2,charIndex:2407}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/intro/getting-started.mdx"},{title:"Welcome to Modern.js Module",routePath:"/module-tools/en/guide/intro/welcome",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/intro/welcome.md"},{title:"Why you need Modern.js Module",routePath:"/module-tools/en/guide/intro/why-module-engineering-solution",lang:"en",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/en/",lang:"en",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/en/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/en/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Jest: Delightful Testing Framework",details:"Jest integration makes it easier to test code\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"en/index.md"},{title:"Quick Start",routePath:"/module-tools/en/plugins/guide/getting-started",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/plugins/guide/getting-started.mdx"},{title:"Plugin Object",routePath:"/module-tools/en/plugins/guide/plugin-object",lang:"en",toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2,charIndex:570},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2,charIndex:741}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/plugins/guide/plugin-object.mdx"},{title:"Setup function",routePath:"/module-tools/en/plugins/guide/setup-function",lang:"en",toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2,charIndex:173},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2,charIndex:993},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2,charIndex:1434}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/plugins/guide/setup-function.mdx"},{title:"Overview",routePath:"/module-tools/en/plugins/official-list/overview",lang:"en",toc:[{text:"Official Plugins",id:"official-plugins",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/overview.md"},{title:"Babel Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-babel",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:110},{text:"Install",id:"install",depth:3,charIndex:125},{text:"Register",id:"register",depth:3,charIndex:136},{text:"Config",id:"config",depth:2,charIndex:372}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-babel.mdx"},{title:"Banner Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-banner",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:89},{text:"Install",id:"install",depth:3,charIndex:104},{text:"Register",id:"register",depth:3,charIndex:115},{text:"Example",id:"example",depth:2,charIndex:271},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3,charIndex:282},{text:"Configuration",id:"configuration",depth:2,charIndex:337},{text:"banner",id:"banner",depth:3,charIndex:365},{text:"footer",id:"footer",depth:3,charIndex:505}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-banner.mdx"},{title:"Import Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-import",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:230},{text:"Install",id:"install",depth:3,charIndex:245},{text:"Register",id:"register",depth:3,charIndex:256},{text:"Configurations",id:"configurations",depth:2,charIndex:413},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:443},{text:"Notes",id:"notes",depth:2,charIndex:602}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-node-polyfill",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:460},{text:"Install",id:"install",depth:3,charIndex:475},{text:"Register",id:"register",depth:3,charIndex:486},{text:"Configurations",id:"configurations",depth:2,charIndex:569},{text:"exclude",id:"exclude",depth:3,charIndex:599},{text:"overrides",id:"overrides",depth:3,charIndex:655},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:708},{text:"Globals",id:"globals",depth:3,charIndex:726},{text:"Modules",id:"modules",depth:3,charIndex:877},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:1336}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-polyfill",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:497},{text:"Install",id:"install",depth:3,charIndex:512},{text:"Register",id:"register",depth:3,charIndex:523},{text:"Config",id:"config",depth:2,charIndex:778},{text:"targets",id:"targets",depth:3,charIndex:799}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-vue",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:547},{text:"Install",id:"install",depth:3,charIndex:562},{text:"Register",id:"register",depth:3,charIndex:573},{text:"Options",id:"options",depth:2,charIndex:656},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:667}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-vue.mdx"},{title:"buildConfig",routePath:"/module-tools/api/config/build-config",lang:"zh",toc:[{text:"alias",id:"alias",depth:2,charIndex:141},{text:"asset",id:"asset",depth:2,charIndex:483},{text:"asset.name",id:"assetname",depth:2,charIndex:506},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:753},{text:"asset.path",id:"assetpath",depth:2,charIndex:981},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:1052},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:1159},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:1411},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:1510},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:1611},{text:"autoExtension",id:"autoextension",depth:2,charIndex:1802},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:2393},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:2670},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:2758},{text:"banner",id:"banner",depth:2,charIndex:2854},{text:"buildType",id:"buildtype",depth:2,charIndex:2984},{text:"copy",id:"copy",depth:2,charIndex:3087},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:3128},{text:"copy.options",id:"copyoptions",depth:2,charIndex:3180},{text:"define",id:"define",depth:2,charIndex:3341},{text:"dts",id:"dts",depth:2,charIndex:3802},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:3864},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:4097},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:4196},{text:"dts.only",id:"dtsonly",depth:2,charIndex:4419},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:4499},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:4718},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:4790},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:5293},{text:"externals",id:"externals",depth:2,charIndex:5501},{text:"footer",id:"footer",depth:2,charIndex:5617},{text:"format",id:"format",depth:2,charIndex:5655},{text:"format: esm",id:"format-esm",depth:3,charIndex:5780},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:5859},{text:"format: iife",id:"format-iife",depth:3,charIndex:5957},{text:"format: umd",id:"format-umd",depth:3,charIndex:6058},{text:"hooks",id:"hooks",depth:2,charIndex:6211},{text:"input",id:"input",depth:2,charIndex:6359},{text:"jsx",id:"jsx",depth:2,charIndex:6824},{text:"metafile",id:"metafile",depth:2,charIndex:7147},{text:"minify",id:"minify",depth:2,charIndex:7385},{text:"outDir",id:"outdir",depth:2,charIndex:7505},{text:"platform",id:"platform",depth:2,charIndex:7559},{text:"redirect",id:"redirect",depth:2,charIndex:7693},{text:"resolve",id:"resolve",depth:2,charIndex:7924},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:7946},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:8263},{text:"shims",id:"shims",depth:2,charIndex:8520},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:8787},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:9229},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:9345},{text:"sourceType",id:"sourcetype",depth:2,charIndex:9432},{text:"splitting",id:"splitting",depth:2,charIndex:9590},{text:"style",id:"style",depth:2,charIndex:9703},{text:"style.less",id:"styleless",depth:2,charIndex:9724},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:9750},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:9841},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:9925},{text:"sass",id:"sass",depth:2,charIndex:10100},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:10120},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:10190},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:10285},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:10461},{text:"style.inject",id:"styleinject",depth:2,charIndex:10620},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:11116},{text:"style.modules",id:"stylemodules",depth:2,charIndex:11350},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:11529},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3,charIndex:11611},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3,charIndex:11731},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3,charIndex:11862},{text:"target",id:"target",depth:2,charIndex:12152},{text:"transformImport",id:"transformimport",depth:2,charIndex:12318},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:12514},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:12756},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:12844},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:13004}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/api/config/build-preset",lang:"zh",toc:[{text:"`npm-library`",id:"npm-library",depth:2,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:2,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:835}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/api/config/dev",lang:"zh",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:43},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:118},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4,charIndex:314},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:417}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/api/config/plugins",lang:"zh",toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2,charIndex:79},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2,charIndex:221},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:253},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3,charIndex:259},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4,charIndex:316},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3,charIndex:364}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/api/config/plugins.md"},{title:"testing",routePath:"/module-tools/api/config/testing",lang:"zh",toc:[{text:"jest",id:"jest",depth:2,charIndex:55},{text:"transformer",id:"transformer",depth:2,charIndex:202}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/api/config/testing.md"},{title:"\u6982\u89C8",routePath:"/module-tools/api/",lang:"zh",toc:[],frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1},version:"",_relativePath:"zh/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/api/plugin-api/plugin-hooks",lang:"zh",toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2,charIndex:209},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2,charIndex:276},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2,charIndex:713},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2,charIndex:1459},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/components/faq-build-exception",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/components/faq-build-other",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/components/faq-build-product",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/components/faq-storybook",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/components/faq-test",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-test.mdx"},{title:"",routePath:"/module-tools/components/publish-emo",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/components/register-esbuild-plugin",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/components/release-module-doc",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/release-module-doc.mdx"},{title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",routePath:"/module-tools/guide/advance/asset",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2,charIndex:74},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:355}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/advance/asset.mdx"},{title:"\u6784\u5EFA umd \u4EA7\u7269",routePath:"/module-tools/guide/advance/build-umd",lang:"zh",toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2,charIndex:181},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:302},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3,charIndex:556},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2,charIndex:836}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/advance/build-umd.mdx"},{title:"\u4F7F\u7528 Copy \u5DE5\u5177",routePath:"/module-tools/guide/advance/copy",lang:"zh",toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2,charIndex:72},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2,charIndex:165},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2,charIndex:826},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3,charIndex:838},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:851},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:865},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3,charIndex:879},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3,charIndex:891}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/advance/copy.md"},{title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",routePath:"/module-tools/guide/advance/external-dependency",lang:"zh",toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2,charIndex:264},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:521},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2,charIndex:652}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/advance/external-dependency.mdx"},{title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",routePath:"/module-tools/guide/advance/in-depth-about-build",lang:"zh",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2,charIndex:1281},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2,charIndex:1762},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3,charIndex:1936},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:1946},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:2048},{text:"Hook API",id:"hook-api",depth:3,charIndex:2117},{text:"load",id:"load",depth:4,charIndex:2128},{text:"transform",id:"transform",depth:4,charIndex:2236},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:2358},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2,charIndex:2500},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3,charIndex:2542},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3,charIndex:2619},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3,charIndex:3090},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3,charIndex:3208},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2,charIndex:3220},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2,charIndex:3394},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2,charIndex:3567}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/advance/in-depth-about-build.md"},{title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",routePath:"/module-tools/guide/advance/in-depth-about-dev-command",lang:"zh",toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2,charIndex:42},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2,charIndex:333}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/advance/in-depth-about-dev-command.md"},{title:"\u5F00\u59CB\u4E4B\u524D",routePath:"/module-tools/guide/basic/before-getting-started",lang:"zh",toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2,charIndex:3},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2,charIndex:188},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2,charIndex:391},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2,charIndex:818},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2,charIndex:1602},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3,charIndex:1621},{text:'"scripts"',id:"scripts",depth:3,charIndex:2042},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:2825},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2,charIndex:3139},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2,charIndex:3247}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/basic/before-getting-started.md"},{title:"CLI \u547D\u4EE4",routePath:"/module-tools/guide/basic/command-preview",lang:"zh",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern test`",id:"modern-test",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/basic/command-preview.md"},{title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",routePath:"/module-tools/guide/basic/modify-output-product",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2,charIndex:3},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2,charIndex:344},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2,charIndex:662},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2,charIndex:1950}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/basic/modify-output-product.md"},{title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",routePath:"/module-tools/guide/basic/publish-your-project",lang:"zh",toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2,charIndex:231},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2,charIndex:519},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2,charIndex:728},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2,charIndex:1040}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/basic/publish-your-project.mdx"},{title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",routePath:"/module-tools/guide/basic/use-micro-generator",lang:"zh",toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2,charIndex:166},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2,charIndex:370},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2,charIndex:561},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2,charIndex:709}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/basic/use-micro-generator.md"},{title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",routePath:"/module-tools/guide/basic/use-module-doc",lang:"zh",toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2,charIndex:29},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3,charIndex:37},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3,charIndex:146},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2,charIndex:233},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3,charIndex:625},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2,charIndex:830},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2,charIndex:916},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:973},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3,charIndex:1216},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3,charIndex:1369},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2,charIndex:1461},{text:"API",id:"api",depth:3,charIndex:1505},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4,charIndex:1525},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4,charIndex:1563},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4,charIndex:2032},{text:"Overview",id:"overview",depth:3,charIndex:2092},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2,charIndex:2360},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:2368},{text:"doc",id:"doc",depth:3,charIndex:2478},{text:"entries",id:"entries",depth:3,charIndex:2493},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:2596},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:2749},{text:"previewMode",id:"previewmode",depth:3,charIndex:2818},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:2936},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:3003},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2,charIndex:3112},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2,charIndex:3184}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/use-module-doc.mdx"},{title:"\u4F7F\u7528 Storybook",routePath:"/module-tools/guide/basic/using-storybook",lang:"zh",toc:[{text:"V7 (\u63A8\u8350)",id:"v7-\u63A8\u8350",depth:2,charIndex:239},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook",depth:3,charIndex:250},{text:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",id:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",depth:3,charIndex:492},{text:"\u5F00\u542F Rspack \u6784\u5EFA",id:"\u5F00\u542F-rspack-\u6784\u5EFA",depth:3,charIndex:946},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:3,charIndex:1095},{text:"bundler",id:"bundler",depth:4,charIndex:1134},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:1222},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:3,charIndex:1356},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:1409},{text:"storybook build",id:"storybook-build",depth:4,charIndex:1444},{text:"\u914D\u7F6E\u6587\u4EF6",id:"\u914D\u7F6E\u6587\u4EF6",depth:3,charIndex:1490},{text:"\u4ECE V6 \u8FC1\u79FB\u81F3 V7",id:"\u4ECE-v6-\u8FC1\u79FB\u81F3-v7",depth:2,charIndex:1574},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:2037},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook-1",depth:3,charIndex:2178},{text:"\u914D\u7F6E Storybook",id:"\u914D\u7F6E-storybook",depth:3,charIndex:2358},{text:"\u6784\u5EFA Storybook \u4EA7\u7269",id:"\u6784\u5EFA-storybook-\u4EA7\u7269",depth:3,charIndex:2705}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/using-storybook.mdx"},{title:"\u5F00\u53D1\u7EC4\u4EF6",routePath:"/module-tools/guide/best-practices/components",lang:"zh",toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2,charIndex:40},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2,charIndex:166},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2,charIndex:227},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:335},{text:"Less",id:"less",depth:3,charIndex:587},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:680},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:784},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:832},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2,charIndex:1071},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2,charIndex:1431}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/best-practices/components.mdx"},{title:"\u4F7F\u7528 Tailwind CSS",routePath:"/module-tools/guide/best-practices/use-tailwindcss",lang:"zh",toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2,charIndex:127},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2,charIndex:585},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2,charIndex:1047},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2,charIndex:1360},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3,charIndex:1477},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3,charIndex:1660},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2,charIndex:1732},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2,charIndex:1890},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3,charIndex:1925},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:2192},{text:"Less",id:"less",depth:4,charIndex:2300},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/best-practices/use-tailwindcss.mdx"},{title:"\u901A\u7528\u7C7B\u95EE\u9898",routePath:"/module-tools/guide/faq/basic",lang:"zh",toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2,charIndex:3},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2,charIndex:103}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/basic.mdx"},{title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/build",lang:"zh",toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2,charIndex:110},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3,charIndex:118},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3,charIndex:-1},{text:"Cannot find module http",id:"cannot-find-module-http",depth:3,charIndex:1337},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2,charIndex:1557},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:1566},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4,charIndex:1612},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4,charIndex:1712},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4,charIndex:1914},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:2336},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:2593},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3,charIndex:-1},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2,charIndex:2938},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3,charIndex:2944},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3,charIndex:3182},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3,charIndex:3490}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/build.mdx"},{title:"\u5E38\u89C1\u95EE\u9898",routePath:"/module-tools/guide/faq/",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/guide/faq/index.md"},{title:"Storybook \u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/storybook",lang:"zh",toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2,charIndex:3},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2,charIndex:58},{text:"Cannot find module 'react-dom/package.json",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:263},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2,charIndex:372},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2,charIndex:537},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2,charIndex:695}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/storybook.mdx"},{title:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/test",lang:"zh",toc:[{text:"\u6267\u884C `test` \u547D\u4EE4\u62A5\u9519 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:2,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/test.mdx"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/guide/intro/getting-started",lang:"zh",toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2,charIndex:3},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3,charIndex:110},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3,charIndex:402},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3,charIndex:784},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3,charIndex:1118},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2,charIndex:1175}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/intro/getting-started.mdx"},{title:"\u6B22\u8FCE\u4F7F\u7528",routePath:"/module-tools/guide/intro/welcome",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/intro/welcome.md"},{title:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",routePath:"/module-tools/guide/intro/why-module-engineering-solution",lang:"zh",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/",lang:"zh",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Jest: \u4EE4\u4EBA\u6109\u5FEB\u7684\u6D4B\u8BD5\u6846\u67B6",details:"\u96C6\u6210\u4E86 Jest\uFF0C\u4F7F\u5F97\u4EE3\u7801\u6D4B\u8BD5\u66F4\u52A0\u5BB9\u6613\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"zh/index.md"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/plugins/guide/getting-started",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/plugins/guide/getting-started.mdx"},{title:"\u63D2\u4EF6\u5BF9\u8C61",routePath:"/module-tools/plugins/guide/plugin-object",lang:"zh",toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2,charIndex:245},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2,charIndex:323}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/plugins/guide/plugin-object.mdx"},{title:"Setup \u51FD\u6570",routePath:"/module-tools/plugins/guide/setup-function",lang:"zh",toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2,charIndex:77},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2,charIndex:430},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2,charIndex:579}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/plugins/guide/setup-function.mdx"},{title:"\u603B\u89C8",routePath:"/module-tools/plugins/official-list/overview",lang:"zh",toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/overview.md"},{title:"Babel \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-babel",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:50},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:58},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:64},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:172}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-babel.mdx"},{title:"Banner \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-banner",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:132},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:140},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:146},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:240},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3,charIndex:246},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:267},{text:"banner",id:"banner",depth:3,charIndex:283},{text:"footer",id:"footer",depth:3,charIndex:362}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-banner.mdx"},{title:"Import \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-import",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:144},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:152},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:158},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:245},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:261},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2,charIndex:357}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-node-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:213},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:221},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:227},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:274},{text:"exclude",id:"exclude",depth:3,charIndex:290},{text:"overrides",id:"overrides",depth:3,charIndex:326},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:363},{text:"Globals",id:"globals",depth:3,charIndex:381},{text:"Modules",id:"modules",depth:3,charIndex:464},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:860}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:197},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:205},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:211},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:322},{text:"targets",id:"targets",depth:3,charIndex:338}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-vue",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:256},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:264},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:270},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:317},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:323}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-vue.mdx"}],markdown:{showLineNumbers:!1,defaultWrapCode:!1,codeHighlighter:"prism"}}},9580:function(e,t,n){"use strict";n.d(t,{Zo:function(){return l},ah:function(){return o}});var i=n("2363");let r=i.createContext({});function o(e){let t=i.useContext(r);return i.useMemo(()=>"function"==typeof e?e(t):{...t,...e},[t,e])}let a={};function l({components:e,children:t,disableParentContext:n}){let l;return l=n?"function"==typeof e?e({}):e||a:o(e),i.createElement(r.Provider,{value:l},t)}},72855:function(e,t,n){"use strict";n.d(t,{$U:function(){return th},E9:function(){return tv},Kw:function(){return td},_f:function(){return ta},bw:function(){return tr},kv:function(){return te},lm:function(){return to},mi:function(){return ts},pJ:function(){return tx},pZ:function(){return tu},rp:function(){return tt},t6:function(){return tn},tz:function(){return tg},xM:function(){return tp},xf:function(){return tc},yc:function(){return tf},yv:function(){return ti}});var i,r,o,a,l,s,d,c,u,h="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,m=h||p||Function("return this")(),f=m.Symbol,g=Object.prototype,x=g.hasOwnProperty,v=g.toString,b=f?f.toStringTag:void 0,y=function(e){var t=x.call(e,b),n=e[b];try{e[b]=void 0;var i=!0}catch(e){}var r=v.call(e);return i&&(t?e[b]=n:delete e[b]),r},w=Object.prototype.toString,k=f?f.toStringTag:void 0,j=function(e){var t;if(null==e)return void 0===e?"[object Undefined]":"[object Null]";return k&&k in Object(e)?y(e):(t=e,w.call(t))},I=function(e){return null!=e&&"object"==typeof e},P=Array.isArray,E=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},S=function(e){return e},C=function(e){if(!E(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},z=m["__core-js_shared__"];var N=(i=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",_=Function.prototype.toString,A=function(e){if(null!=e){try{return _.call(e)}catch(e){}try{return e+""}catch(e){}}return""},T=/^\[object .+?Constructor\]$/,O=Object.prototype,M=Function.prototype.toString,L=O.hasOwnProperty,D=RegExp("^"+M.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=function(e){var t;return!!E(e)&&(t=e,!N||!(N in t))&&(C(e)?D:T).test(A(e))},B=function(e,t){var n,i,r=(n=e,i=t,null==n?void 0:n[i]);return R(r)?r:void 0},$=Object.create,F=function(){function e(){}return function(t){if(!E(t))return{};if($)return $(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),H=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Z=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n0){if(++o>=800)return arguments[0]}else o=0;return r.apply(void 0,arguments)}),V=/^(?:0|[1-9]\d*)$/,G=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&V.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ei=function(e){return null!=e&&en(e.length)&&!C(e)},er=function(e,t,n){if(!E(n))return!1;var i=typeof t;return("number"==i?!!(ei(n)&&G(t,n.length)):"string"==i&&t in n)&&Q(n[t],e)},eo=Object.prototype,ea=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||eo)},el=function(e,t){for(var n=-1,i=Array(e);++n-1},eD.prototype.set=function(e,t){var n=this.__data__,i=eM(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var eR=B(m,"Map"),eB=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},e$=function(e,t){var n=e.__data__;return eB(t)?n["string"==typeof t?"string":"hash"]:n.map};function eF(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(r=u.length>3&&"function"==typeof r?(i--,r):void 0,o&&er(t[0],t[1],o)&&(r=i<3?void 0:r,i=1),e=Object(e);++n!0,tr=e=>e.replace(e9,"").replace(e8,"");function to(e){return e.replace(/#.*$/,"")}var ta=()=>!0;function tl(e){return"/"===e.charAt(0)||tc(e)?e:`/${e}`}function ts(e){return"/"===e.charAt(e.length-1)?e:`${e}/`}function td(e){var t;return"/"===(t=tl(function(e){let t=e.replace(/\\/g,"/"),n=t.startsWith("/"),i=t.split("/"),r=[];for(let e of i)"."===e||""===e||(".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():n&&r.push(".."):r.push(e));let o=r.join("/");return n&&(o=`/${o}`),o}(e))).charAt(t.length-1)?t.slice(0,-1):t}function tc(e=""){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")}function tu(e=""){return/^\s*data:/i.test(e)}function th(e,t,n,i="",r=!1){let o=tv(e,i);!o&&(o=r?"/index":"/index.html"),o.endsWith("/")&&(o+=r?"/index":"/index.html");let a="",l="",s="",d=o.split("/").filter(Boolean);return n.current&&n.current!==n.default&&(a=d.shift()||""),t.target!==t.default?(l=t.target,t.current!==t.default&&d.shift()):d.shift(),s=d.join("/")||"",(a||l)&&!s&&(s=r?"index":"index.html"),tx(tl([a,l,s].filter(Boolean).join("/")),i)}function tp(e,t,n="",i=!1){let r=tv(e,n);!r&&(r=i?"/index":"/index.html");let o="",a=r.split("/").filter(Boolean);t.target!==t.default?(o=t.target,t.current!==t.default&&a.shift()):a.shift();let l=a.join("/")||"";return o&&!l&&(l=i?"index":"index.html"),tx(tl([o,l].filter(Boolean).join("/")),n)}var tm=e=>{let[t,n=""]=e.split("#");return{url:t,hash:n}};function tf(e,t=!1){if(!e)return"/";if(tc(e))return e;let{url:n,hash:i}=tm(decodeURIComponent(e));return!t&&!n.endsWith(".html")&&(n.endsWith("/")?n+="index.html":n+=".html"),t&&n.endsWith("/")&&(n+="index"),tl(i?`${n}#${i}`:n)}function tg(e,t=""){return tl(e).replace(td(t),"")}function tx(e="/",t=""){let n=tl(e),i=td(t);return n.startsWith(i)?n:`${i}${n}`}function tv(e,t){return tl(e).replace(RegExp(`^${td(t)}`),"")}},60125:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})})},72247:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M22 16 12 26l-1.4-1.4 8.6-8.6-8.6-8.6L12 6z"})})},35329:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M24 9.4 22.6 8 16 14.6 9.4 8 8 9.4l6.6 6.6L8 22.6 9.4 24l6.6-6.6 6.6 6.6 1.4-1.4-6.6-6.6L24 9.4z"})})},32313:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 30 30",...e,children:[(0,i.jsx)("path",{fill:"currentColor",d:"M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"})]})},93388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})})},78009:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,fill:"none",viewBox:"0 0 48 48",...e,children:[(0,i.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M24 5v6m7 1 4-4m-18 4-4-4m27 33H8a2 2 0 0 1-2-2v-8.46a2 2 0 0 1 .272-1.007l6.15-10.54A2 2 0 0 1 14.148 18H33.85a2 2 0 0 1 1.728.992l6.149 10.541A2 2 0 0 1 42 30.541V39a2 2 0 0 1-2 2Z"}),(0,i.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M41.5 30H28s-1 3-4 3-4-3-4-3H6.5"})]})},66433:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:[(0,i.jsx)("circle",{cx:22,cy:24,r:2,fill:"currentColor"}),(0,i.jsx)("path",{fill:"none",d:"M22 28a4 4 0 1 1 4-4 4.004 4.004 0 0 1-4 4Zm0-6a2 2 0 1 0 2 2 2.003 2.003 0 0 0-2-2Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M29.777 23.479A8.64 8.64 0 0 0 22 18a8.64 8.64 0 0 0-7.777 5.479L14 24l.223.521A8.64 8.64 0 0 0 22 30a8.64 8.64 0 0 0 7.777-5.479L30 24ZM22 28a4 4 0 1 1 4-4 4.005 4.005 0 0 1-4 4Z"}),(0,i.jsx)("path",{fill:"currentColor",d:"M12 28H8V4h8v6a2.006 2.006 0 0 0 2 2h6v4h2v-6a.91.91 0 0 0-.3-.7l-7-7A.909.909 0 0 0 18 2H8a2.006 2.006 0 0 0-2 2v24a2.006 2.006 0 0 0 2 2h4Zm6-23.6 5.6 5.6H18Z"})]})},96113:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})},54788:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"m21.94 13.11-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91-6.17-7.91m8.73 7.92 2.47-7.59.1-.33h3.61l-5.59 7.16m4.1-13.67 1.81 5.56h-3.62m-1.3.95-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94 7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43 5.82 7.45m11.38-4.73-6.51 4.73.02-.03 5.79-7.42.79 2.43c.04.1 0 .22-.09.29"})})},68640:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M28 12v-2h-6V4h-2v6h-8V4h-2v6H4v2h6v8H4v2h6v6h2v-6h8v6h2v-6h6v-2h-6v-8Zm-8 8h-8v-8h8Z"})})},84820:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M13.414 17.586 18 22.172V8H8V6h10a2.002 2.002 0 0 1 2 2v14.172l4.586-4.586L26 19l-7 7-7-7Z"})})},74400:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsxs)("g",{fill:"none",stroke:"var(--rp-c-brand)",strokeLinecap:"round",strokeWidth:2,children:[(0,i.jsx)("path",{strokeDasharray:60,strokeDashoffset:60,strokeOpacity:.3,d:"M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",children:(0,i.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"1.3s",values:"60;0"})}),(0,i.jsxs)("path",{strokeDasharray:15,strokeDashoffset:15,d:"M12 3a9 9 0 0 1 9 9",children:[(0,i.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),(0,i.jsx)("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})]})]})})},93614:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"})})},51457:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"})})},7617:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"var(--rp-c-gray)",d:"m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z"})})},64992:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",...e,children:[(0,i.jsx)("circle",{cx:8,cy:16,r:2,fill:"currentColor"}),(0,i.jsx)("circle",{cx:16,cy:16,r:2,fill:"currentColor"}),(0,i.jsx)("circle",{cx:24,cy:16,r:2,fill:"currentColor"})]})},4226:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:32,height:32,viewBox:"0 0 30 30",...e,children:(0,i.jsx)("path",{fill:"#49cd37",d:"m13 24-9-9 1.414-1.414L13 21.171 26.586 7.586 28 9 13 24z"})})},51505:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"})})},1188:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 4a2 2 0 0 1 2-2h8a1 1 0 0 1 .707.293l5 5A1 1 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4zm13.586 4L14 4.414V8h3.586zM12 4H6v16h12V10h-5a1 1 0 0 1-1-1V4z"})})},86255:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{width:18,height:18,viewBox:"0 0 32 32",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6 2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z"})})},5687:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M16 7H3V5h13v2M3 19h13v-2H3v2m19-7-4-3v2H3v2h15v2l4-3Z"})})},53211:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),n("2363");var i=n("39980"),r=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"#22a041",d:"M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"})})},23657:function(e,t,n){"use strict";n.d(t,{AV:function(){return tr},Ar:function(){return tI},BZ:function(){return t9},CF:function(){return eU},CU:function(){return eW},Ct:function(){return t2},EG:function(){return n2},JL:function(){return nO},KO:function(){return nu},M4:function(){return e$},NG:function(){return tp},O9:function(){return na},OK:function(){return nK},Os:function(){return tP},Qe:function(){return nW},Qn:function(){return tv},RY:function(){return tj},Rg:function(){return id},SU:function(){return nH},TJ:function(){return t0},UQ:function(){return eG},VA:function(){return tm},Vl:function(){return eq},Vp:function(){return ic},WG:function(){return nx},WS:function(){return eZ},YE:function(){return io},YS:function(){return ti},ZB:function(){return il},ZP:function(){return ip},cY:function(){return eY},eE:function(){return eQ},eF:function(){return eV},g2:function(){return nL},ls:function(){return tc},mQ:function(){return nQ},mi:function(){return t6},of:function(){return ih},ol:function(){return n3},pU:function(){return nq},qx:function(){return eB},rU:function(){return ns},s2:function(){return th},tx:function(){return eH},xB:function(){return nr},xK:function(){return ne},xN:function(){return tf},y2:function(){return tt},zh:function(){return tu},zx:function(){return t4}});var i,r,o,a,l,s,d,c,u,h,p,m,f,g,x,v,b,y,w,k,j,I,P=n("51812"),E=n("39980");n("31642");var S=n("20288"),C=n("23657"),z=n("95929"),N=n("2363"),_=n("9580"),A=n("40741"),T=n("8319"),O=n("92688"),M=n("72855"),L=n("45187"),D=n("85653"),R=n("25756"),B=n("13328"),$=n("93371"),F=n("49555"),H=n("84520"),Z=n("93614"),W=n("72247"),U=n("85394"),q=n("5687"),V=n("53211"),G=n("16288"),Y=n("68271"),Q=n("79522"),K=n("32313"),J=n("4226"),X=n("11207"),ee=n("47841"),et=n("99593"),en=n("64992"),ei=n("12555"),er=n("51505"),eo=n("51457"),ea=n("60125"),el=n("86255"),es=n("93388"),ed=n("7617"),ec=n("11593"),eu=n("49157"),eh=n("61850"),ep=n("51801"),em=n("35329"),ef=n("74400"),eg=n("78009"),ex=n("66433"),ev=n("84820"),eb=n("68640"),ey=n("1188"),ew=n("96113"),ek=n("54788"),ej=Object.defineProperty,eI=Object.defineProperties,eP=Object.getOwnPropertyDescriptors,eE=Object.getOwnPropertySymbols,eS=Object.prototype.hasOwnProperty,eC=Object.prototype.propertyIsEnumerable,ez=(e,t,n)=>t in e?ej(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eN=(e,t)=>{for(var n in t||(t={}))eS.call(t,n)&&ez(e,n,t[n]);if(eE)for(var n of eE(t))eC.call(t,n)&&ez(e,n,t[n]);return e},e_=(e,t)=>eI(e,eP(t)),eA=(e,t)=>{var n={};for(var i in e)eS.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&eE)for(var i of eE(e))0>t.indexOf(i)&&eC.call(e,i)&&(n[i]=e[i]);return n},eT=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},eO=(e,t,n)=>(eT(e,t,"read from private field"),n?n.call(e):t.get(e)),eM=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},eL=(e,t,n,i)=>(eT(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),eD=(e,t,n)=>(eT(e,t,"access private method"),n),eR=(e,t,n)=>new Promise((i,r)=>{var o=e=>{try{l(n.next(e))}catch(e){r(e)}},a=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=e=>e.done?i(e.value):Promise.resolve(e.value).then(o,a);l((n=n.apply(e,t)).next())});function eB(){let{siteData:e}=(0,P.Vi)(),t=e.lang;if(t&&"undefined"!=typeof window&&location.pathname.includes(`/${t}/`)){let e=location.pathname.replace(`/${t}/`,"/");return window.location.replace(e),(0,E.jsx)(E.Fragment,{})}return(0,E.jsxs)("div",{className:"m-auto mt-50 p-16 sm:p-8 sm:pt-24 sm:pb-40 text-center flex-center flex-col",children:[(0,E.jsx)("p",{className:"text-6xl font-semibold",children:"404"}),(0,E.jsx)("h1",{className:"leading-5 pt-3 text-xl font-bold",children:"PAGE NOT FOUND"}),(0,E.jsx)("div",{style:{height:"1px"},className:"mt-6 mx-auto mb-4.5 w-16 bg-gray-light-1"}),(0,E.jsx)("div",{className:"pt-5",children:(0,E.jsx)("a",{className:"py-2 px-4 rounded-2xl inline-block border-solid border-brand text-brand font-medium hover:border-brand-dark hover:text-brand-dark transition-colors duration-300",href:e.base,"aria-label":"go to home",children:"Take me home"})})]})}function e$(){var e,t,n;let i=(0,P.Vi)(),{page:{lang:r}}=i,o=null!=(t=null==(e=null==i?void 0:i.siteData)?void 0:e.themeConfig)?t:{},a=null!=(n=i.siteData.lang)?n:"",l=null==o?void 0:o.locales;return l&&0!==l.length?e_(eN({},l.find(e=>e.lang===r)),{langRoutePrefix:r===a?"/":r}):{nav:o.nav,sidebar:o.sidebar,prevPageText:o.prevPageText,nextPageText:o.nextPageText,sourceCodeText:o.sourceCodeText,searchPlaceholderText:o.searchPlaceholderText}}var eF=(e,t)=>{let n;for(let i of Object.keys(e)){if(n&&n!==i)continue;if((0,O.pV)((0,O.pJ)(i),t))return{group:"Documentation",items:e[i]};let r=e[i].find(r=>{let o=r=>{if(!t.startsWith((0,O.pJ)(i))){for(let r of Object.keys(e))if(r!==i&&t.startsWith((0,M.mi)((0,O.pJ)(r))))return n=r,!1}let a=()=>"link"in r&&(0,O.pV)((0,O.pJ)(r.link),t);if("items"in r)return!!a()||r.items.some(e=>o(e));return a()};return o(r)});if(r){let t=e[i];return{group:"text"in r&&r.text||"",items:t}}}return{group:"Documentation",items:[]}};function eH(){var e;let t=e$(),n=null!=(e=t.sidebar)?e:{},{pathname:i}=(0,T.TH)(),r=decodeURIComponent(i),[o,a]=(0,N.useState)(eF(n,r));return(0,N.useEffect)(()=>{a(eF(n,r))},[r,t.lang]),o}function eZ(){let{pathname:e}=(0,T.TH)(),{items:t}=eH(),n=[],i=e=>{"items"in e?(e.link&&n.push({text:e.text,link:e.link}),e.items.forEach(e=>{"dividerType"in e||i(e)})):n.push(e)};t.forEach(e=>!("dividerType"in e)&&i(e));let r=n.findIndex(t=>(0,O.pV)((0,O.pJ)(t.link),e)),o=n[r-1]||null;return{prevPage:o,nextPage:n[r+1]||null}}function eW(){var e,t,n;let{siteData:i,page:r}=(0,P.Vi)(),o=null!=(n=null!=(t=e$().editLink)?t:null==(e=i.themeConfig)?void 0:e.editLink)?n:{};if(!o.docRepoBaseUrl||!o.text)return null;let{docRepoBaseUrl:a}=o;!a.endsWith("/")&&(a+="/");let l=r._relativePath.replace(/\\/g,"/"),s=`${a}${l}`;return{text:o.text,link:s}}function eU(){var e;let{siteData:{themeConfig:t},page:{frontmatter:n={}}}=(0,P.Vi)(),i=(null==(e=null==n?void 0:n.navbar)||e)&&(null==t?void 0:t.hideNavbar)!=="always",[r,o]=(0,N.useState)(i);return[r,o]}function eq(){var e;let{siteData:{themeConfig:t}}=(0,P.Vi)(),n=null!=(e=t.hideNavbar)?e:"never",[i,r]=(0,N.useState)(!1),{pathname:o}=(0,T.TH)(),a=(0,N.useRef)(0);return"never"!==n&&("always"===n||((0,N.useEffect)(()=>{r(!1);let e=(0,L.Z)(()=>{let{scrollTop:e}=document.documentElement;if(e!==a.current)r(a.current>0&&e-a.current>0),a.current=e<=0?0:e},200);return window.addEventListener("mousewheel",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousewheel",e),window.removeEventListener("touchmove",e)}},[o]),i))}function eV(e,t,n=72){let i=parseInt(window.getComputedStyle(e).paddingTop,10),r=window.scrollY+e.getBoundingClientRect().top-n-i;window.scrollTo(eN({left:0,top:Math.round(r)},t?{behavior:"smooth"}:{}))}function eG(){let e=document.getElementById("aside-container"),t=Array.from(document.querySelectorAll(".rspress-doc .header-anchor")).filter(e=>{var t;return(null==(t=e.parentElement)?void 0:t.tagName)!=="H1"});if(!e||!t.length)return;let n=null;if(!Array.from((null==e?void 0:e.getElementsByTagName("a"))||[]).map(e=>decodeURIComponent(e.hash)).length)return;let i=(t,i)=>{if(t[i]){let r=t[i].getAttribute("href"),o=null==e?void 0:e.querySelector(`a[href="#${null==r?void 0:r.slice(1)}"] > span`);o&&(n&&n.classList.remove("aside-active"),(n=o).classList.add("aside-active"))}},r=()=>{if(document.documentElement.scrollTop+window.innerHeight>=document.documentElement.scrollHeight)i(t,t.length-1);else for(let e=0;e=a&&o{n&&n.classList.remove("aside-active"),window.removeEventListener("scroll",o)}}function eY(){(0,M._f)()&&(window.addEventListener("click",e=>{let t=e.target.closest("a");if(t){let{origin:n,hash:i,target:r,pathname:o,search:a}=t,l=window.location;i&&"_blank"!==r&&n===l.origin&&(o===l.pathname&&a===l.search&&i&&t.classList.contains("header-anchor")?(e.preventDefault(),history.pushState(null,"",i),!function(e,t,n=!1){let i=null;try{i=e.classList.contains("header-anchor")?e:document.getElementById(decodeURIComponent(t.slice(1)))}catch(e){console.warn(e)}i&&eV(i,n)}(t,i,!0),window.dispatchEvent(new Event("hashchange"))):window.addEventListener("RspressReloadContent",()=>{location.hash.length>1&&eV(document.getElementById(location.hash.slice(1)),!1)}))}},{capture:!0}),window.addEventListener("hashchange",e=>{e.preventDefault()}))}function eQ(){let e=(0,P.Jr)(),t=(0,P.aw)(),n=(0,P.Vi)(),i=n.siteData.lang,r=n.siteData.multiVersion.default;return{normalizeLinkHref:n=>{let o=n;if((i||r)&&!(0,M.xf)(o)&&!o.startsWith("#")){let n=(o=(0,O.E9)(o)).split("/").filter(Boolean),a="",l="",s="";return r&&(t!==r?(a=t,n[0]===t&&n.shift()):n[0]===r&&n.shift()),i&&(e!==i?(l=e,n[0]===e&&n.shift()):n[0]===i&&n.shift()),s=n.join("/"),(0,O.AP)((0,O.pJ)([a,l,s].filter(Boolean).join("/")))}return o}}}var eK="default",eJ=/[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]/u,eX=/[\u0400-\u04FF]/u;function e0(e){let t=e.toString().toLowerCase().normalize("NFD"),n=t.replace(/[\u0300-\u036f]/g,"");return eX.test(String(e))?t.normalize("NFC"):eJ.test(String(e))?n.normalize("NFC"):n}function e1(e){return e.replace(/https?:\/\/[^/]+/,"")}function e2(e){return e.charCodeAt(0)>255?3:1}var e3=e=>e.map(e=>"string"==typeof e?{value:e,label:e}:e);function e4(e,t){let n=0,i=0;for(let r=0;r=t);r++)i+=e2(e.charAt(r)),n++;return n}function e5(e){let t=0;for(let n=0;ne_(eN({},e),{normalizedContent:e0(e.content),headers:e.toc.map(e=>e0(e.text)).join(" "),normalizedTitle:e0(e.title)})),c={tokenize:"full",async:!0,doc:{id:"routePath",field:["normalizedTitle","headers","normalizedContent"]},cache:100,split:/\W+/};eL(this,r,D.create(c)),eL(this,o,D.create(e_(eN({},c),{tokenize:e=>e8(e,e6)}))),eL(this,a,D.create(e_(eN({},c),{tokenize:e=>e8(e,e7)}))),eO(this,r).add(d),eO(this,o).add(d),eO(this,a).add(d)})}search(e){return eR(this,null,function*(){var t,n;let{keyword:i,limit:l}=e,s={query:i,limit:l,field:["normalizedTitle","headers","normalizedContent"]};return[{index:eK,hits:(yield Promise.all([null==(t=eO(this,r))?void 0:t.search(s),null==(n=eO(this,o))?void 0:n.search(s),eO(this,a).search(s)])).flat(2).filter(Boolean)}]})}};r=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakSet,s=function(e,t){return eR(this,null,function*(){let n=`${t}###${e}`,i=t?`.${t.replace(".","_")}`:"",r=e?`.${e}`:"";return(yield fetch(`/module-tools/static/${M.t6}${i}${r}.${R.Z[n]}.json`)).json()})};var te=class{constructor(){eM(this,d,void 0)}init(e){return eR(this,null,function*(){eL(this,d,e)})}search(e){return eR(this,null,function*(){let{apiUrl:t,searchIndexes:n}=eO(this,d),{keyword:i,limit:r}=e,o=Object.entries({keyword:i,limit:r.toString(),searchIndexes:(null==n?void 0:n.map(e=>"string"==typeof e?e:e.value).join(","))||"",lang:eO(this,d).currentLang}).map(e=>e.map(encodeURIComponent).join("=")).join("&");try{return(yield fetch(`${t}?${o}`)).json()}catch(e){return console.error(e),[]}})}};d=new WeakMap;var tt=((i=tt||{}).Default="default",i.Custom="custom",i),tn=class{constructor(e){if(eM(this,p),eM(this,f),eM(this,x),eM(this,b),eM(this,w),eM(this,j),eM(this,c,void 0),eM(this,u,eK),eM(this,h,void 0),eL(this,c,e),eL(this,u,e.indexName),"remote"===e.mode)eL(this,h,new te);else eL(this,h,new e9)}init(){return eR(this,null,function*(){var e;yield null==(e=eO(this,h))?void 0:e.init(eO(this,c))})}match(e,t=7){return eR(this,null,function*(){var n;let i=yield null==(n=eO(this,h))?void 0:n.search({keyword:e,limit:t}),r=e0(e),o=(null==i?void 0:i.find(e=>eD(this,j,I).call(this,e.index)))||{index:eK,renderType:"default",hits:[]};return[{group:eO(this,u),renderType:"default",result:eD(this,p,m).call(this,r,o)},...((null==i?void 0:i.filter(e=>!eD(this,j,I).call(this,e.index)))||[]).map(e=>({group:e.index,renderType:"default",result:eD(this,p,m).call(this,r,e)}))]})}};function ti(){var e;let{siteData:t,page:n}=(0,P.Vi)(),[i,r]=(0,N.useState)(!1),{sidebar:o}=e$(),a=e=>eF(o,e).group,l=(0,N.useRef)(null);return(0,N.useEffect)(()=>{!function(){eR(this,null,function*(){if(!i){let e=new tn(e_(eN({},t.search),{mode:"local",currentLang:n.lang,currentVersion:n.version,extractGroupName:a}));l.current=e,yield e.init(),r(!0)}})}()},[]),{initialized:i,search:null==(e=l.current)?void 0:e.match.bind(l.current)}}function tr(){let{siteData:e,page:t}=(0,P.Vi)(),n=e.lang||"",i=Object.values(e.themeConfig.locales||{}).map(e=>e.lang)||[],r=t.lang;(0,N.useEffect)(()=>{var t;let o;if("auto"!==(null!=(t=e.themeConfig.localeRedirect)?t:"auto")||!n)return;let{pathname:a,search:l}=window.location,s=(0,O.E9)(a),d="rspress-visited";if(localStorage.getItem(d))return;localStorage.setItem(d,"1");let c=window.navigator.language.split("-")[0];if(!!i.includes(c))c!==r&&(o=c===n?a.replace(`/${r}`,""):r===n?(0,O.pJ)(`/${c}${s}`):a.replace(`/${r}`,`/${c}`))&&window.location.replace(o+l)},[])}c=new WeakMap,u=new WeakMap,h=new WeakMap,p=new WeakSet,m=function(e,t){let n=[];return null==t||t.hits.forEach(t=>{eD(this,f,g).call(this,t,e,n),!eD(this,x,v).call(this,t,e,n)&&eD(this,b,y).call(this,t,e,n)}),n},f=new WeakSet,g=function(e,t,n){let{title:i=""}=e,r=e0(i);return!!r.includes(t)&&(n.push({type:"title",title:i,header:i,link:`${e.domain}${(0,O.AP)(e.routePath)}`,query:t,highlightInfoList:[{start:r.indexOf(t),length:e5(t)}],group:eO(this,c).extractGroupName(e.routePath)}),!0)},x=new WeakSet,v=function(e,t,n){let{toc:i=[],domain:r="",title:o=""}=e;for(let[a,l]of i.entries())if(e0(l.text).includes(t)){let s=(function(e,t){let n=e[t],i=t,r=[n];for(;n&&n.depth>2;){let t=!1;for(let o=i-1;o>=0;o--){let a=e[o];if(a.depth>1&&a.depth===n.depth-1){n=a,i=o,r.unshift(n),t=!0;break}}if(!t)break}return r})(i,a).map(e=>e.text).join(" > "),d=e0(s).indexOf(t),u=`${o} > `;return n.push({type:"header",title:e.title,header:`${u}${s}`,highlightInfoList:[{start:d+u.length,length:e5(t)}],link:`${r}${(0,O.AP)(e.routePath)}#${l.id}`,query:t,group:eO(this,c).extractGroupName(e.routePath)}),!0}return!1},b=new WeakSet,y=function(e,t,n){var i,r,o;let{content:a,toc:l,domain:s}=e;if(!a.length)return;let d=e0(a),u=d.indexOf(t),h=l.map(e=>e.charIndex),p=e=>l[h.findIndex((t,n)=>{if(!(n=e)return!0}return!1})];if(-1===u){let o=null==(i=e._matchesPosition)?void 0:i.content;if(!(null==o?void 0:o.length))return;let l=e._matchesPosition.content[0].start,d=p(l),u=e4(a,l),h=e4(a,l+100),m=a.slice(u,h),f=e._matchesPosition.content.filter(e=>e.start>=l&&e.start+e.length<=l+100).map(e=>({start:e4(a,e.start)-u+3,length:e.length}));n.push({type:"content",title:e.title,header:null!=(r=null==d?void 0:d.text)?r:e.title,link:`${s}${(0,O.AP)(e.routePath)}${d?`#${d.id}`:""}`,query:t,highlightInfoList:f,group:eO(this,c).extractGroupName(e.routePath),statement:`...${m}...`});return}for(;-1!==u;){let i=p(u),r=a.slice(0,u).lastIndexOf("\n");r=-1===r?0:r;let l=a.indexOf("\n\n",u+t.length),h=a.slice(r,l);h.length>100&&(h=eD(this,w,k).call(this,h,t));let m=e0(h).indexOf(t),f=[{start:m,length:e5(t)}];n.push({type:"content",title:e.title,header:null!=(o=null==i?void 0:i.text)?o:e.title,statement:h,highlightInfoList:f,link:`${s}${(0,O.AP)(e.routePath)}${i?`#${i.id}`:""}`,query:t,group:eO(this,c).extractGroupName(e.routePath)}),u=d.indexOf(t,u+h.length-m)}},w=new WeakSet,k=function(e,t){let n=e0(e).indexOf(e0(t)),i=Math.floor((100-t.length)/2),r=e.slice(0,n);r.length>i&&(r=`...${e.slice(n-i+3,n)}`);let o=e.slice(n+t.length);return o.length>i&&(o=`${e.slice(n+t.length,n+i-3)}...`),r+t+o},j=new WeakSet,I=function(e){return e===eO(this,u)||e===eK};var to=e=>{let t=(0,N.useRef)(e);return t.current=e,(0,N.useRef)((...e)=>t.current(...e)).current},ta=e=>{let[t,n]=(0,N.useState)(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return(0,N.useEffect)(()=>{let t=window.matchMedia(e),i=e=>n(e.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[e]),t},tl=(e,t=null)=>{let[n,i]=(0,N.useState)(()=>{var n;return"undefined"==typeof window?t:null!=(n=localStorage.getItem(e))?n:t}),r=(0,N.useCallback)(t=>{i(n=>{let i="function"==typeof t?t(n):t;return null==i?localStorage.removeItem(e):localStorage.setItem(e,i),i})},[e]);return(0,N.useEffect)(()=>{let n=n=>{var r;n.key===e&&i(null!=(r=localStorage.getItem(e))?r:t)};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}},[e,t]),[n,r]},ts=e=>["light","dark","auto"].includes(e)?e:"auto",td=!1===B.Z.themeConfig.darkMode,tc=()=>{let e=ta("(prefers-color-scheme: dark)"),[t,n]=tl(M.rp),i=to(()=>{if(td)return"light";let n=ts(t);return"auto"===n?e?"dark":"light":n}),[r,o]=(0,N.useState)(()=>{var e;if("undefined"==typeof window)return"light";let t=null!=(e=window.RSPRESS_THEME)?e:window.MODERN_THEME;return t?"dark"===t?"dark":"light":i()}),a=(0,N.useCallback)((e,t=e)=>{!td&&(o(e),n(t),s(!0))},[]);(0,N.useEffect)(()=>{document.documentElement.classList.toggle("dark","dark"===r),document.documentElement.style.colorScheme=r},[r]);let[l,s]=(0,N.useState)(!0);return(0,N.useEffect)(()=>{s(!1)},[l]),(0,N.useEffect)(()=>{!l&&a(i(),ts(t))},[t]),(0,N.useEffect)(()=>{!l&&a(e?"dark":"light","auto")},[e]),[r,a]};function tu(e,t,n=!1){return!!t&&(n?(0,O.pV)(e,t):(0,O.pV)(e,t)||e.startsWith(t))}function th(){return window.innerWidth<=1024}function tp(e){return e?(0,H.Z)(e)?e:(0,F.Z)(e)?$(e):e:""}function tm(e){return tp(e.replace(/$1").replace(/`(.*?)`/g,"$1"))}function tf(e){var t;let{headers:n}=e,i=n.length>0,r=(null==(t=n[0])?void 0:t.depth)||2,o=eq();return(0,N.useEffect)(()=>{let e;setTimeout(()=>{e=eG()},100);let t=decodeURIComponent(window.location.hash);if(t){let e=document.getElementById(t.slice(1));e&&eV(e,!1,o?0:72)}else window.scrollTo(0,0);return()=>{e&&e()}},[n]),(0,E.jsx)("div",{className:"flex flex-col",children:(0,E.jsx)("div",{className:i?"(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:`#${e.id}`,className:"aside-link transition-all duration-300 hover:text-text-1 text-text-2 block",style:{paddingLeft:(e.depth-r)*12,fontWeight:"semibold"},onClick:t=>{t.preventDefault(),window.location.hash=e.id;let n=document.getElementById(e.id);n&&eV(n,!1,o?0:72)},children:(0,E.jsx)("span",{className:"aside-link-text block",children:tm(e.text)})})},e.id))})})]})})})}var tg="prev_e7091",tx="next_e7091";function tv(){let{prevPage:e,nextPage:t}=eZ(),{lastUpdated:n=!1}=e$(),{siteData:i}=(0,P.Vi)(),{themeConfig:r}=i,o=r.lastUpdated||n;return(0,E.jsxs)("footer",{className:"mt-8",children:[(0,E.jsx)("div",{className:"xs:flex pb-5 px-2 justify-end items-center",children:o&&(0,E.jsx)(C.O9,{})}),(0,E.jsx)("div",{className:"flex flex-col",children:(0,E.jsx)(C.mi,{})}),(0,E.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-around gap-4 pt-6",children:[(0,E.jsx)("div",{className:`${tg} flex flex-col`,children:e?(0,E.jsx)(C.Qe,{type:"prev",text:e.text,href:(0,O.AP)(e.link)}):null}),(0,E.jsx)("div",{className:`${tx} flex flex-col`,children:t?(0,E.jsx)(C.Qe,{type:"next",text:t.text,href:(0,O.AP)(t.link)}):null})]})]})}function tb(e){var{icon:t}=e,n=eA(e,["icon"]);return t?"string"==typeof t?(0,E.jsx)("img",eN({src:t,alt:""},n)):(0,E.jsx)(t,eN({},n)):null}function ty({outlineTitle:e,beforeSidebar:t,afterSidebar:n,uiSwitch:i}){let[r,o]=(0,N.useState)(!1),[a,l]=(0,N.useState)(!1),s=(0,N.useRef)(),d=(0,N.useRef)(),{pathname:c}=(0,T.TH)();(0,N.useEffect)(()=>{o(!1)},[c]),(0,N.useEffect)(()=>(document.addEventListener("mouseup",u),document.addEventListener("touchend",u),()=>{document.addEventListener("mouseup",u),document.removeEventListener("touchend",u)}),[]);let u=e=>{let{current:t}=d;if(null==t?void 0:t.contains(e.target))return;let{current:n}=s;n&&!n.contains(e.target)&&l(!1)};return(0,E.jsxs)(N.Fragment,{children:[(0,E.jsxs)("div",{className:"rspress-sidebar-menu",children:[i.showSidebar?(0,E.jsxs)("button",{onClick:function(){o(!0)},className:"flex-center mr-auto",children:[(0,E.jsx)("div",{className:"text-md mr-2",children:(0,E.jsx)(tb,{icon:Z.Z})}),(0,E.jsx)("span",{className:"text-sm",children:"Menu"})]}):null,i.showAside?(0,E.jsxs)(N.Fragment,{children:[(0,E.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex-center ml-auto",ref:d,children:[(0,E.jsx)("span",{className:"text-sm",children:e}),(0,E.jsx)("div",{className:"text-md mr-2",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease-out",marginTop:"2px"},children:(0,E.jsx)(tb,{icon:W.Z})})]}),(0,E.jsx)(U.Z,{in:a,timeout:300,unmountOnExit:!0,classNames:"fly-in",nodeRef:s,children:(0,E.jsx)("div",{className:"rspress-local-toc-container",ref:s,children:(0,E.jsx)(C.of,{onItemClick:()=>{l(!1)}})})})]}):null]}),i.showSidebar?(0,E.jsxs)(N.Fragment,{children:[(0,E.jsx)(C.YE,{isSidebarOpen:r,beforeSidebar:t,afterSidebar:n,uiSwitch:i}),r?(0,E.jsx)("div",{onClick:function(){o(!1)},className:"rspress-sidebar-back-drop",style:{background:"rgba(0, 0, 0, 0.6)"}}):null]}):null]})}var tw=(0,N.createContext)({}),tk={asideContainer:"aside-container_edeb4",docLayout:"docLayout_edeb4",content:"content_edeb4"};function tj(e){var t,n;let{beforeDocFooter:i,afterDocFooter:r,beforeDoc:o,afterDoc:a,beforeOutline:l,afterOutline:s,beforeSidebar:d,afterSidebar:c,uiSwitch:u}=e,{siteData:h,page:p}=(0,P.Vi)(),{toc:m=[],frontmatter:f}=p,[g,x]=(0,N.useState)({}),{themeConfig:v}=h,b=null!=(t=v.enableScrollToTop)&&t,y=e$(),w=(null==y?void 0:y.outlineTitle)||(null==v?void 0:v.outlineTitle)||"ON THIS PAGE",k=null!=(n=null==f?void 0:f.overview)&&n,j=(0,E.jsx)(tw.Provider,{value:{tabData:g,setTabData:x},children:(0,E.jsx)(_.Zo,{components:(0,C.TJ)(),children:(0,E.jsx)(z.V,{})})});return(0,E.jsxs)("div",{className:`${tk.docLayout} pt-0`,style:eN({},u.showNavbar?{}:{marginTop:0}),children:[o,(0,E.jsx)(ty,{outlineTitle:w,beforeSidebar:d,afterSidebar:c,uiSwitch:u}),(0,E.jsxs)("div",{className:`${tk.content} rspress-doc-container flex flex-shrink-0 mx-auto`,children:[(0,E.jsx)("div",{className:"w-full flex-1",children:k?(0,E.jsx)(C.g2,{content:j}):(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"rspress-doc",children:j}),(0,E.jsxs)("div",{className:"rspress-doc-footer",children:[i,u.showDocFooter&&(0,E.jsx)(tv,{}),r]})]})}),b&&(0,E.jsx)(A.r,{children:(0,E.jsx)(C.pU,{})}),u.showAside?(0,E.jsx)("div",{className:tk.asideContainer,style:eN({},u.showNavbar?{}:{marginTop:0,paddingTop:"32px"}),children:(0,E.jsxs)("div",{children:[l,(0,E.jsx)(tf,{headers:m,outlineTitle:w}),s]})}):null]}),a]})}var tI=e=>{var t;let{top:n,bottom:i,beforeDocFooter:r,afterDocFooter:o,beforeDoc:a,afterDoc:l,beforeSidebar:s,afterSidebar:d,beforeOutline:c,afterOutline:u,beforeNavTitle:h,afterNavTitle:p,beforeNav:m,beforeHero:f,afterHero:g,beforeFeatures:x,afterFeatures:v,afterNavMenu:b}=e,y={beforeDocFooter:r,afterDocFooter:o,beforeDoc:a,afterDoc:l,beforeSidebar:s,afterSidebar:d,beforeOutline:c,afterOutline:u},w={beforeHero:f,afterHero:g,beforeFeatures:x,afterFeatures:v},{siteData:k,page:j}=(0,P.Vi)(),{pageType:I,lang:_,title:A,frontmatter:O}=j,M=e$();tr();let L=null!=(t=null==O?void 0:O.title)?t:A,D=k.title||M.title;L=L&&"doc"===I?`${L} - ${D}`:D;let R=(null==O?void 0:O.description)||k.description||M.description,B=function(){var e,t;let{page:n,siteData:i}=(0,P.Vi)(),{frontmatter:r}=n,{themeConfig:o}=i,a=e$(),l=(0,T.TH)(),s=null!=(e=null==r?void 0:r.overview)&&e,d=()=>{var e,t;let n="undefined"==typeof window||window.top===window.self;return(null!=(t=null!=(e=null==r?void 0:r.outline)?e:null==o?void 0:o.outline)?t:n)&&!s},[c,u]=eU(),[h,p]=(0,N.useState)(d()),[m,f]=(0,N.useState)(null==(t=null==r?void 0:r.footer)||t),g=a.sidebar||{},x=(null==r?void 0:r.sidebar)!==!1&&Object.keys(g).length>0;return(0,N.useEffect)(()=>{p(d())},[n,i]),(0,N.useEffect)(()=>{let e=new URLSearchParams(l.search),t=document.documentElement.style,n=t.getPropertyValue("--rp-sidebar-width"),i=t.getPropertyValue("--rp-aside-width"),r=e.get("navbar"),o=e.get("sidebar"),a=e.get("outline"),s=e.get("footer");return"0"===r&&u(!1),"0"===o&&document.documentElement.style.setProperty("--rp-sidebar-width","0px"),"0"===a&&document.documentElement.style.setProperty("--rp-aside-width","0px"),"0"===s&&f(!1),()=>{document.documentElement.style.setProperty("--rp-sidebar-width",n),document.documentElement.style.setProperty("--rp-aside-width",i),u(c),f(m)}},[l.search]),{showAside:h,showNavbar:c,showSidebar:x,showDocFooter:m}}();return(0,E.jsxs)("div",{children:[(0,E.jsxs)(S.ql,{htmlAttributes:{lang:_||"en"},children:[L?(0,E.jsx)("title",{children:L}):null,R?(0,E.jsx)("meta",{name:"description",content:R}):null]}),n,"blank"!==I&&B.showNavbar&&(0,E.jsx)(C.JL,{beforeNavTitle:h,afterNavTitle:p,beforeNav:m,afterNavMenu:b}),(0,E.jsx)("section",{children:(()=>{switch(I){case"home":return(0,E.jsx)(C.ZP.HomeLayout,eN({},w));case"doc":return(0,E.jsx)(tj,e_(eN({},y),{uiSwitch:B}));case"404":return(0,E.jsx)(C.ZP.NotFoundLayout,{});case"custom":case"blank":return(0,E.jsx)(z.V,{});default:return(0,E.jsx)(tj,eN({},y))}})()}),i]})};function tP(e){let{beforeHero:t,afterHero:n,beforeFeatures:i,afterFeatures:r}=e,{page:{frontmatter:o}}=(0,P.Vi)();return(0,E.jsxs)("div",{className:"relative",style:{minHeight:"calc(100vh - var(--rp-nav-height))",paddingBottom:"80px"},children:[(0,E.jsxs)("div",{className:"pb-12",children:[t,(0,E.jsx)(C.xB,{frontmatter:o}),n,i,(0,E.jsx)(C.BZ,{frontmatter:o}),r]}),(0,E.jsx)(C.xK,{})]})}var tE={title:"title_3b154",blockquote:"blockquote_3b154",link:"link_3b154","inline-link":"inline-link_3b154"},tS=e=>(0,E.jsx)("h1",e_(eN({},e),{className:`text-3xl mb-10 leading-10 tracking-tight ${tE.title}`})),tC=e=>(0,E.jsx)("h2",e_(eN({},e),{className:`mt-12 mb-6 pt-8 text-2xl tracking-tight border-t-[1px] border-divider-light ${tE.title}`})),tz=e=>(0,E.jsx)("h3",e_(eN({},e),{className:`mt-10 mb-2 leading-7 text-xl ${tE.title}`})),tN=e=>(0,E.jsx)("h4",e_(eN({},e),{className:`mt-8 leading-6 text-base ${tE.title}`})),t_=e=>(0,E.jsx)("h5",e_(eN({},e),{className:tE.title})),tA=e=>(0,E.jsx)("h6",e_(eN({},e),{className:tE.title})),tT=e=>(0,E.jsx)("ol",e_(eN({},e),{className:"list-decimal pl-5 my-4 leading-7"})),tO=e=>(0,E.jsx)("ul",e_(eN({},e),{className:"list-disc pl-5 my-4 leading-7"})),tM=e=>(0,E.jsx)("li",e_(eN({},e),{className:"[&:not(:first-child)]:mt-2"})),tL=e=>(0,E.jsx)("table",e_(eN({},e),{className:"block border-collapse text-base my-5 overflow-x-auto leading-7 border-gray-light-2"})),tD=e=>(0,E.jsx)("tr",e_(eN({},e),{className:"border border-solid transition-colors duration-500 even:bg-soft border-gray-light-2"})),tR=e=>(0,E.jsx)("td",e_(eN({},e),{className:"border border-solid px-4 py-2 border-gray-light-2"})),tB=e=>(0,E.jsx)("th",e_(eN({},e),{className:"border border-solid px-4 py-2 text-text-1 text-base font-semibold border-gray-light-2"})),t$=e=>(0,E.jsx)("hr",e_(eN({},e),{className:"my-12 border-t border-solid border-divider-light"})),tF=e=>{let{href:t="",className:n=""}=e,{normalizeLinkHref:i}=eQ();return n.includes("header-anchor")||t.startsWith("#")?(0,E.jsx)("a",e_(eN({},e),{className:`${tE.link} ${n}`})):(0,E.jsx)(C.rU,e_(eN({},e),{className:`${n} ${tE.link} ${tE["inline-link"]}`,href:i(t)}))},tH=e=>(0,E.jsx)("p",e_(eN({},e),{className:"my-4 leading-7"})),tZ=e=>(0,E.jsx)("blockquote",e_(eN({},e),{className:`border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${tE.blockquote}`})),tW=e=>(0,E.jsx)("strong",e_(eN({},e),{className:"font-semibold"})),tU={"code-button-group":"code-button-group_15153",codeButtonGroup:"code-button-group_15153","code-copy-button":"code-copy-button_15153",codeCopyButton:"code-copy-button_15153","icon-success":"icon-success_15153",iconSuccess:"icon-success_15153","code-copied":"code-copied_15153",codeCopied:"code-copied_15153","icon-copy":"icon-copy_15153",iconCopy:"icon-copy_15153","icon-wrapped":"icon-wrapped_15153",iconWrapped:"icon-wrapped_15153","wrapped-btn":"wrapped-btn_15153",wrappedBtn:"wrapped-btn_15153","icon-wrap":"icon-wrap_15153",iconWrap:"icon-wrap_15153"},tq={doctype:{color:"var(--code-token-text)",fontStyle:"italic"},token:{color:"var(--code-token-text)"},comment:{color:"var(--code-token-comment)"},punctuation:{color:"var(--code-token-punctuation)"},property:{color:"var(--code-token-parameter)"},constant:{color:"var(--code-token-constant)"},string:{color:"var(--code-token-string)"},symbol:{color:"var(--code-token-symbol)"},variable:{color:"var(--code-token-variable)"},"attr-name":{color:"var(--code-token-symbol)"},"attr-value":{color:"var(--code-token-string-expression)"},builtin:{color:"var(--code-token-symbol)"},function:{color:"var(--code-token-function)"},keyword:{color:"var(--code-token-keyword)"},tag:{color:"var(--code-token-function)"},inserted:{color:"#22863a"},deleted:{color:"#b31d28"},regex:{color:"var(--code-token-keyword)"},key:{color:"var(--code-token-variable)"},title:{color:"var(--code-token-keyword)"},important:{color:"#EBCB8B",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},table:{display:"content"}},tV=!1;function tG(e){var t;let{siteData:n}=(0,P.Vi)(),{meta:i,language:r,codeWrap:o}=e,{showLineNumbers:a}=n.markdown,l="",s=[];return i&&(l=(null==(t=/{[\d,-]*}/i.exec(i))?void 0:t[0])||"")&&(s=l.replace(/[{}]/g,"").split(",").map(e=>{let[t,n]=e.split("-");return n?Array.from({length:Number(n)-Number(t)+1},(e,n)=>n+Number(t)):Number(t)}).flat()),!tV&&(Object.keys(G.Z).forEach(e=>{Y.Z.registerLanguage(e,G.Z[e])}),tV=!0),(0,E.jsx)(Y.Z,{language:r,style:tq,wrapLines:!0,className:"code",wrapLongLines:o,customStyle:{backgroundColor:"inherit"},showLineNumbers:a||s.length>0,lineProps:e=>({style:e_(eN({},s.includes(e)?{backgroundColor:"var(--rp-code-line-highlight-color)"}:{}),{display:"block",padding:"0 1.25rem"})}),children:String(e.children).trim()})}var tY=new Map;function tQ({codeBlockRef:e}){let t=(0,N.useRef)(null);return(0,E.jsxs)("button",{className:tU.codeCopyButton,onClick:()=>(function(e,t){let n="",i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),r=i.nextNode();for(;r;)!r.parentElement.classList.contains("linenumber")&&(n+=r.nodeValue),r=i.nextNode();if(Q(n)&&t){t.classList.add(tU.codeCopied),clearTimeout(tY.get(t));let e=setTimeout(()=>{t.classList.remove(tU.codeCopied),t.blur(),tY.delete(t)},2e3);tY.set(t,e)}})(e.current,t.current),ref:t,children:[(0,E.jsx)(tb,{icon:K.Z,className:tU.iconCopy}),(0,E.jsx)(tb,{icon:J.Z,className:tU.iconSuccess})]})}function tK(e){var t;let{siteData:n}=(0,P.Vi)(),i=null!=(t=e.codeHighlighter)?t:n.markdown.codeHighlighter,{defaultWrapCode:r}=n.markdown,[o,a]=(0,N.useState)(r),l=(0,N.useRef)(null),s=(0,N.useRef)(),{className:d}=e,c=null==d?void 0:d.replace(/language-/,"");if(!c)return(0,E.jsx)("code",eN({},e));let u=e=>{o?null==e||e.classList.remove(tU.wrappedBtn):null==e||e.classList.add(tU.wrappedBtn),a(!o)};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{ref:s,children:(()=>{if("prism"===i)return(0,E.jsx)(tG,e_(eN({},e),{language:c,codeWrap:o}));return(0,E.jsx)("code",eN({},e))})()}),(0,E.jsxs)("div",{className:tU.codeButtonGroup,children:[(0,E.jsxs)("button",{ref:l,className:tU.codeWrapButton,onClick:()=>u(l.current),children:[(0,E.jsx)(tb,{icon:V.Z,className:tU.iconWrapped}),(0,E.jsx)(tb,{icon:q.Z,className:tU.iconWrap})]}),(0,E.jsx)(tQ,{codeBlockRef:s})]})]})}function tJ({children:e}){let t=e=>{let{className:t,meta:n}=e.props,i=function(e){var t,n;if(!e)return"";let i=e,r=/{[\d,-]*}/i;return(null==(t=r.exec(e))?void 0:t[0])&&(i=e.replace(r,"").trim()),null==(i=null!=(n=i.split("=")[1])?n:"")?void 0:i.replace(/["'`]/g,"")}(n);return(0,E.jsxs)("div",{className:t||"language-bash",children:[i&&(0,E.jsx)("div",{className:"rspress-code-title",children:i}),(0,E.jsx)("div",{className:"rspress-code-content rspress-scrollbar",children:e})]})};return Array.isArray(e)?(0,E.jsx)("div",{children:e.map(e=>t(e))}):t(e)}var tX=e=>(0,E.jsx)("img",e_(eN({},e),{src:(0,O.i6)(e.src||"")}));function t0(){return{h1:tS,h2:tC,h3:tz,h4:tN,h5:t_,h6:tA,ul:tO,ol:tT,li:tM,table:tL,td:tR,th:tB,tr:tD,hr:t$,p:tH,blockquote:tZ,strong:tW,a:tF,code:tK,pre:tJ,img:tX}}var t1={badge:"badge_99dcf",info:"info_99dcf",warning:"warning_99dcf",danger:"danger_99dcf"};function t2(e){let{text:t,type:n="info"}=e;return(0,E.jsx)("span",{className:`inline-block rounded-full border border-solid border-transparent font-medium ${t1.badge} ${t1[n]}`,children:t})}var t3={button:"button_72e53",medium:"medium_72e53",big:"big_72e53",brand:"brand_72e53",alt:"alt_72e53"};function t4(e){let{theme:t="brand",size:n="big",href:i="/",external:r=!1,className:o=""}=e,a=null;return"button"===e.type?a="button":"a"===e.type&&(a=r?"a":C.rU),N.createElement(null!=a?a:"a",{className:`${t3.button} ${t3[t]} ${t3[n]} ${o}`,href:i},e.text)}var t5={editLink:"editLink_2a169"};function t6(){let e=eW();if(!e)return null;let{text:t,link:n}=e;return(0,E.jsx)("a",{href:n,target:"_blank",className:t5.editLink,children:t})}var t7={"grid-2":"grid-2_d48e3",grid2:"grid-2_d48e3","grid-4":"grid-4_d48e3",grid4:"grid-4_d48e3","grid-6":"grid-6_d48e3",grid6:"grid-6_d48e3","grid-3":"grid-3_d48e3",grid3:"grid-3_d48e3",featureCard:"featureCard_d48e3"},t8=e=>{let{span:t}=e;return`grid-${t||4}`};function t9({frontmatter:e}){let t=null==e?void 0:e.features;return(0,E.jsx)("div",{className:"overflow-hidden m-auto flex flex-wrap max-w-6xl",children:null==t?void 0:t.map(e=>{let{icon:t,title:n,details:i,link:r}=e;return(0,E.jsx)("div",{className:`${t7[t8(e)]} rounded hover:var(--rp-c-brand)`,children:(0,E.jsx)("div",{className:"h-full p-2",children:(0,E.jsxs)("article",{className:`rspress-home-feature-card ${t7.featureCard} h-full p-8 rounded-4xl border-transparent`,style:{cursor:r?"pointer":"auto"},onClick:()=>{r&&(window.location.href=r)},children:[t?(0,E.jsx)("div",{className:"flex-center",children:(0,E.jsx)("div",{className:"rspress-home-feature-icon w-12 h-12 text-3xl text-center",children:t})}):null,(0,E.jsx)("h2",{className:"rspress-home-feature-title font-bold text-center",children:n}),(0,E.jsx)("p",{className:"rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",children:tp(i)})]},n)})},n)})})}function ne(){let{siteData:e}=(0,P.Vi)(),{message:t}=e.themeConfig.footer||{};return(0,E.jsx)("footer",{className:"absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",children:(0,E.jsx)("div",{className:"m-auto w-full text-center",children:t&&(0,E.jsx)("div",{className:"font-meduim text-sm text-text-2",children:t})})})}var nt="clip_c867a",nn="mask_c867a",ni={name:"modern",text:"modern ssg",tagline:"modern ssg",actions:[],image:void 0};function nr({frontmatter:e}){var t,n,i,r,o;let a=(null==e?void 0:e.hero)||ni,l=void 0!==a.image,s=l?"sm:max-w-xl":"sm:max-w-4xl",d=a.text?a.text.toString().split(/\n/g).filter(e=>""!==e):[];return(0,E.jsxs)("div",{className:"m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16 relative",children:[(0,E.jsx)("div",{className:nn,style:{left:l?"75%":"50%"}}),(0,E.jsxs)("div",{className:"m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh] mt-12 sm:mt-0",children:[(0,E.jsxs)("div",{className:"flex flex-col justify-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1",children:[(0,E.jsx)("h1",{className:"font-bold text-3xl pb-2 sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-2 leading-tight z-10",children:(0,E.jsx)("span",{className:nt,style:{lineHeight:"1.3"},children:tp(a.name)})}),0!==d.length&&d.map(e=>(0,E.jsx)("p",{className:`rspress-home-hero-text mx-auto md:m-0 text-3xl sm:text-5xl md:text-6xl sm:pb-2 font-bold z-10 ${s}`,style:{lineHeight:"1.2"},children:tp(e)},e)),(0,E.jsx)("p",{className:`rspress-home-hero-tagline whitespace-pre-wrap pt-4 m-auto md:m-0 text-sm sm:tex-xl md:text-2xl text-text-2 font-medium z-10 ${s}`,children:tp(a.tagline)}),(null==(t=a.actions)?void 0:t.length)&&(0,E.jsx)("div",{className:"grid md:flex md:flex-wrap md:justify-center gap-3 m--1.5 pt-6 sm:pt-8 z-10",children:a.actions.map(e=>(0,E.jsx)("div",{className:"flex flex-shrink-0 p-1",children:(0,E.jsx)(C.zx,{type:"a",text:tp(e.text),href:(0,O.AP)(e.link),theme:e.theme,className:"w-full"})},e.link))})]}),l?(0,E.jsx)("div",{className:"rspress-home-hero-image md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",children:(0,E.jsx)("img",{src:(0,O.i6)(null==(n=a.image)?void 0:n.src),alt:null==(i=a.image)?void 0:i.alt,srcSet:no(null==(r=a.image)?void 0:r.srcset),sizes:no(null==(o=a.image)?void 0:o.sizes),width:375,height:375})}):null]})]})}function no(e){return(Array.isArray(e)?e:[e]).filter(Boolean).join(", ")||void 0}function na(){let{lastUpdatedText:e="Last Updated"}=e$(),{page:{lastUpdatedTime:t},siteData:n}=(0,P.Vi)(),{themeConfig:i}=n,r=(null==i?void 0:i.lastUpdatedText)||e;return(0,E.jsx)("div",{className:"flex text-sm text-text-2 leading-6 sm:leading-8 font-medium",children:(0,E.jsxs)("p",{children:[r,": ",(0,E.jsx)("span",{children:t})]})})}var nl={link:"link_03735"};function ns(e){let{href:t="/",children:n,className:i="",onNavigate:r,keepCurrentParams:o=!1}=e,a=eA(e,["href","children","className","onNavigate","keepCurrentParams"]),l=(0,M.xf)(t),s=l?"_blank":"",d=l?"noopener noreferrer":void 0,c=l?t:(0,O.pJ)((0,O.AP)(t)),u=(0,T.s0)(),{pathname:h,search:p}=(0,T.TH)(),m=o?c+p:c,f=(0,O.pV)(h,c);return l?(0,E.jsx)("a",e_(eN({},a),{href:c,target:s,rel:d,className:`${nl.link} ${i}`,children:n})):(0,E.jsx)("a",e_(eN({},a),{className:`${nl.link} ${i} cursor-pointer`,rel:d,target:s,onClick:e=>eR(this,null,function*(){if(0!==e.button||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return;e.preventDefault();let t=c.split("#")[1];if(!l&&f&&t){let e=document.getElementById(t);e&&eV(e,!0);return}if(!f){let e=(0,X.fp)(et.routes,(0,O.Tm)(c));if(null==e?void 0:e.length){let t=setTimeout(()=>{ee.start()},200);yield e[0].route.preload(),clearTimeout(t),ee.done()}null==r||r(),u(m,{replace:!1})}}),href:c,children:n}))}ee.configure({showSpinner:!1});var nd={hidden:"hidden_f6cde",container:"container_f6cde",navContainer:"navContainer_f6cde",leftNav:"leftNav_f6cde",rightNav:"rightNav_f6cde",singleItem:"singleItem_f6cde",activeItem:"activeItem_f6cde",navBarTitle:"navBarTitle_f6cde","social-links-icon":"social-links-icon_f6cde",socialLinksIcon:"social-links-icon_f6cde","menu-item":"menu-item_f6cde",menuItem:"menu-item_f6cde",mobileNavMenu:"mobileNavMenu_f6cde",mask:"mask_f6cde",docPage:"docPage_f6cde"};function nc(e){let{pathname:t,base:n}=e,i=new RegExp(e.activeMatch||e.link).test((0,M.tz)(t,n));return(0,E.jsx)(C.rU,{href:(0,O.AP)(e.link),children:(0,E.jsxs)("div",{className:`rspress-nav-menu-item ${nd.singleItem} ${i?nd.activeItem:""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,children:[(0,E.jsx)(C.Vp,{tag:e.tag}),e.text,e.rightIcon]},e.text)})}function nu({onClick:e}){let{theme:t,setTheme:n}=(0,N.useContext)(P.Ni);return(0,E.jsx)("div",{onClick:()=>{n("dark"===t?"light":"dark"),null==e||e()},className:"md:mr-2 rspress-nav-appearance",children:(0,E.jsxs)("div",{className:"p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300 w-7 h-7",children:[(0,E.jsx)(tb,{className:"dark:hidden",icon:er.Z,width:"18",height:"18",fill:"currentColor"}),(0,E.jsx)(tb,{className:"hidden dark:block",icon:eo.Z,width:"18",height:"18",fill:"currentColor"})]})})}var nh={socialLinksIcon:"social-links-icon_93d67",menuItem:"menu-item_93d67"},np={discord:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Discord"}),(0,E.jsx)("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]}),facebook:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Facebook"}),(0,E.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})]}),github:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"GitHub"}),(0,E.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),gitlab:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"GitLab"}),(0,E.jsx)("path",{fill:"currentColor",d:"m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"})]}),instagram:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Instagram"}),(0,E.jsx)("path",{d:"M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"})]}),linkedin:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"LinkedIn"}),(0,E.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})]}),slack:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Slack"}),(0,E.jsx)("path",{d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})]}),twitter:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Twitter"}),(0,E.jsx)("path",{d:"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"})]}),youtube:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"YouTube"}),(0,E.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})]}),juejin:(0,E.jsxs)("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg","data-spm-anchor-id":"a313x.7781069.0.i5",children:[(0,E.jsx)("path",{d:"M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z","data-spm-anchor-id":"a313x.7781069.0.i2"}),(0,E.jsx)("path",{d:"M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z","data-spm-anchor-id":"a313x.7781069.0.i3"})]}),qq:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"})}),wechat:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"})}),weibo:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"})}),zhihu:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"})}),bilibili:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,E.jsx)("path",{fill:"currentColor",d:"M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"})}),lark:(0,E.jsxs)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"Lark"}),(0,E.jsx)("path",{d:"M8.813 5.477c1.038.836 2.286 2.045 3.3 3.495.171.23.377.576.457.71l.034.056a8.803 8.803 0 0 0-.922 1.3l-.271-.494C9.655 7.53 6.3 5.477 6.137 5.377a.447.447 0 0 1-.006-.004l-.666-.393-.107-.086a.499.499 0 0 1 .306-.885L6.084 4h7.997c.159.006.318.037.47.092.174.064.317.174.458.308.134.143.272.296.403.448.622.675 1.324 1.688 1.324 1.688-.573.193-1.349.736-1.349.736a5.095 5.095 0 0 0-.348-.54 20.665 20.665 0 0 0-1.037-1.255H8.813Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M18.482 7.507a5.42 5.42 0 0 1 4.04.717c.248.168.788.635.242 1.233-1.7 1.67-2.194 3.225-2.63 4.599-.278.873-.541 1.697-1.066 2.424-1.813 2.508-4.114 4-6.837 4.434-.561.089-1.132.131-1.7.131-3.958 0-7.498-2.035-8.75-2.844h.003l-.161-.107c-.534-.378-.61-.723-.623-.989V7.055a.486.486 0 0 1 .827-.317l.482.589c5.082 6.201 9.126 8.063 11.626 8.53 2.246.424 3.631-.165 4.022-.37.333-.51.534-1.143.764-1.865l.006-.021c.406-1.276.898-2.821 2.322-4.477a3.93 3.93 0 0 0-2.28-.168c-1.761.394-3.403 1.96-4.89 4.643a8.27 8.27 0 0 0-.341.671c-.724-.107-1.334-.65-1.334-.65.128-.269.22-.455.345-.672 1.718-3.125 3.714-4.962 5.933-5.441ZM2.477 16.889c1.145.744 5.341 3.232 9.532 2.563 1.56-.247 2.963-.915 4.196-1.99-2.771.254-7.557-.753-13.728-7.666v7.093Z",fill:"currentColor"})]}),X:(0,E.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("title",{children:"X"}),(0,E.jsx)("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})]})},nm=e=>{let{link:t,popperStyle:n={}}=e,{icon:i,mode:r="link",content:o}=t,a="object"==typeof i?(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:i.svg}}):np[i],[l,s]=(0,N.useState)(!1),d=()=>{s(!0)},c=()=>{s(!1)};return"link"===r?(0,E.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"social-links",children:(0,E.jsx)("div",{className:`${nh.socialLinksIcon}`,children:a})},o):"text"===r?(0,E.jsxs)("div",{className:`${nh.socialLinksIcon} cursor-pointer relative mx-3`,onMouseEnter:d,onMouseLeave:c,children:[a,l?(0,E.jsx)("div",{style:eN({boxShadow:"var(--rp-shadow-3)",border:"1px solid var(--rp-c-divider-light)"},n),className:"z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",children:(0,E.jsx)("div",{className:"text-md",children:o})}):null]}):"img"===r?(0,E.jsxs)("div",{className:`${nh.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[a,l?(0,E.jsx)("div",{className:"break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",style:eN({boxShadow:"var(--rp-shadow-3)"},n),children:(0,E.jsx)("img",{src:o,alt:"img"})}):null]}):(0,E.jsx)("div",{})},nf=e=>{let{links:t,moreIconVisible:n=!1,mouseEnter:i}=e;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"flex-center h-full gap-x-4 transition-colors duration-300 md:mr-2",children:t.map((e,t)=>(0,E.jsx)(nm,{link:e,popperStyle:{top:"2.5rem"}},t))}),n?(0,E.jsx)("div",{className:"md:ml-1 p-2",onMouseEnter:i,children:(0,E.jsx)(tb,{icon:ea.Z})}):null]})},ng=e=>{let{links:t}=e;return(0,E.jsx)("div",{style:{boxShadow:"var(--rp-shadow-3)",marginRight:"-2px",border:"1px solid var(--rp-c-divider-light)",background:"var(--rp-c-bg)"},className:"absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",children:t.map(e=>(0,E.jsx)(nm,{link:e,popperStyle:{top:"1.25rem"}},e.content))})},nx=({socialLinks:e})=>{let t=e.length>3,n=[],i=[];e.forEach((e,t)=>{t<3?n.push(e):i.push(e)});let[r,o]=(0,N.useState)(!1);return(0,E.jsxs)("div",{className:`social-links ${nh.menuItem} flex-center relative`,onMouseLeave:()=>o(!1),children:[(0,E.jsx)(nf,{links:n,moreIconVisible:t,mouseEnter:()=>o(!0)}),r?(0,E.jsx)(ng,{links:i}):null]})};function nv(){var e,t;let{siteData:n,page:i}=(0,P.Vi)(),r=(0,P.aw)(),{pathname:o,search:a}=(0,T.TH)(),l=n.lang||"",s=n.multiVersion.default||"",d=Object.values(n.locales||n.themeConfig.locales||{}),c=(null==(e=n.route)?void 0:e.cleanUrls)||!1,u=d.length>1,{lang:h}=i,{base:p}=n;return u?{text:(0,E.jsx)(tb,{icon:el.Z,style:{width:"18px",height:"18px"}}),items:d.map(e=>({text:null==e?void 0:e.label,link:(0,M.$U)(o+a,{current:h,target:e.lang,default:l},{current:r,default:s},p,c)})),activeValue:null==(t=d.find(e=>h===e.lang))?void 0:t.label}:null}function nb(){var e;let{siteData:t}=(0,P.Vi)(),n=(0,P.aw)(),{pathname:i}=(0,T.TH)(),r=(null==(e=t.route)?void 0:e.cleanUrls)||!1,o=t.multiVersion.default||"",a=t.multiVersion.versions||[],{base:l}=t;return{items:a.map(e=>({text:e,link:(0,M.xM)(i,{current:n,target:e,default:o},l,r)})),text:n,activeValue:n}}var ny={navScreen:"navScreen_457e8",active:"active_457e8",container:"container_457e8",navMenu:"navMenu_457e8",navMenuItem:"navMenuItem_457e8",navAppearance:"navAppearance_457e8",socialAndAppearance:"socialAndAppearance_457e8",navScreenMenuGroup:"navScreenMenuGroup_457e8",open:"open_457e8",button:"button_457e8",buttonSpan:"buttonSpan_457e8",items:"items_457e8",down:"down_457e8"};function nw(e){let{activeValue:t}=e,[n,i]=(0,N.useState)(!1);function r({item:e}){return(0,E.jsx)("div",{className:"p-1 text-center",children:(0,E.jsx)("span",{className:"text-brand",children:e.text})})}function o({item:e}){return(0,E.jsx)("div",{className:"py-1 font-medium",children:(0,E.jsx)(C.rU,{href:e.link,children:(0,E.jsx)("div",{children:(0,E.jsx)("div",{className:"flex justify-center",children:(0,E.jsx)("span",{children:e.text})})})})})}let a=e=>t===e.text?(0,E.jsx)(r,{item:e},e.link):(0,E.jsx)(o,{item:e},e.link),l=e=>(0,E.jsxs)("div",{children:["link"in e?a(e):(0,E.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(a)]});return(0,E.jsxs)("div",{className:`${n?ny.open:""} ${ny.navScreenMenuGroup} relative`,children:[(0,E.jsxs)("button",{className:ny.button,onClick:()=>{i(!n)},children:[(0,E.jsx)("span",{className:ny.buttonSpan,children:e.text}),(0,E.jsx)(es.Z,{className:`${n?ny.open:""} ${ny.down} `})]}),(0,E.jsx)("div",{children:(0,E.jsx)("div",{className:ny.items,children:e.items.map(e=>(0,E.jsx)("div",{children:"items"in e?l(e):a(e)},e.text))})})]})}function nk(){let{nav:e}=e$(),t=(0,P.aw)();return Array.isArray(e)?e:[...e[t.length>0?t:"default"]]}var nj=()=>{let e=nv();return(0,E.jsx)("div",{className:`${ny.navTranslations} flex text-sm font-bold justify-center`,children:(0,E.jsx)("div",{className:"mx-1.5 my-1",children:(0,E.jsx)(nw,eN({},e))})})},nI=()=>{let e=nb();return(0,E.jsx)("div",{className:`${ny.navTranslations} flex text-sm font-bold justify-center`,children:(0,E.jsx)("div",{className:"mx-1.5 my-1",children:(0,E.jsx)(nw,eN({},e))})})};function nP(e){var t;let{isScreenOpen:n,siteData:i,pathname:r}=e,o=(0,N.useRef)(null),a=i.themeConfig.locales||[],l=a.length>1,s=i.multiVersion.versions.length>1,d=nk(),c=!1!==i.themeConfig.darkMode,u=(null==(t=null==i?void 0:i.themeConfig)?void 0:t.socialLinks)||[],h=u.length>0,p=a.map(e=>e.lang||"zh")||[],{base:m}=i;return(0,N.useEffect)(()=>(o.current&&n&&(0,ei.Qp)(o.current,{reserveScrollBarGap:!0}),()=>{(0,ei.tP)()}),[n]),(0,E.jsx)("div",{className:`${ny.navScreen} ${n?ny.active:""}`,ref:o,id:"navScreen",children:(0,E.jsxs)("div",{className:ny.container,children:[(0,E.jsx)(({menuItems:e})=>(0,E.jsx)("div",{className:ny.navMenu,children:e.map(e=>(0,E.jsx)("div",{className:`${ny.navMenuItem} w-full`,children:"link"in e?(0,E.jsx)(nc,eN({pathname:r,base:m,langs:p},e),e.text):(0,E.jsx)("div",{className:"mx-3 last:mr-0",children:(0,E.jsx)(nw,e_(eN({},e),{items:"items"in e?e.items:e}))},e.text)},e.text))}),{menuItems:d}),(0,E.jsxs)("div",{className:"flex-center flex-col gap-2",children:[c&&(0,E.jsx)(()=>(0,E.jsx)("div",{className:`mt-2 ${ny.navAppearance} flex justify-center`,children:(0,E.jsx)(A.r,{children:(0,E.jsx)(nu,{})})}),{}),l&&(0,E.jsx)(nj,{}),s&&(0,E.jsx)(nI,{}),h&&(0,E.jsx)(nx,{socialLinks:u})]})]})})}var nE={navHamburger:"navHamburger_e7b06",active:"active_e7b06"};function nS(e){let{siteData:t,pathname:n}=e,{isScreenOpen:i,toggleScreen:r}=function(){let{pathname:e}=(0,T.TH)(),[t,n]=(0,N.useState)(!1);function i(){n(!0),window.addEventListener("resize",o)}function r(){n(!1),window.removeEventListener("resize",o)}function o(){window.outerWidth>=768&&r()}return(0,N.useEffect)(()=>{r()},[e]),{isScreenOpen:t,openScreen:i,closeScreen:r,toggleScreen:function(){t?r():i()}}}();return(0,E.jsxs)(N.Fragment,{children:[(0,E.jsx)(nP,{isScreenOpen:i,siteData:t,pathname:n}),(0,E.jsx)("button",{onClick:r,"aria-label":"mobile hamburger",className:`${i?nE.active:""} ${nE.navHamburger} text-gray-500`,children:(0,E.jsx)(tb,{icon:en.Z,fill:"currentColor"})})]})}function nC({item:e}){return(0,E.jsxs)("div",{className:"rounded-2xl my-1 flex",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:[e.tag&&(0,E.jsx)(C.Vp,{tag:e.tag}),(0,E.jsx)("span",{className:"text-brand",children:e.text})]},e.link)}function nz({item:e}){return(0,E.jsx)("div",{className:"font-medium my-1",children:(0,E.jsx)(C.rU,{href:e.link,children:(0,E.jsx)("div",{className:"rounded-2xl hover:bg-mute",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:(0,E.jsxs)("div",{className:"flex",children:[e.tag&&(0,E.jsx)(C.Vp,{tag:e.tag}),(0,E.jsx)("span",{children:e.text})]})})})},e.link)}function nN(e){let{activeValue:t,items:n,base:i="",link:r="",pathname:o=""}=e,[a,l]=(0,N.useState)(!1),s=e=>{let n=new RegExp(e.activeMatch||e.link).test((0,M.tz)(o,i));return t===e.text||!t&&n?(0,E.jsx)(nC,{item:e},e.link):(0,E.jsx)(nz,{item:e},e.link)},d=e=>(0,E.jsxs)("div",{children:["link"in e?s(e):(0,E.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(s)]});return(0,E.jsxs)("div",{className:"relative flex-center h-14",onMouseLeave:()=>l(!1),children:[(0,E.jsx)("button",{onMouseEnter:()=>l(!0),className:"rspress-nav-menu-group-button flex-center items-center font-medium text-sm text-text-1 hover:text-text-2 transition-colors duration-200",children:r?(0,E.jsx)(nc,e_(eN({},e),{rightIcon:(0,E.jsx)(tb,{icon:es.Z})})):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("span",{className:"text-sm font-medium flex",style:{marginRight:"2px"},children:[(0,E.jsx)(C.Vp,{tag:e.tag}),e.text]}),(0,E.jsx)(tb,{icon:es.Z})]})}),(0,E.jsx)("div",{className:"rspress-nav-menu-group-content absolute mx-0.8 transition-opacity duration-300",style:{opacity:a?1:0,visibility:a?"visible":"hidden",right:0,top:"52px"},children:(0,E.jsx)("div",{className:"p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",style:{boxShadow:"var(--rp-shadow-3)",zIndex:100,border:"1px solid var(--rp-c-divider-light)",borderRadius:"var(--rp-radius-large)",background:"var(--rp-c-bg)"},children:n.map(e=>(0,E.jsx)("div",{children:"items"in e?d(e):s(e)},e.text))})})]})}var n_=()=>{var e;let{siteData:t}=(0,P.Vi)(),n=e$(),{logo:i,logoText:r}=t,o=null!=(e=n.title)?e:t.title,a=(0,N.useMemo)(()=>i?"string"==typeof i?(0,E.jsx)("img",{src:(0,O.i6)(i),alt:"logo",id:"logo",className:"mr-4 rspress-logo"}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("img",{src:(0,O.i6)(i.light),alt:"logo",id:"logo",className:"mr-4 rspress-logo dark:hidden"}),(0,E.jsx)("img",{src:(0,O.i6)(i.dark),alt:"logo",id:"logo",className:"mr-4 rspress-logo hidden dark:block"})]}):null,[i]);return(0,E.jsx)("div",{className:`${nd.navBarTitle}`,children:(0,E.jsxs)("a",{href:(0,O.pJ)(n.langRoutePrefix||"/"),className:"flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",children:[a,r&&(0,E.jsx)("span",{children:r}),!a&&!r&&(0,E.jsx)("span",{children:o})]})})};function nA(){let e=nv();return(0,E.jsx)("div",{className:`translation ${nd.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,E.jsx)("div",{children:(0,E.jsx)(nN,eN({},e))})})}function nT(){let e=nb();return(0,E.jsx)("div",{className:`translation ${nd.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,E.jsx)("div",{children:(0,E.jsx)(nN,eN({},e))})})}function nO(e){var t;let{beforeNavTitle:n,afterNavTitle:i,beforeNav:r,afterNavMenu:o}=e,{siteData:a}=(0,P.Vi)(),{base:l}=a,{pathname:s}=(0,T.TH)(),[d,c]=(0,N.useState)(!1),u=eq(),h=Object.values(a.locales||a.themeConfig.locales||{}),p=h.length>1,m=a.multiVersion.versions.length>1,f=a.themeConfig.socialLinks||[],g=f.length>0,x=h.map(e=>e.lang||"")||[],v=()=>{c(th())};(0,N.useEffect)(()=>(window.addEventListener("resize",v),c(th()),()=>{window.removeEventListener("resize",v)}),[]);let b=({menuItems:e})=>(0,E.jsx)("div",{className:"rspress-nav-menu menu h-14",children:e.map(e=>"items"in e||Array.isArray(e)?(0,E.jsx)("div",{className:"mx-3 last:mr-0",children:(0,E.jsx)(nN,e_(eN({},e),{base:l,pathname:s,langs:x,items:"items"in e?e.items:e}))},e.text):(0,E.jsx)(nc,eN({pathname:s,langs:x,base:l},e),e.link))}),y=nk(),w=e=>{var t;return null!=(t=e.position)?t:"right"},k=y.filter(e=>"left"===w(e)),j=y.filter(e=>"right"===w(e)),I=(null==(t=null==a?void 0:a.themeConfig)?void 0:t.search)!==!1,S=!1!==a.themeConfig.darkMode;return(0,E.jsxs)(E.Fragment,{children:[r,(0,E.jsx)("div",{className:`${nd.navContainer} rspress-nav px-6 ${u&&!d?nd.hidden:""}`,style:{position:d?"relative":"sticky"},children:(0,E.jsxs)("div",{className:`${nd.container} flex justify-between items-center h-full`,children:[n,(0,E.jsx)(n_,{}),i,(0,E.jsxs)("div",{className:`${nd.content} flex flex-1 justify-end items-center`,children:[k.length>0?(0,E.jsx)("div",{className:nd.leftNav,children:(0,E.jsx)(b,{menuItems:k})}):null,(0,E.jsxs)("div",{className:nd.rightNav,children:[I&&(0,E.jsx)("div",{className:"flex sm:flex-1 items-center sm:pl-4 sm:pr-2",children:(0,E.jsx)(C.ol,{})}),(0,E.jsx)(b,{menuItems:j}),(0,E.jsxs)("div",{className:"flex-center flex-row",children:[p&&(0,E.jsx)(nA,{}),m&&(0,E.jsx)(nT,{}),S&&(0,E.jsx)("div",{className:"mx-2",children:(0,E.jsx)(nu,{})}),g&&(0,E.jsx)(nx,{socialLinks:f})]})]}),o,(0,E.jsxs)("div",{className:nd.mobileNavMenu,children:[d&&I&&(0,E.jsx)(C.ol,{}),(0,E.jsx)(nS,{siteData:a,pathname:s})]})]})]})})]})}var nM={"header-anchor":"header-anchor_8f375",headerAnchor:"header-anchor_8f375","overview-groups":"overview-groups_8f375",overviewGroups:"overview-groups_8f375","overview-group-li":"overview-group-li_8f375",overviewGroupLi:"overview-group-li_8f375","level-2":"level-2_8f375",level2:"level-2_8f375","level-3":"level-3_8f375",level3:"level-3_8f375","level-4":"level-4_8f375",level4:"level-4_8f375","overview-group":"overview-group_8f375",overviewGroup:"overview-group_8f375",header:"header_8f375"};function nL(e){let{siteData:t,page:{routePath:n,title:i,frontmatter:r}}=(0,P.Vi)(),{content:o,groups:a,defaultGroupTitle:l="Others"}=e,s=e=>(0,O.pJ)(e).startsWith(n.replace(/overview$/,""))&&!(0,O.pV)((0,O.pJ)(e),n),d=e=>"link"in e&&e.link?e.link:"items"in e?d(e.items[0]):"",c=(e,t,n)=>{for(let i of e){if((0,O.pJ)(i.link)===t)return[i];if(i.items){let e=c(i.items,t,n);if(e)return e}}return n},{pages:u}=t,h=u.filter(e=>s(e.routePath)),{items:p}=eH();function m(t,i,r){var o,a,l,s,c;if("dividerType"in t)return t;if((0,O.pJ)(t.link)===`${n}index`&&(null==r?void 0:r.overview)===!0)return!1;let u=null!=(s=null!=(l=null!=(a=null!=(o=null==e?void 0:e.overviewHeaders)?o:t.overviewHeaders)?a:null==r?void 0:r.overviewHeaders)?l:null==i?void 0:i.overviewHeaders)?s:[2],p=h.find(e=>(0,O.pV)(e.routePath,(0,O.pJ)(t.link||""))),m=d(t);return e_(eN({},t),{link:m,headers:(null==(c=null==p?void 0:p.toc)?void 0:c.filter(e=>u.some(t=>e.depth===t)))||[]})}p=c(p,n,p);let f=null!=a?a:(0,N.useMemo)(()=>{let e=p.filter(e=>"items"in e&&!!e.items&&e.items.filter(e=>s(d(e))).length>0).map(e=>({name:e.text||"",items:e.items.map(t=>m(t,e,r)).filter(Boolean)})),t=p.filter(e=>!("items"in e)&&s(e.link));return[...e,...t.length>0?[{name:l,items:t.map(e=>m(e))}]:[]]},[p,n,r]);return(0,E.jsxs)("div",{className:"overview-index mx-auto px-8",children:[(0,E.jsx)("div",{className:"flex items-center justify-between",children:!i&&(0,E.jsx)("h1",{className:"text-3xl leading-10 tracking-tight",children:"Overview"})}),o,f.map(e=>(0,E.jsxs)("div",{className:"mb-16",children:[e.name===l&&1===f.length?(0,E.jsx)("h2",{style:{paddingTop:0}}):(0,E.jsx)("h2",{children:tm(e.name)}),(0,E.jsx)("div",{className:nM.overviewGroups,children:e.items.map(e=>{var t;return(0,E.jsxs)("div",{className:nM.overviewGroup,children:[(0,E.jsx)("div",{className:"flex",children:(0,E.jsx)("h3",{style:{marginBottom:8},children:(0,E.jsx)(C.rU,{href:(0,O.AP)(e.link),children:tm(e.text)})})}),(0,E.jsx)("ul",{className:"list-none",children:null==(t=e.headers)?void 0:t.map(t=>(0,E.jsx)("li",{className:`${nM.overviewGroupLi} ${nM[`level${t.depth}`]} first:mt-2`,children:(0,E.jsx)(C.rU,{href:`${(0,O.AP)(e.link)}#${t.id}`,children:tm(t.text)})},t.id))})]},e.link)})})]},e.name))]})}function nD(e){return(0,E.jsxs)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256"},e),{children:[(0,E.jsx)("path",{fill:"#C12127",d:"M0 256V0h256v256z"}),(0,E.jsx)("path",{fill:"#FFF",d:"M48 48h160v160h-32V80h-48v128H48z"})]}))}function nR(e){return(0,E.jsx)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:(0,E.jsxs)("g",{fill:"#2c8ebb",children:[(0,E.jsx)("path",{d:"M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"}),(0,E.jsx)("path",{d:"M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"})]})}))}function nB(e){return(0,E.jsxs)("svg",e_(eN({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:[(0,E.jsx)("path",{fill:"#f8ab00",d:"M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"}),(0,E.jsx)("path",{fill:"#4c4c4c",d:"M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"})]}))}function n$(e){return(0,E.jsxs)("svg",e_(eN({id:"Bun",width:"1.2em",height:"1.2em",viewBox:"0 0 80 70"},e),{children:[(0,E.jsx)("path",{id:"Shadow",d:"M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"}),(0,E.jsxs)("g",{id:"Body",children:[(0,E.jsx)("path",{id:"Background",d:"M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z",style:{fill:"#fbf0df"}}),(0,E.jsx)("path",{id:"Bottom_Shadow","data-name":"Bottom Shadow",d:"M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z",style:{fill:"#f6dece"}}),(0,E.jsx)("path",{id:"Light_Shine","data-name":"Light Shine",d:"M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z",style:{fill:"#fffefc"}}),(0,E.jsx)("path",{id:"Top",d:"M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z",style:{fill:"#ccbea7",fillRule:"evenodd"}}),(0,E.jsx)("path",{id:"Outline",d:"M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"})]}),(0,E.jsxs)("g",{id:"Mouth",children:[(0,E.jsx)("g",{id:"Background-2","data-name":"Background",children:(0,E.jsx)("path",{d:"M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z",style:{fill:"#b71422"}})}),(0,E.jsxs)("g",{id:"Tongue",children:[(0,E.jsx)("path",{id:"Background-3","data-name":"Background",d:"M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z",style:{fill:"#ff6164"}}),(0,E.jsx)("path",{id:"Outline-2","data-name":"Outline",d:"M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"})]}),(0,E.jsx)("path",{id:"Outline-3","data-name":"Outline",d:"M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"})]}),(0,E.jsxs)("g",{id:"Face",children:[(0,E.jsx)("ellipse",{id:"Right_Blush","data-name":"Right Blush",cx:"53.22",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,E.jsx)("ellipse",{id:"Left_Bluch","data-name":"Left Bluch",cx:"22.95",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,E.jsx)("path",{id:"Eyes",d:"M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z",style:{fillRule:"evenodd"}}),(0,E.jsx)("path",{id:"Iris",d:"M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z",style:{fill:"#fff",fillRule:"evenodd"}})]})]}))}function nF(e){if(!(null==e?void 0:e.includes("install")))return e;let t=e.split(" ").filter(e=>!e.startsWith("-")&&!e.startsWith("--")).join(" ");return"yarn install"===t||"bun install"===t?e:e.replace("install","add")}function nH({command:e,additionalTabs:t=[]}){let n;let i={npm:(0,E.jsx)(nD,{}),yarn:(0,E.jsx)(nR,{}),pnpm:(0,E.jsx)(nB,{}),bun:(0,E.jsx)(n$,{})};return t.forEach(e=>{i[e.tool]=e.icon}),"string"==typeof e?(n={npm:`npm ${e}`,yarn:`yarn ${e}`,pnpm:`pnpm ${e}`,bun:`bun ${e}`},t.forEach(t=>{n[t.tool]=`${t.tool} ${e}`})):n=e,n.yarn&&(n.yarn=nF(n.yarn)),n.bun&&(n.bun=nF(n.bun)),(0,E.jsx)(C.mQ,{values:Object.entries(n).map(([e])=>(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:15},children:[i[e],(0,E.jsx)("span",{style:{marginLeft:6,marginBottom:2},children:e})]},e)),children:Object.entries(n).map(([e,t])=>(0,E.jsx)(C.OK,{children:(0,E.jsx)(tJ,{children:(0,E.jsx)(tK,{className:"language-js",codeHighlighter:"prism",children:t})})},e))})}var nZ={pagerLink:"pager-link_9b9a7",title:"title_9b9a7",next:"next_9b9a7",desc:"desc_9b9a7"};function nW(e){let{type:t,text:n,href:i}=e,{prevPageText:r="Previous Page",nextPageText:o="Next page"}=e$(),a="prev"===t?nZ.pagerLink:`${nZ.pagerLink} ${nZ.next}`;return(0,E.jsxs)(C.rU,{href:i,className:a,children:[(0,E.jsx)("span",{className:nZ.desc,children:"prev"===t?r:o}),(0,E.jsx)("span",{className:nZ.title,children:n})]})}var nU={scrollToTop:"scroll-to-top_1a167",entered:"entered_1a167"};function nq(){let[e,t]=(0,N.useState)(!1),n=()=>{t((window.scrollY||document.documentElement.scrollTop)>0)};return(0,N.useEffect)(()=>{window.addEventListener("scroll",n)},[]),(0,E.jsx)("button",{className:`${nU.scrollToTop} ${e?nU.entered:""}`,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},children:(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,E.jsx)("path",{fillRule:"evenodd",d:"M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"})})})}var nV={mask:"mask_6e282",modal:"modal_6e282",inputForm:"inputForm_6e282",input:"input_6e282",close:"close_6e282",searchHits:"searchHits_6e282",groupTitle:"groupTitle_6e282",navSearchButton:"navSearchButton_6e282",searchWord:"searchWord_6e282",suggestItem:"suggestItem_6e282",suggestItemContainer:"suggestItemContainer_6e282",contentWrapper:"contentWrapper_6e282",mark:"mark_6e282",titleForContent:"titleForContent_6e282",actionIcon:"actionIcon_6e282",current:"current_6e282",tabClassName:"tabClassName_6e282",mobileNavSearchButton:"mobileNavSearchButton_6e282"},nG={container:"container_fa768",tabList:"tab-list_fa768",tab:"tab_fa768",notSelected:"not-selected_fa768",selected:"selected_fa768",noScrollbar:"no-scrollbar_fa768"},nY=e=>{var t;return(t=e)&&"object"==typeof t&&"label"in t?e.label||e.value:e},nQ=(0,N.forwardRef)((e,t)=>{let{values:n,defaultValue:i,onChange:r,children:o,groupId:a,tabPosition:l="left",tabContainerClassName:s}=e,d=N.Children.toArray(o).filter(e=>!("string"==typeof e&&""===e.trim())),c=n||[];0===c.length&&(c=N.Children.map(d,e=>{var t,n,i;return(0,N.isValidElement)(e)?{label:null==(t=e.props)?void 0:t.label,value:(null==(n=e.props)?void 0:n.value)||(null==(i=e.props)?void 0:i.label)}:{label:void 0,value:void 0}}));let{tabData:u,setTabData:h}=(0,N.useContext)(tw),p=0;a&&void 0!==u[a]?p=u[a]:i&&(p=c.findIndex(e=>"string"==typeof e?e===i:!!e&&"object"==typeof e&&"value"in e&&e.value===i));let[m,f]=(0,N.useState)(p);return(0,E.jsxs)("div",{className:nG.container,ref:t,children:[(0,E.jsx)("div",{className:s,children:c.length?(0,E.jsx)("div",{className:`${nG.tabList} ${nG.noScrollbar}`,style:{justifyContent:"center"===l?"center":"flex-start"},children:c.map((e,t)=>(0,E.jsx)("div",{className:`${nG.tab} ${m===t?nG.selected:nG.notSelected}`,onClick:()=>{null==r||r(t),f(t),a&&h(e_(eN({},u),{[a]:t}))},children:nY(e)},t))}):null}),(0,E.jsx)("div",{children:N.Children.toArray(d)[m]})]})});function nK(e){var{children:t}=e,n=eA(e,["children"]);return(0,E.jsx)("div",e_(eN({},n),{className:"rounded px-2",children:t}))}function nJ({query:e}){return(0,E.jsxs)("div",{className:"flex flex-col items-center pt-8 pb-2",children:[(0,E.jsx)(tb,{icon:eg.Z,className:"mb-4 opacity-80"}),(0,E.jsxs)("p",{className:"mb-2",children:["No results for ",(0,E.jsxs)("b",{children:['"',e,'"']}),"."]}),(0,E.jsx)("p",{children:"Please try again with a different keyword."})]})}var nX={title:ey.Z,header:eb.Z,content:ex.Z};function n0({suggestion:e,closeSearch:t,isCurrent:n,setCurrentSuggestionIndex:i,inCurrentDocIndex:r,scrollTo:o}){var a,l;let s=nX[e.type],d=r&&!(0,M.yv)()?e1(e.link):e.link,c=(0,N.useRef)(null);n&&o(null==(a=null==c?void 0:c.current)?void 0:a.offsetTop,null==(l=null==c?void 0:c.current)?void 0:l.offsetHeight);let u=(e,t)=>{let n=[],i=0;for(let l of t){var r,o,a;let{start:t,length:s}=l,d=e.slice(i,t);let c=(r=e,o=t,a=s,function(e,t,n){let i="",r=0,o=e.length;for(let a=0;a0+n);a++){;r>t&&(i+=e.charAt(a))}return i}(r.slice(o),0,a));n.push(d),n.push((0,E.jsx)("span",{className:nV.mark,children:c},t)),i=t+c.length}return i{if("header"===e.type||"title"===e.type){let{header:t,highlightInfoList:n}=e;return(0,E.jsx)("div",{className:"font-medium",children:u(t,n)})}return(0,E.jsx)("div",{className:"font-medium",children:e.header})})();break;case"content":h=(0,E.jsxs)(E.Fragment,{children:[(()=>{if("content"!==e.type)return(0,E.jsx)("div",{});let{statement:t,highlightInfoList:n}=e;return(0,E.jsx)("div",{className:"text-sm text-gray-light w-full",children:u(t,n)})})(),(0,E.jsx)("p",{className:nV.titleForContent,children:e.title})]})}return(0,E.jsx)("li",{className:`${nV.suggestItem} ${n?nV.current:""}`,onMouseEnter:i,ref:c,children:(0,E.jsx)("a",{href:d,onClick:e=>{t(),e.stopPropagation()},target:r?"_self":"_blank",children:(0,E.jsxs)("div",{className:nV.suggestItemContainer,children:[(0,E.jsx)("div",{className:nV.hitIcon,children:(0,E.jsx)(tb,{icon:s})}),(0,E.jsx)("div",{className:nV.contentWrapper,children:(0,E.jsx)("span",{children:h})}),(0,E.jsx)("div",{className:nV.actionIcon,children:(0,E.jsx)(tb,{icon:ev.Z})})]})})},e.link)}var n1={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter",SEARCH:"KeyK",ESC:"Escape"};function n2({focused:e,setFocused:t}){let[n,i]=(0,N.useState)(""),[r,o]=(0,N.useState)([]),a=(0,N.useRef)(null),[l,s]=(0,N.useState)(!0),[d,c]=(0,N.useState)(0),u=(0,N.useRef)(null),h=(0,N.useRef)(null),p=(0,N.useRef)(null),m=(0,N.useRef)(null),[f,g]=(0,N.useState)(!1),x=(e,t)=>{var n,i,o,a,l;if(f){let s=e+t-(null==(n=null==p?void 0:p.current)?void 0:n.offsetHeight)-(1===r.length?50:-10);s>(null==(i=null==p?void 0:p.current)?void 0:i.scrollTop)&&(null==(o=null==p?void 0:p.current)||o.scrollTo({top:s}));let d=1===r.length?e-70:e-10;d<(null==(a=null==p?void 0:p.current)?void 0:a.scrollTop)&&(null==(l=null==p?void 0:p.current)||l.scrollTo({top:d}))}},{siteData:v,page:{lang:b,version:y}}=(0,P.Vi)(),{sidebar:w}=e$(),{search:k,title:j}=v,I=k&&"remote"!==k.mode&&k.versioned,S=[{group:j,result:[],renderType:"default"}],[C,z]=(0,N.useState)([]),[_,A]=(0,N.useState)("default"),T=e=>eF(w,e).group;function O(){return eR(this,null,function*(){var e,t;if(!1===k)return;let n={currentLang:b,currentVersion:y,extractGroupName:T},i=new tn(eN(eN({indexName:j},k),n));u.current=i,h.current=n,yield Promise.all([u.current.init(),new Promise(e=>setTimeout(e,1e3))]),s(!1);let r=null==(e=a.current)?void 0:e.value;r&&o((yield null==(t=u.current)?void 0:t.match(r))||S)})}(0,N.useEffect)(()=>{let n=n=>{switch(n.code){case n1.SEARCH:(n.ctrlKey||n.metaKey)&&(n.preventDefault(),t(!e));break;case n1.ARROW_DOWN:e&&(n.preventDefault(),C&&"default"===_&&(g(!0),c((d+1)%C.length)));break;case n1.ARROW_UP:if(e&&(n.preventDefault(),"default"===_)){let e=C.length;g(!0),c((d-1+e)%e)}break;case n1.ENTER:if(d>=0&&"default"===_){let e=C[d];C===r[0].result?(window.location.href=(0,M.yv)()?e.link:e1(e.link),t(!1)):window.open(e.link)}break;case n1.ESC:t(!1)}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[c,t,C,d]),(0,N.useEffect)(()=>{e?(o(S),!u.current&&O()):i("")},[e]),(0,N.useEffect)(()=>{var e;let{currentLang:t,currentVersion:n}=null!=(e=h.current)?e:{},i=b!==t,r=I&&y!==n;!l&&(i||r)&&O()},[b,y,I]);let L=e=>eR(this,null,function*(){var t;let n=e;if(i(n),n){let e=[];if(ep.beforeSearch){let e=yield ep.beforeSearch(n);e&&(n=e)}let i=yield null==(t=u.current)?void 0:t.match(n);if(i&&e.push(...i),ep.H){let t=yield ep.H(n,e);t&&e.push(...t.map(e=>eN({renderType:"custom"},e)))}o(e||S),ep.afterSearch&&(yield ep.afterSearch(n,e)),e.length>0&&z(e[0].result)}}),D=(0,N.useMemo)(()=>(0,ec.Z)(L,150),[]),R=e=>(0,eu.Z)(e,"group"),B=-1,$=e=>{if(0===e.length&&!l)return(0,E.jsx)("div",{className:"mt-4 flex-center",children:(0,E.jsx)("div",{className:"p-2 font-bold text-md",style:{color:"#2c3e50"},children:"No results found"})});let n=R(e);return(0,E.jsx)("ul",{className:nV.suggestList,children:Object.keys(n).map(e=>{let i=n[e]||[];return(0,E.jsx)("li",{children:(0,E.jsx)("ul",{className:"pb-2",children:i.map(e=>{let n=++B;return(0,E.jsx)(n0,{suggestion:e,isCurrent:n===d,setCurrentSuggestionIndex:()=>{g(!1),c(n)},closeSearch:()=>t(!1),inCurrentDocIndex:C===r[0].result,scrollTo:x},`${e.title}-${n}`)})})},e)})})};return(0,E.jsx)(E.Fragment,{children:e&&(0,eh.createPortal)((0,E.jsx)("div",{className:nV.mask,onClick:()=>t(!1),children:(0,E.jsxs)("div",{className:`${nV.modal}`,onClick:e=>{t(!0),e.stopPropagation()},children:[(0,E.jsxs)("div",{className:"flex items-center",children:[(0,E.jsxs)("div",{className:nV.inputForm,children:[(0,E.jsx)("label",{children:(0,E.jsx)(tb,{icon:ed.Z})}),(0,E.jsx)("input",{className:nV.input,ref:a,placeholder:"Search Docs","aria-label":"Search",autoComplete:"off",autoFocus:!0,onChange:e=>D(e.target.value)}),(0,E.jsx)("label",{children:(0,E.jsx)(tb,{icon:em.Z,className:nV.close,onClick:e=>{a.current&&(e.stopPropagation(),n?(a.current.value="",i("")):t(!1))}})})]}),(0,E.jsx)("h2",{className:"text-brand ml-2 sm:hidden cursor-pointer",onClick:e=>{e.stopPropagation(),t(!1)},children:"Cancel"})]}),n?(0,E.jsx)("div",{className:`${nV.searchHits} rspress-scrollbar`,ref:p,children:((e,t)=>{if(1===e.length){let t=e[0].result;return 0===t.length?(0,E.jsx)(nJ,{query:n}):(0,E.jsx)("div",{ref:m,children:$(t)})}let i=e.map(e=>t&&"remote"===t.mode?e3(t.searchIndexes||[]).find(t=>t.value===e.group).label:e.group);return(0,E.jsx)(nQ,{values:i,tabContainerClassName:nV.tabClassName,onChange:t=>{z(e[t].result),c(0),A(e[t].renderType)},ref:m,children:e.map(e=>(0,E.jsxs)(nK,{children:["default"===e.renderType&&$(e.result),"custom"===e.renderType&&ep.render(e.result)]},e.group))})})(r,k)}):null,l&&(0,E.jsx)("div",{className:"flex-center",children:(0,E.jsx)("div",{className:"p-2 text-sm",children:(0,E.jsx)(tb,{icon:ef.Z})})})]})}),document.getElementById("search-container"))})}function n3(){let[e,t]=(0,N.useState)(!1),[n,i]=(0,N.useState)(null),{searchPlaceholderText:r="Search Docs"}=e$();return(0,N.useEffect)(()=>{i(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?"\u2318":"Ctrl")},[]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:`rspress-nav-search-button ${nV.navSearchButton}`,onClick:()=>t(!0),children:(0,E.jsxs)("button",{children:[(0,E.jsx)(tb,{icon:ed.Z,width:"18",height:"18"}),(0,E.jsx)("p",{className:nV.searchWord,children:r}),(0,E.jsxs)("div",{style:{opacity:n?1:0},children:[(0,E.jsx)("span",{children:n}),(0,E.jsx)("span",{children:"K"})]})]})}),(0,E.jsx)("div",{className:nV.mobileNavSearchButton,onClick:()=>t(!0),children:(0,E.jsx)(tb,{icon:ed.Z})}),(0,E.jsx)(n2,{focused:e,setFocused:t})]})}var n4={navTitleMask:"navTitleMask_71eca",sidebar:"sidebar_71eca",sidebarContainer:"sidebarContainer_71eca",sidebarContent:"sidebarContent_71eca",open:"open_71eca",menuLink:"menuLink_71eca",menuItem:"menuItem_71eca",collapseContainer:"collapseContainer_71eca",menuItemActive:"menuItemActive_71eca"};function n5(e){let{depth:t,dividerType:n}=e;return(0,E.jsx)("div",{className:`${"dashed"===n?"border-dashed":"border-solid"} border-t border-divider-light my-3`,style:{marginLeft:0===t?0:"18px"}})}function n6(e){var t;let{item:n,depth:i=0,activeMatcher:r,id:o,setSidebarData:a}=e,l=(0,T.s0)(),s=(0,N.useRef)(null),d=(0,N.useRef)(null),c=(0,N.useRef)(null),u=(0,N.useRef)(!0),h=(0,N.useRef)(n.collapsed),p=n.link&&r(n.link),{collapsed:m,collapsible:f=!0}=n,g=(0,E.jsx)("div",{style:{cursor:"pointer",transition:"transform 0.2s ease-out",transform:m?"rotate(0deg)":"rotate(90deg)"},children:(0,E.jsx)(tb,{icon:W.Z})});(0,N.useEffect)(()=>{if(u.current||!s.current||!c.current)return;d.current&&clearTimeout(d.current);let e=s.current,t=c.current,n=t.clientHeight+4;m?(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.5s",t.style.opacity="0",d.current=setTimeout(()=>{s.current&&(s.current.style.maxHeight="0px")},0)):(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.3s",t.style.opacity="1",d.current=setTimeout(()=>{s.current&&s.current.style.removeProperty("max-height")},300))},[m]),(0,N.useEffect)(()=>{u.current=!1},[]);let x=e=>{e.stopPropagation(),a(e=>{let t=[...e],n=o.split("-").map(Number),i=t[n.shift()];for(let e of n)i=i.items[e];return"items"in i&&(i.collapsed=!i.collapsed),t})};return(0,E.jsxs)("section",{className:"mt-0.5 block",style:{marginLeft:0===i?0:"18px"},children:[(0,E.jsxs)("div",{className:`flex justify-between items-center ${p?n4.menuItemActive:n4.menuItem}`,onMouseEnter:()=>n.link&&e.preloadLink(n.link),onClick:e=>{n.link?(l((0,O.pJ)((0,O.AP)(n.link))),m&&x(e)):f&&x(e)},style:{borderRadius:0===i?"0 var(--rp-radius) var(--rp-radius) 0":void 0,cursor:f||n.link?"pointer":"normal"},children:[(0,E.jsxs)("h2",{className:"py-2 px-3 text-sm font-medium flex",style:eN({},0===i?ii:{}),children:[(0,E.jsx)(C.Vp,{tag:n.tag}),(0,E.jsx)("span",{className:"flex-center",children:tm(n.text)})]}),f&&(0,E.jsx)("div",{className:`${n4.collapseContainer} p-2 rounded-xl`,onClick:x,children:g})]}),(0,E.jsx)("div",{ref:s,className:"transition-all duration-300 ease-in-out",style:{overflow:"hidden",maxHeight:h.current?0:void 0},children:(0,E.jsx)("div",{ref:c,className:"rspress-sidebar-group transition-opacity duration-500 ease-in-out",style:{opacity:h.current?0:1,marginLeft:0===i?"12px":0},children:null==(t=null==n?void 0:n.items)?void 0:t.map((t,n)=>"dividerType"in t?(0,E.jsx)(n5,{depth:i+1,dividerType:t.dividerType},n):(0,E.jsx)("div",{children:(0,E.jsx)(n8,e_(eN({},e),{item:t,depth:i+1,id:`${o}-${n}`,preloadLink:e.preloadLink}))},n))})})]},o)}var n7=e=>e.replace(/\.(mdx?)$/,"");function n8(e){let{item:t,depth:n=0,activeMatcher:i,id:r,setSidebarData:o}=e,a="link"in t&&t.link&&i(t.link),{page:l}=(0,P.Vi)(),s=(0,N.useRef)(null),d=(0,N.useRef)(t.text),c=function(){let[,e]=(0,N.useState)(0);return()=>{e(e=>e+1)}}();return((0,N.useEffect)(()=>{var e;a&&(null==(e=s.current)||e.scrollIntoView({block:"center"}))},[]),!(0,M.yv)()&&t._fileKey===n7(l.pagePath)&&l.title&&(d.current=l.title),(0,N.useEffect)(()=>{t.text!==d.current&&(d.current=t.text,c())},[t.text]),"items"in t)?(0,E.jsx)(n6,{id:r,item:t,depth:n,activeMatcher:i,collapsed:t.collapsed,setSidebarData:o,preloadLink:e.preloadLink},`${t.text}-${r}`):(0,E.jsx)(C.rU,{href:(0,O.AP)(t.link),className:n4.menuLink,children:(0,E.jsxs)("div",{ref:s,onMouseEnter:()=>e.preloadLink(t.link),className:`${a?n4.menuItemActive:n4.menuItem} mt-0.5 py-2 px-3 font-medium flex`,style:eN(eN({fontSize:0===n?"14px":"13px",marginLeft:0===n?0:"18px",borderRadius:"0 var(--rp-radius) var(--rp-radius) 0"},0===n?ii:{}),a?{color:"var(--rp-c-brand)"}:{}),children:[(0,E.jsx)(C.Vp,{tag:t.tag}),(0,E.jsx)("span",{children:tm(d.current)})]})})}function n9({sectionHeaderText:e,tag:t}){return(0,E.jsxs)("div",{className:"rspress-sidebar-section-header",children:[(0,E.jsx)(C.Vp,{tag:t}),(0,E.jsx)("span",{children:tm(e)})]})}var ie=e=>"dividerType"in e,it=e=>"sectionHeaderText"in e,ii={fontSize:"14px",paddingLeft:"24px",fontWeight:"bold"},ir=new WeakMap;function io(e){let{isSidebarOpen:t,beforeSidebar:n,afterSidebar:i,uiSwitch:r}=e,{items:o}=eH(),a=e$(),{pathname:l}=(0,T.TH)(),s=(0,M.Kw)(a.langRoutePrefix||""),[d,c]=(0,N.useState)(o.filter(Boolean).flat()),u=decodeURIComponent(l);(0,N.useEffect)(()=>{if(o===d)return;ir=new WeakMap;let e=t=>ir.has(t)?ir.get(t):"link"in t&&t.link&&p(t.link)||"items"in t&&t.items.some(t=>e(t))?(ir.set(t,!0),!0):(ir.set(t,!1),!1),t=n=>{"items"in n&&(n.items.forEach(t),e(n)&&(n.collapsed=!1))},n=o.filter(Boolean).flat();n.forEach(t),c(n)},[o,u]);let h=e=>e.replace(s,""),p=e=>tu((0,O.E9)(h(u)),h(e),!0),m=e=>{let t=(0,X.fp)(et.routes,e);if(null==t?void 0:t.length){let{route:e}=t[0];e.preload()}};return(0,E.jsx)("aside",{className:`${n4.sidebar} rspress-sidebar ${t?n4.open:""}`,children:(0,E.jsxs)("div",{className:`${n4.sidebarContainer}`,children:[r.showNavbar?(0,E.jsx)("div",{className:n4.navTitleMask,children:(0,E.jsx)(n_,{})}):null,(0,E.jsx)("div",{className:`mt-1 ${n4.sidebarContent}`,children:(0,E.jsx)("div",{className:"rspress-scrollbar",style:{maxHeight:"calc(100vh - var(--rp-nav-height) - 8px)",overflow:"auto"},children:(0,E.jsxs)("nav",{className:"pb-2",children:[n,d.map((e,t)=>{var n;return ie(e)?(0,E.jsx)(n5,{depth:0,dividerType:e.dividerType},t):it(e)?(0,E.jsx)(n9,{sectionHeaderText:e.sectionHeaderText,tag:e.tag},t):(0,E.jsx)(n8,{id:String(t),item:e,depth:0,activeMatcher:p,collapsed:null==(n=e.collapsed)||n,setSidebarData:c,preloadLink:m},t)}),i]})})})]})})}var ia="sourceCode_bf1b0";function il(e){let{href:t,platform:n="github"}=e,{sourceCodeText:i="Source"}=e$();return(0,E.jsx)("div",{className:`inline-block rounded border border-solid border-gray-300 text-gray-400 ${ia}`,children:(0,E.jsxs)("a",{href:t,target:"_blank",className:"flex items-center content-center transition-all duration-300 text-xs block px-2 py-1 ",children:[(0,E.jsx)("span",{className:"mr-2 inline-flex w-4 h-4",children:(0,E.jsx)(tb,{icon:"gitlab"===n?ek.Z:ew.Z})}),(0,E.jsx)("span",{children:i})]})})}var is="rspressSteps_38f64";function id({children:e}){return(0,E.jsx)("div",{className:`ml-4 mb-11 border-l pl-6 ${is} [counter-reset:step]`,children:e})}var ic=({tag:e})=>e?e.trim().startsWith("(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:`#${e.id}`,className:"rspress-toc-link sm:text-normal text-sm",style:{marginLeft:(e.depth-2)*12},onClick:n=>{n.preventDefault(),window.location.hash=e.id;let i=document.getElementById(e.id);i&&eV(i,!1),null==t||t(e)},children:(0,E.jsx)("span",{className:"rspress-toc-link-text block",children:tm(e.text)})})},e.id);function ih({onItemClick:e}){let{page:t}=(0,P.Vi)();return(0,E.jsx)("ul",{children:t.toc.map(t=>(0,E.jsx)(iu,{header:t,onItemClick:e},t.id))})}var ip={Layout:tI,NotFoundLayout:eB,HomeLayout:tP,setup:eY}},71895:function(e,t,n){"use strict";n.d(t,{AV:function(){return i.AV},Ar:function(){return i.Ar},BZ:function(){return i.BZ},CF:function(){return i.CF},CU:function(){return i.CU},Ct:function(){return i.Ct},EG:function(){return i.EG},JL:function(){return i.JL},KO:function(){return i.KO},M4:function(){return i.M4},NG:function(){return i.NG},O9:function(){return i.O9},OK:function(){return i.OK},Os:function(){return i.Os},Qe:function(){return i.Qe},Qn:function(){return i.Qn},RY:function(){return i.RY},Rg:function(){return i.Rg},SU:function(){return i.SU},TJ:function(){return i.TJ},UQ:function(){return i.UQ},VA:function(){return i.VA},Vl:function(){return i.Vl},Vp:function(){return i.Vp},WG:function(){return i.WG},WS:function(){return i.WS},YE:function(){return i.YE},YS:function(){return i.YS},ZB:function(){return i.ZB},ZP:function(){return i.ZP},cY:function(){return i.cY},eE:function(){return i.eE},eF:function(){return i.eF},g2:function(){return i.g2},ls:function(){return i.ls},mQ:function(){return i.mQ},mi:function(){return i.mi},of:function(){return i.of},ol:function(){return i.ol},pU:function(){return i.pU},qx:function(){return i.qx},rU:function(){return i.rU},s2:function(){return i.s2},tx:function(){return i.tx},xB:function(){return i.xB},xK:function(){return i.xK},xN:function(){return i.xN},y2:function(){return i.y2},zh:function(){return i.zh},zx:function(){return i.zx}}),n("93201");var i=n("23657")},49555:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var i=n("13393");let r=/\s?|(]*>|]*>|]+>)+/i,o=RegExp(i.map(e=>`<${e}\\b[^>]*>`).join("|"),"i");function a(e){return e=e.trim().slice(0,1e3),r.test(e)||o.test(e)}},10924:function(e){"use strict";e.exports=JSON.parse('{"AElig":"\xc6","AMP":"&","Aacute":"\xc1","Acirc":"\xc2","Agrave":"\xc0","Aring":"\xc5","Atilde":"\xc3","Auml":"\xc4","COPY":"\xa9","Ccedil":"\xc7","ETH":"\xd0","Eacute":"\xc9","Ecirc":"\xca","Egrave":"\xc8","Euml":"\xcb","GT":">","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},33222:function(e){"use strict";e.exports=JSON.parse('{"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"}')},48606:function(e){"use strict";e.exports=JSON.parse('["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]')}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1005.8757a931.js b/modern-js/module-tools/static/js/async/1005.8757a931.js new file mode 100644 index 0000000000..4c3dc84722 --- /dev/null +++ b/modern-js/module-tools/static/js/async/1005.8757a931.js @@ -0,0 +1,2 @@ +/*! For license information please see 1005.8757a931.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1005"],{75947:function(e,n,i){"use strict";i.r(n);var r=i("39980"),s=i("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",h2:"h2",h3:"h3",code:"code",pre:"pre",ul:"ul",li:"li",ol:"ol",h4:"h4",img:"img"},(0,s.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"build-faq",children:["Build FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-faq",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Here only some common problems and bad cases are recorded."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["If the build products do not meet expectations, especially when ",(0,r.jsx)(n.a,{href:"/api/config/build-preset",children:"buildPreset"})," is configured,\nplease first understand what configuration items buildPreset represents, and then check each configuration item based on all configuration items."]})}),"\n",(0,r.jsxs)(n.h2,{id:"product-faq",children:["Product FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#product-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"initialization-of-class-fields",children:["Initialization of Class Fields",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#initialization-of-class-fields",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["TypeSript provides the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration to control the conversion handling for ",(0,r.jsx)(n.code,{children:"public class fields"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"If we have a piece of code:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n foo = 100;\n bar: string;\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is ",(0,r.jsx)(n.code,{children:"false"}),", then the compiled code will look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n this.foo = 100;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is ",(0,r.jsx)(n.code,{children:"true"}),", then the compiled code will look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n Object.defineProperty(this, 'foo', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 100,\n });\n Object.defineProperty(this, 'bar', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0,\n });\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Also the default value of this configuration will change depending on the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#target",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"target"})})," configuration of tsconfig.json: When ",(0,r.jsx)(n.code,{children:"target"})," is ES2022 or higher, then ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is configured to ",(0,r.jsx)(n.code,{children:"true"})," by default, otherwise it defaults to ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"For more information on this configuration of TypeScript, you can refer to the following link:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier",target:"_blank",rel:"noopener noreferrer",children:"The useDefineForClassFields Flag and The declare Property Modifier"})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"The Modern.js Module will currently process according to the following logic:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["The first decision to enable this feature inside Modern.js Module is based on the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration in tsconfig.json of the current project. Currently, only the contents of the tsconfig.json file under the current project path will be read, and the final tsconfig configuration based on the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#extends",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"extends"})})," configuration is not supported at this time."]}),"\n",(0,r.jsxs)(n.li,{children:["If the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration of tsconfig.json is not detected, the default value is determined based on the ",(0,r.jsx)(n.code,{children:"target"})," configuration of tsconfig.json. If ",(0,r.jsx)(n.code,{children:"target"})," is greater than ",(0,r.jsx)(n.code,{children:"ES2022"})," (including ",(0,r.jsx)(n.code,{children:"EsNext"}),"), then ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," defaults to ",(0,r.jsx)(n.code,{children:"true"}),", otherwise it is ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["If the ",(0,r.jsx)(n.code,{children:"target"})," of tsconfig.json is not detected, it is processed according to the value of ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," as ",(0,r.jsx)(n.code,{children:"true"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",children:["babel-plugin-lodash treats the introduced lodash as ",(0,r.jsx)(n.code,{children:"undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"This problem occurs when using something like the following:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Lodash from 'lodash';\n\nexport const libs = {\n _: Lodash,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Current related issues on the ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"})," Github:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/lodash/babel-plugin-lodash/issues/235",target:"_blank",rel:"noopener noreferrer",children:"#235"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["The solution to this problem is to remove ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"}),", since the plugin is not needed for on-demand referencing at this point and using it would have side effects."]}),"\n",(0,r.jsxs)(n.p,{children:["A similar situation occurs with ",(0,r.jsx)(n.code,{children:"babel-plugin-import"}),". If there is code like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Comps from 'components';\n\nexport const libs = {\n comps: Comps,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["In this case ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," may also cause ",(0,r.jsx)(n.code,{children:"Comps"})," to become ",(0,r.jsx)(n.code,{children:"undefined"}),". So you need to remove the corresponding ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," as well."]}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-module-http",children:["Cannot find module 'http'",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-http",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["If the output reports an error like ",(0,r.jsx)(n.code,{children:"Cannot find module 'http'"})," at browser runtime, it means that your output has bundled node modules.\nThis may occur if some of your dependencies support both browser and node, such as ",(0,r.jsx)(n.code,{children:"axios"}),", in which case you only need to set the ",(0,r.jsx)(n.a,{href:"/api/config/build-config#platform",children:"platform"})," to ",(0,r.jsx)(n.code,{children:"browser"}),".\nIf some third-party packages don't support the browser, you may need to manually inject ",(0,r.jsx)(n.a,{href:"/plugins/official-list/plugin-node-polyfill",children:"node polyfill"}),"."]}),"\n",(0,r.jsxs)(n.h2,{id:"exceptions-faq",children:["Exceptions FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#exceptions-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"dynamic-require-of-react-is-not-supported",children:['Dynamic require of "react" is not supported',(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dynamic-require-of-react-is-not-supported",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"problem-description",children:["Problem Description",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#problem-description",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When the product format in the product configuration of the build is ES modules."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"If you import a cjs product from a third-party npm package, the resulting product may not work properly under webpack."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/1280X1280.png",alt:""})}),"\n",(0,r.jsxs)(n.h4,{id:"solution",children:["Solution",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#solution",children:"#"})]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"First you need to find which third-party package is causing the problem"}),". For example, if the error message points to the ",(0,r.jsx)(n.code,{children:"react"})," package, then look for a third-party package that has code like ",(0,r.jsx)(n.code,{children:"require('react')"})," in it. For example ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/react-draggable",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"react-draggable"})}),", which only contains ",(0,r.jsx)(n.code,{children:"cjs"})," artifacts, then the problem is localized to the ",(0,r.jsx)(n.code,{children:"react-draggable"})," package."]}),"\n",(0,r.jsxs)(n.li,{children:["Then we need to exclude this package with the following configuration, i.e. ",(0,r.jsx)(n.strong,{children:"not package problematic third-party packages"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n externals: ['react-draggable'],\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"reference-links",children:["Reference Links",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#reference-links",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/68423950/when-using-esbuild-with-external-react-i-get-dynamic-require-of-react-is-not-s",target:"_blank",rel:"noopener noreferrer",children:'When using esbuild with external react I get Dynamic require of "react" is not supported'})}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",children:["During compilation, an error was reported in the less file of a component library:",(0,r.jsx)(n.code,{children:"'Operation on an invalid type'"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["This is probably because the component library depends on Less version v3, while Modern.js Module defaults to v4. v3 and v4 have a Break Change in the ",(0,r.jsx)(n.code,{children:"math"})," configuration, check this ",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/73298187/less-error-operation-on-an-invalid-type-in-antd-dependency",target:"_blank",rel:"noopener noreferrer",children:"link"})," for details."]}),"\n",(0,r.jsx)(n.p,{children:"Therefore, if a component library like this is used in the source code:"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"buildPreset"})," is used in the build configuration, make the following changes:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildPreset({ extendPreset }) {\n return extendPreset('your-build-preset', {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n });\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Or, if a custom ",(0,r.jsx)(n.code,{children:"buildConfig"})," is used, modify it as follows:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildConfig: {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"If you are using a component like this in Storybook, you will need to modify the debugging configuration of Storybook:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:"filename='.storybook/main.ts'",children:"module.exports = {\n framework: {\n options: {\n builderConfig: {\n tools: {\n webpackChain(chain, { CHAIN_ID }) {\n chain.module\n .rule(CHAIN_ID.RULE.LESS)\n .use(CHAIN_ID.USE.LESS)\n .tap(options => {\n options.lessOptions = {\n ...options.lessOptions,\n math: 'always',\n };\n return options;\n });\n },\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-dts-failed",children:["Bundleless DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["In the bundleless scenario, it's ",(0,r.jsx)(n.code,{children:"tsc"})," that generates the type declaration file directly. You can find the problem file by printing the error message in the terminal.\nFor source code files, it is recommended to fix the type problem, which can better enable reuse of your package. However. if you encounter a type checking problem with a thrid-party package:"]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["enable ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#skipLibCheck",target:"_blank",rel:"noopener noreferrer",children:"skipLibCheck"})," to skip the d.ts check of the thrid-party package."]}),"\n",(0,r.jsxs)(n.li,{children:["If the package exports ts files directly, skipLibCheck will not work because it can only skip the d.ts check,\nso you can only turn off ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsabortonerror",children:"dts.abortOnError"})," to ignore these errors."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"bundle-dts-failed",children:["Bundle DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["The Modern.js Module directly uses ",(0,r.jsx)(n.a,{href:"https://github.com/Swatinem/rollup-plugin-dts",target:"_blank",rel:"noopener noreferrer",children:"rollup-plugin-dts"})," to package your type description files.\n",(0,r.jsx)(n.strong,{children:"It may not be able to handle the type files of some third-party dependencies"})]}),"\n",(0,r.jsxs)(n.p,{children:['If you encounter an error message titled "Bundle DTS failed" during the build process of the Modern.js Module, you can observe that the error message is from a third-party dependency.\nTry setting ',(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:(0,r.jsx)(n.code,{children:"dts.respectExternal"})})," to ",(0,r.jsx)(n.code,{children:"false"})," to turn off the behavior of packaging type files of third-party dependencies."]}),"\n",(0,r.jsxs)(n.h3,{id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",children:["Error reported for ",(0,r.jsx)(n.code,{children:"defineConfig"})," function type: ",(0,r.jsx)(n.code,{children:'If there is no reference to "..." then the inferred type of "default" cannot be named'}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Check if the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#include",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"include"})})," configuration exists in the project's tsconfig.json file, and if not, try adding the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "include": ["src"]\n}\n'})}),"\n",(0,r.jsxs)(n.h2,{id:"other-faq",children:["Other FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#other-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",children:["How to skip the pre-processing of less/scss files with bundleless",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Bundleless is a single-file compilation method. You just need to remove your less/scss files from the entry and copy them to the output.\nNote that we will also rewrite the moduleId of js referencing less/scss, turn it off through the ",(0,r.jsx)(n.a,{href:"/api/config/build-config#redirect",children:"redirect"})," plugin."]}),"\n",(0,r.jsx)(n.p,{children:"Below is an example of skipping less file processing. You will find that all less files in src are copied to dist and the relative path is preserved."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/**/*.less'],\n redirect: {\n style: false,\n },\n copy: {\n patterns: [\n {\n from: './**/*.less',\n to: './',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"add-additional-compilation-feature",children:["Add additional compilation feature",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-additional-compilation-feature",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"The Modern.js Module is based on the esbuild implementation, so if you have special needs or want to add additional compilation capabilities, you can do so by implementing the esbuild plugin."}),"\n",(0,r.jsxs)(n.p,{children:["The Modern.js Module provides ",(0,r.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,r.jsx)(n.code,{children:"esbuildOptions"})})," configuration to allow modification of Modern.js's internal esbuild configuration, so that custom esbuild plugins can be added via this configuration:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."}),"\n",(0,r.jsxs)(n.h3,{id:"support-for-generating-typescript-declaration-files-for-css-modules",children:["Support for generating TypeScript declaration files for CSS Modules",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#support-for-generating-typescript-declaration-files-for-css-modules",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["First Solution: ",(0,r.jsx)(n.a,{href:"https://github.com/Quramy/typed-css-modules",target:"_blank",rel:"noopener noreferrer",children:"typed-css-modules"})]}),"\n",(0,r.jsxs)(n.li,{children:["Second Solution: ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/@guanghechen/postcss-modules-dts",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules-dts"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig(async () => {\n const { dts } = await import('@guanghechen/postcss-modules-dts');\n return {\n buildConfig: {\n style: {\n modules: { ...dts },\n },\n },\n // custom config\n };\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Fbuild.mdx"]={toc:[{text:"Product FAQ",id:"product-faq",depth:2},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3},{text:"Problem Description",id:"problem-description",depth:4},{text:"Solution",id:"solution",depth:4},{text:"Reference Links",id:"reference-links",depth:4},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3},{text:"Other FAQ",id:"other-faq",depth:2},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3}],title:"Build FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/240.756b04db.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1005.8757a931.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/240.756b04db.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1005.8757a931.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4159.3e9cf225.js b/modern-js/module-tools/static/js/async/1095.ab4639f9.js similarity index 96% rename from modern-js/module-tools/static/js/async/4159.3e9cf225.js rename to modern-js/module-tools/static/js/async/1095.ab4639f9.js index 55598a3eec..863f1079ba 100644 --- a/modern-js/module-tools/static/js/async/4159.3e9cf225.js +++ b/modern-js/module-tools/static/js/async/1095.ab4639f9.js @@ -1,2 +1,2 @@ -/*! For license information please see 4159.3e9cf225.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4159"],{28487:function(e,n,s){"use strict";s.r(n);var t=s("39980"),r=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",ul:"ul",li:"li",pre:"pre"},(0,r.ah)(),e.components);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.h1,{id:"testing",children:["testing",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#testing",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"This chapter describes the test-related configuration"}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["You need to enable the unit testing feature with ",(0,t.jsx)(n.code,{children:"pnpm run new"})," first.\n"]})})]}),"\n",(0,t.jsxs)(n.h2,{id:"jest",children:["jest",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jest",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type: ",(0,t.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["The configuration corresponding to ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),", when of type ",(0,t.jsx)(n.code,{children:"object"}),", can be configured with all the underlying configurations supported by Jest ."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: {\n testTimeout: 10000,\n },\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["When the value is of type ",(0,t.jsx)(n.code,{children:"Function"}),", the default configuration is passed as the first parameter and a new Jest configuration object needs to be returned."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: options => {\n return {\n ... . options,\n testTimeout: 10000\n }\n }\n }\n});\n"})}),"\n",(0,t.jsxs)(n.h2,{id:"transformer",children:["transformer",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformer",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type: ",(0,t.jsx)(n.code,{children:"'babel-jest' | 'ts-jest'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'babel-jest'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["Configure the compilation tool for the source code when executing tests: ",(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-jest",target:"_blank",rel:"noopener noreferrer",children:"babel-jest"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/kulshekhar/ts-jest",target:"_blank",rel:"noopener noreferrer",children:"ts-jest"}),". The default is ",(0,t.jsx)(n.code,{children:"babel-jest"}),"."]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive info",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"babel-jest"})," can also compile TS files without type errors, so use ",(0,t.jsx)(n.code,{children:"ts-jest"})," if you need to check the TS type when running tests.\n"]})})]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Ftesting.md"]={toc:[{text:"jest",id:"jest",depth:2},{text:"transformer",id:"transformer",depth:2}],title:"testing",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file +/*! For license information please see 1095.ab4639f9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1095"],{58568:function(e,n,s){"use strict";s.r(n);var t=s("39980"),r=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",ul:"ul",li:"li",pre:"pre"},(0,r.ah)(),e.components);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.h1,{id:"testing",children:["testing",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#testing",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"This chapter describes the test-related configuration"}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["You need to enable the unit testing feature with ",(0,t.jsx)(n.code,{children:"pnpm run new"})," first.\n"]})})]}),"\n",(0,t.jsxs)(n.h2,{id:"jest",children:["jest",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jest",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type: ",(0,t.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["The configuration corresponding to ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),", when of type ",(0,t.jsx)(n.code,{children:"object"}),", can be configured with all the underlying configurations supported by Jest ."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: {\n testTimeout: 10000,\n },\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["When the value is of type ",(0,t.jsx)(n.code,{children:"Function"}),", the default configuration is passed as the first parameter and a new Jest configuration object needs to be returned."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: options => {\n return {\n ... . options,\n testTimeout: 10000\n }\n }\n }\n});\n"})}),"\n",(0,t.jsxs)(n.h2,{id:"transformer",children:["transformer",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformer",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type: ",(0,t.jsx)(n.code,{children:"'babel-jest' | 'ts-jest'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'babel-jest'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["Configure the compilation tool for the source code when executing tests: ",(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-jest",target:"_blank",rel:"noopener noreferrer",children:"babel-jest"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/kulshekhar/ts-jest",target:"_blank",rel:"noopener noreferrer",children:"ts-jest"}),". The default is ",(0,t.jsx)(n.code,{children:"babel-jest"}),"."]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive info",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"babel-jest"})," can also compile TS files without type errors, so use ",(0,t.jsx)(n.code,{children:"ts-jest"})," if you need to check the TS type when running tests.\n"]})})]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Ftesting.md"]={toc:[{text:"jest",id:"jest",depth:2},{text:"transformer",id:"transformer",depth:2}],title:"testing",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1342.6f7bd018.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1095.ab4639f9.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1342.6f7bd018.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1095.ab4639f9.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1166.fadfc0d7.js b/modern-js/module-tools/static/js/async/1166.fadfc0d7.js new file mode 100644 index 0000000000..7823b9fdc0 --- /dev/null +++ b/modern-js/module-tools/static/js/async/1166.fadfc0d7.js @@ -0,0 +1,2 @@ +/*! For license information please see 1166.fadfc0d7.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1166"],{36869:function(e,t,n){"use strict";n.r(t);var i=n("39980"),o=n("9580");function s(e){let t=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,i.jsxs)(t.h1,{id:"index",children:["index",(0,i.jsx)(t.a,{className:"header-anchor","aria-hidden":"true",href:"#index",children:"#"})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,o.ah)(),e.components);return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(s,{...e})}):s(e)}t.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Findex.md"]={toc:[],title:"index",frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Jest: \u4EE4\u4EBA\u6109\u5FEB\u7684\u6D4B\u8BD5\u6846\u67B6",details:"\u96C6\u6210\u4E86 Jest\uFF0C\u4F7F\u5F97\u4EE3\u7801\u6D4B\u8BD5\u66F4\u52A0\u5BB9\u6613\u3002",icon:"\uD83D\uDCD0"}]}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1671.3ac95ef0.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1166.fadfc0d7.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1671.3ac95ef0.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1166.fadfc0d7.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5977.c60808b6.js b/modern-js/module-tools/static/js/async/1297.5bb5922c.js similarity index 97% rename from modern-js/module-tools/static/js/async/5977.c60808b6.js rename to modern-js/module-tools/static/js/async/1297.5bb5922c.js index 9a7fb2674a..3d9082efb5 100644 --- a/modern-js/module-tools/static/js/async/5977.c60808b6.js +++ b/modern-js/module-tools/static/js/async/1297.5bb5922c.js @@ -1,2 +1,2 @@ -/*! For license information please see 5977.c60808b6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5977"],{93265:function(n,e,l){"use strict";l.r(e);var s=l("39980"),i=l("9580");function r(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul"},(0,i.ah)(),n.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(e.h1,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsx)(e.p,{children:"Modern.js Module \u4E0D\u4EC5\u63D0\u4F9B\u4E86\u4E30\u5BCC\u7684\u529F\u80FD\uFF0C\u540C\u65F6\u4E5F\u652F\u6301\u901A\u8FC7\u63D2\u4EF6\u7684\u65B9\u5F0F\u4E3A\u5F53\u524D\u9879\u76EE\u6269\u5C55\u80FD\u529B\u3002"}),"\n",(0,s.jsx)(e.p,{children:"\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u4F8B\u5B50\u6765\u5FEB\u901F\u4E86\u89E3\u5982\u4F55\u7F16\u5199\u4E00\u4E2A Modern.js Module \u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsxs)(e.ol,{children:["\n",(0,s.jsxs)(e.li,{children:["\u9996\u5148\u6211\u4EEC\u5728\u521D\u59CB\u5316\u7684\u9879\u76EE\u4E0B\u521B\u5EFA ",(0,s.jsx)(e.code,{children:"./plugins/example.ts"})," \u6587\u4EF6\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-md",meta:'title="./project"',children:"./\n\u251C\u2500\u2500 plugins\n\u2502 \u2514\u2500\u2500 example.ts\n\u251C\u2500\u2500 src/\n\u2514\u2500\u2500 modern.config.ts\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"2",children:["\n",(0,s.jsxs)(e.li,{children:["\u63A5\u7740\u5728 ",(0,s.jsx)(e.code,{children:"example.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\u63D2\u4EF6\u7684\u4EE3\u7801\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nexport const ExamplePlugin = (): CliPlugin => {\n return {\n name: 'example',\n setup() {\n console.info('this is example plugin');\n return {\n // use hooks\n afterBuild() {\n console.info('build over');\n },\n };\n },\n };\n};\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"3",children:["\n",(0,s.jsxs)(e.li,{children:["\u7136\u540E\u6211\u4EEC\u901A\u8FC7 ",(0,s.jsx)(e.a,{href:"/api/config/plugins",children:(0,s.jsx)(e.code,{children:"plugins"})})," API\uFF0C\u5C06\u521A\u521A\u5199\u597D\u7684\u63D2\u4EF6\u8FDB\u884C\u6CE8\u518C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { examplePlugin } from './plugins/example';\nexport default defineConfig({\n plugins: [examplePlugin()],\n});\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"4",children:["\n",(0,s.jsxs)(e.li,{children:["\u6700\u540E\u8FD0\u884C ",(0,s.jsx)(e.code,{children:"modern build"}),"\uFF0C\u5C31\u53EF\u4EE5\u770B\u5230\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-bash",meta:'title="terminal"',children:"this is example plugin\nBuild succeed: 510.684ms\nbuild over\n"})}),"\n",(0,s.jsx)(e.p,{children:"\u901A\u8FC7\u4E0A\u9762\u8FD9\u4E2A\u4F8B\u5B50\uFF0C\u6211\u4EEC\u4E86\u89E3\u5230\u4E86\u4E0B\u9762\u51E0\u4EF6\u4E8B\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsx)(e.li,{children:"\u63A8\u8350\u7684\u63D2\u4EF6\u76EE\u5F55\u7ED3\u6784"}),"\n",(0,s.jsx)(e.li,{children:"\u63D2\u4EF6\u7684\u521D\u59CB\u5316\u4EE3\u7801"}),"\n",(0,s.jsx)(e.li,{children:"\u63D2\u4EF6\u7684\u6CE8\u518C"}),"\n"]}),"\n",(0,s.jsx)(e.p,{children:"\u9664\u4E86\u4EE5\u4E0A\u5185\u5BB9\u4EE5\u5916\uFF0C\u6211\u4EEC\u8FD8\u9700\u8981\u4E86\u89E3\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsx)(e.li,{children:(0,s.jsx)(e.a,{href:"/plugins/guide/plugin-object",children:"\u63D2\u4EF6\u5BF9\u8C61\u3001\u7C7B\u578B\u5B9A\u4E49\u4E0E\u63A8\u8350\u914D\u7F6E\u9879"})}),"\n",(0,s.jsx)(e.li,{children:(0,s.jsxs)(e.a,{href:"/plugins/guide/setup-function",children:["setup \u51FD\u6570\u3001",(0,s.jsx)(e.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\u3001\u751F\u547D\u5468\u671F\u94A9\u5B50"]})}),"\n"]})]})}function d(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,i.ah)(),n.components);return e?(0,s.jsx)(e,{...n,children:(0,s.jsx)(r,{...n})}):r(n)}e.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fgetting-started.mdx"]={toc:[],title:"\u5FEB\u901F\u5F00\u59CB",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 1297.5bb5922c.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1297"],{80380:function(n,e,l){"use strict";l.r(e);var s=l("39980"),i=l("9580");function r(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul"},(0,i.ah)(),n.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(e.h1,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsx)(e.p,{children:"Modern.js Module \u4E0D\u4EC5\u63D0\u4F9B\u4E86\u4E30\u5BCC\u7684\u529F\u80FD\uFF0C\u540C\u65F6\u4E5F\u652F\u6301\u901A\u8FC7\u63D2\u4EF6\u7684\u65B9\u5F0F\u4E3A\u5F53\u524D\u9879\u76EE\u6269\u5C55\u80FD\u529B\u3002"}),"\n",(0,s.jsx)(e.p,{children:"\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u4F8B\u5B50\u6765\u5FEB\u901F\u4E86\u89E3\u5982\u4F55\u7F16\u5199\u4E00\u4E2A Modern.js Module \u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsxs)(e.ol,{children:["\n",(0,s.jsxs)(e.li,{children:["\u9996\u5148\u6211\u4EEC\u5728\u521D\u59CB\u5316\u7684\u9879\u76EE\u4E0B\u521B\u5EFA ",(0,s.jsx)(e.code,{children:"./plugins/example.ts"})," \u6587\u4EF6\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-md",meta:'title="./project"',children:"./\n\u251C\u2500\u2500 plugins\n\u2502 \u2514\u2500\u2500 example.ts\n\u251C\u2500\u2500 src/\n\u2514\u2500\u2500 modern.config.ts\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"2",children:["\n",(0,s.jsxs)(e.li,{children:["\u63A5\u7740\u5728 ",(0,s.jsx)(e.code,{children:"example.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\u63D2\u4EF6\u7684\u4EE3\u7801\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nexport const ExamplePlugin = (): CliPlugin => {\n return {\n name: 'example',\n setup() {\n console.info('this is example plugin');\n return {\n // use hooks\n afterBuild() {\n console.info('build over');\n },\n };\n },\n };\n};\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"3",children:["\n",(0,s.jsxs)(e.li,{children:["\u7136\u540E\u6211\u4EEC\u901A\u8FC7 ",(0,s.jsx)(e.a,{href:"/api/config/plugins",children:(0,s.jsx)(e.code,{children:"plugins"})})," API\uFF0C\u5C06\u521A\u521A\u5199\u597D\u7684\u63D2\u4EF6\u8FDB\u884C\u6CE8\u518C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { examplePlugin } from './plugins/example';\nexport default defineConfig({\n plugins: [examplePlugin()],\n});\n"})}),"\n",(0,s.jsxs)(e.ol,{start:"4",children:["\n",(0,s.jsxs)(e.li,{children:["\u6700\u540E\u8FD0\u884C ",(0,s.jsx)(e.code,{children:"modern build"}),"\uFF0C\u5C31\u53EF\u4EE5\u770B\u5230\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-bash",meta:'title="terminal"',children:"this is example plugin\nBuild succeed: 510.684ms\nbuild over\n"})}),"\n",(0,s.jsx)(e.p,{children:"\u901A\u8FC7\u4E0A\u9762\u8FD9\u4E2A\u4F8B\u5B50\uFF0C\u6211\u4EEC\u4E86\u89E3\u5230\u4E86\u4E0B\u9762\u51E0\u4EF6\u4E8B\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsx)(e.li,{children:"\u63A8\u8350\u7684\u63D2\u4EF6\u76EE\u5F55\u7ED3\u6784"}),"\n",(0,s.jsx)(e.li,{children:"\u63D2\u4EF6\u7684\u521D\u59CB\u5316\u4EE3\u7801"}),"\n",(0,s.jsx)(e.li,{children:"\u63D2\u4EF6\u7684\u6CE8\u518C"}),"\n"]}),"\n",(0,s.jsx)(e.p,{children:"\u9664\u4E86\u4EE5\u4E0A\u5185\u5BB9\u4EE5\u5916\uFF0C\u6211\u4EEC\u8FD8\u9700\u8981\u4E86\u89E3\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsx)(e.li,{children:(0,s.jsx)(e.a,{href:"/plugins/guide/plugin-object",children:"\u63D2\u4EF6\u5BF9\u8C61\u3001\u7C7B\u578B\u5B9A\u4E49\u4E0E\u63A8\u8350\u914D\u7F6E\u9879"})}),"\n",(0,s.jsx)(e.li,{children:(0,s.jsxs)(e.a,{href:"/plugins/guide/setup-function",children:["setup \u51FD\u6570\u3001",(0,s.jsx)(e.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\u3001\u751F\u547D\u5468\u671F\u94A9\u5B50"]})}),"\n"]})]})}function d(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,i.ah)(),n.components);return e?(0,s.jsx)(e,{...n,children:(0,s.jsx)(r,{...n})}):r(n)}e.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fgetting-started.mdx"]={toc:[],title:"\u5FEB\u901F\u5F00\u59CB",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1831.f3a83f13.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1297.5bb5922c.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1831.f3a83f13.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1297.5bb5922c.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/131.7e780f65.js b/modern-js/module-tools/static/js/async/131.7e780f65.js new file mode 100644 index 0000000000..2ed0ee3395 --- /dev/null +++ b/modern-js/module-tools/static/js/async/131.7e780f65.js @@ -0,0 +1,2 @@ +/*! For license information please see 131.7e780f65.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["131"],{37321:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",strong:"strong",ul:"ul",li:"li",pre:"pre",h3:"h3",h4:"h4"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",children:["\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:['\u5728 "\u57FA\u7840\u4F7F\u7528" \u7684\u90E8\u5206\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u77E5\u9053\u53EF\u4EE5\u901A\u8FC7 ',(0,r.jsx)(n.code,{children:"buildConfig"})," \u914D\u7F6E\u5BF9\u9879\u76EE\u7684\u8F93\u51FA\u4EA7\u7269\u8FDB\u884C\u4FEE\u6539\u3002",(0,r.jsx)(n.code,{children:"buildConfig"})," \u4E0D\u4EC5\u63CF\u8FF0\u4E86\u4EA7\u7269\u7684\u4E00\u4E9B\u7279\u6027\uFF0C\u540C\u65F6\u8FD8\u4E3A\u6784\u5EFA\u4EA7\u7269\u63D0\u4F9B\u4E86\u4E00\u4E9B\u529F\u80FD\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u8FD8\u4E0D\u4E86\u89E3 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u7684\u4F5C\u7528\uFF0C\u8BF7\u5148\u9605\u8BFB ",(0,r.jsx)(n.a,{href:"/guide/basic/modify-output-product",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"}),"\u3002\n"]})})]}),"\n",(0,r.jsxs)(n.p,{children:["\u800C\u5728\u672C\u7AE0\u91CC\u6211\u4EEC\u5C06\u8981\u6DF1\u5165\u7406\u89E3\u67D0\u4E9B\u6784\u5EFA\u914D\u7F6E\u7684\u4F5C\u7528\u4EE5\u53CA\u4E86\u89E3\u6267\u884C ",(0,r.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\u53D1\u751F\u4E86\u4EC0\u4E48\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"bundle--bundleless",children:[(0,r.jsx)(n.code,{children:"bundle"})," / ",(0,r.jsx)(n.code,{children:"bundleless"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle--bundleless",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u90A3\u4E48\u9996\u5148\u6211\u4EEC\u6765\u4E86\u89E3\u4E00\u4E0B bundle \u548C bundleless\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["\u6240\u8C13 bundle \u662F\u6307\u5BF9\u6784\u5EFA\u4EA7\u7269\u8FDB\u884C\u6253\u5305\uFF0C\u6784\u5EFA\u4EA7\u7269\u53EF\u80FD\u662F\u4E00\u4E2A\u6587\u4EF6\uFF0C\u4E5F\u6709\u53EF\u80FD\u662F\u57FA\u4E8E\u4E00\u5B9A\u7684",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"\u4EE3\u7801\u62C6\u5206\u7B56\u7565"}),"\u5F97\u5230\u7684\u591A\u4E2A\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u800C bundleless \u5219\u662F\u6307\u5BF9\u6BCF\u4E2A\u6E90\u6587\u4EF6\u5355\u72EC\u8FDB\u884C\u7F16\u8BD1\u6784\u5EFA\uFF0C\u4F46\u662F\u5E76\u4E0D\u5C06\u5B83\u4EEC\u6253\u5305\u5728\u4E00\u8D77\u3002\u6BCF\u4E00\u4E2A\u4EA7\u7269\u6587\u4EF6\u90FD\u53EF\u4EE5\u627E\u5230\u4E0E\u4E4B\u76F8\u5BF9\u5E94\u7684\u6E90\u7801\u6587\u4EF6\u3002",(0,r.jsx)(n.strong,{children:"bundleless \u6784\u5EFA\u7684\u8FC7\u7A0B\uFF0C\u4E5F\u53EF\u4EE5\u7406\u89E3\u4E3A\u4EC5\u5BF9\u6E90\u6587\u4EF6\u8FDB\u884C\u4EE3\u7801\u8F6C\u6362\u7684\u8FC7\u7A0B"}),"\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5B83\u4EEC\u6709\u5404\u81EA\u7684\u597D\u5904\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"bundle \u53EF\u4EE5\u51CF\u5C11\u6784\u5EFA\u4EA7\u7269\u7684\u4F53\u79EF\uFF0C\u4E5F\u53EF\u4EE5\u5BF9\u4F9D\u8D56\u9884\u6253\u5305\uFF0C\u51CF\u5C0F\u5B89\u88C5\u4F9D\u8D56\u7684\u4F53\u79EF\u3002\u63D0\u524D\u5BF9\u5E93\u8FDB\u884C\u6253\u5305\uFF0C\u53EF\u4EE5\u52A0\u5FEB\u5E94\u7528\u9879\u76EE\u6784\u5EFA\u7684\u901F\u5EA6\u3002"}),"\n",(0,r.jsx)(n.li,{children:"bundleless \u5219\u662F\u53EF\u4EE5\u4FDD\u6301\u539F\u6709\u7684\u6587\u4EF6\u7ED3\u6784\uFF0C\u66F4\u6709\u5229\u4E8E\u8C03\u8BD5\u548C tree shaking\u3002"}),"\n"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["bundleless \u662F\u5355\u6587\u4EF6\u7F16\u8BD1\u6A21\u5F0F\uFF0C\u56E0\u6B64\u5BF9\u4E8E\u7C7B\u578B\u7684\u5F15\u7528\u548C\u5BFC\u51FA\u4F60\u9700\u8981\u52A0\u4E0A ",(0,r.jsx)(n.code,{children:"type"})," \u5B57\u6BB5\uFF0C \u4F8B\u5982 ",(0,r.jsx)(n.code,{children:"import type { A } from './types"}),"\uFF0C\u80CC\u666F\u53C2\u8003 ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/content-types/#isolated-modules",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u6587\u6863"}),"\u3002\n"]})})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u4E2D\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#buildtype",children:(0,r.jsx)(n.code,{children:"buildConfig.buildType"})})," \u6765\u6307\u5B9A\u5F53\u524D\u6784\u5EFA\u4EFB\u52A1\u662F bundle \u8FD8\u662F bundleless\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"input--sourcedir",children:[(0,r.jsx)(n.code,{children:"input"})," / ",(0,r.jsx)(n.code,{children:"sourceDir"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input--sourcedir",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,r.jsx)(n.code,{children:"buildConfig.input"})})," \u7528\u4E8E\u6307\u5B9A\u8BFB\u53D6\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u6216\u8005\u76EE\u5F55\u8DEF\u5F84\uFF0C\u5176\u9ED8\u8BA4\u503C\u5728 bundle \u548C bundleless \u6784\u5EFA\u8FC7\u7A0B\u4E2D\u6709\u6240\u4E0D\u540C\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"buildType: 'bundle'"})," \u7684\u65F6\u5019\uFF0C",(0,r.jsx)(n.code,{children:"input"})," \u9ED8\u8BA4\u503C\u4E3A ",(0,r.jsx)(n.code,{children:"src/index.(j|t)sx?"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"buildType: 'bundleless'"})," \u7684\u65F6\u5019\uFF0C",(0,r.jsx)(n.code,{children:"input"})," \u9ED8\u8BA4\u503C\u4E3A ",(0,r.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE\u9ED8\u8BA4\u503C\u4E0A\u6211\u4EEC\u53EF\u4EE5\u77E5\u9053\uFF1A",(0,r.jsx)(n.strong,{children:"\u4F7F\u7528 bundle \u6A21\u5F0F\u6784\u5EFA\u65F6\u4E00\u822C\u6307\u5B9A\u4E00\u4E2A\u6216\u591A\u4E2A\u6587\u4EF6\u4F5C\u4E3A\u6784\u5EFA\u7684\u5165\u53E3\uFF0C\u800C\u4F7F\u7528 bundleless \u6784\u5EFA\u5219\u662F\u6307\u5B9A\u4E00\u4E2A\u76EE\u5F55\uFF0C\u5C06\u76EE\u5F55\u4E0B\u6240\u6709\u6587\u4EF6\u4F5C\u4E3A\u5165\u53E3"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,r.jsx)(n.code,{children:"sourceDir"})})," \u7528\u4E8E\u6307\u5B9A\u6E90\u7801\u76EE\u5F55\uFF0C\u5B83",(0,r.jsx)(n.strong,{children:"\u53EA\u4E0E"}),"\u4EE5\u4E0B\u4E24\u4E2A\u5185\u5BB9\u6709\u5173\u7CFB\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210"}),"\n",(0,r.jsxs)(n.li,{children:["\u6307\u5B9A\u6784\u5EFA\u8FC7\u7A0B\u4E2D\u7684 ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"outbase"})})]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5F97\u5230\u5176\u6700\u4F73\u5B9E\u8DF5\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u5728 bundle \u6784\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u53EA\u80FD\u6307\u5B9A ",(0,r.jsx)(n.code,{children:"input"})," \u3002"]})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u4E00\u822C\u60C5\u51B5\u4E0B\uFF0Cbundleless \u53EA\u9700\u8981\u6307\u5B9A ",(0,r.jsx)(n.code,{children:"sourceDir"}),"\uFF08\u6B64\u65F6 ",(0,r.jsx)(n.code,{children:"input"})," \u4F1A\u4E0E ",(0,r.jsx)(n.code,{children:"sourceDir"})," \u4FDD\u6301\u4E00\u81F4\uFF09\u3002"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u6211\u4EEC\u60F3\u8981\u5728 bundleless \u91CC\u53EA\u5BF9\u4E00\u90E8\u5206\u6587\u4EF6\u8FDB\u884C\u8F6C\u6362\uFF0C\u4F8B\u5982\u53EA\u9700\u8981\u8F6C\u6362 ",(0,r.jsx)(n.code,{children:"src/runtime"})," \u76EE\u5F55\u7684\u6587\u4EF6\uFF0C\u6B64\u65F6\u9700\u8981\u914D\u7F6E ",(0,r.jsx)(n.code,{children:"input"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n input: ['src/runtime'],\n sourceDir: 'src',\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u4F7F\u7528-swc",children:["\u4F7F\u7528 swc",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-swc",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728\u90E8\u5206\u573A\u666F\u4E0B\uFF0Cesbuild \u4E0D\u8DB3\u4EE5\u6EE1\u8DB3\u6211\u4EEC\u7684\u9700\u6C42\uFF0C\u6B64\u65F6\u6211\u4EEC\u4F1A\u4F7F\u7528 swc \u6765\u505A\u4EE3\u7801\u8F6C\u6362\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE ",(0,r.jsx)(n.strong,{children:"2.36.0"})," \u7248\u672C\u5F00\u59CB\uFF0C\u6D89\u53CA\u5230\u4EE5\u4E0B\u529F\u80FD\u65F6\uFF0CModern.js Module \u9ED8\u8BA4\u4F1A\u4F7F\u7528 swc \uFF0C\u4F46\u4E0D\u8FD9\u610F\u5473\u7740\u4E0D\u4F7F\u7528 esbuild \u4E86\uFF0C\u5176\u4F59\u529F\u80FD\u8FD8\u662F\u4F7F\u7528 esbuild:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:"transformImport"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#transformlodash",children:"transformLodash"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#externalhelpers",children:"externalHelpers"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#format-umd",children:"format: umd"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#target",children:"target: es5"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata",target:"_blank",rel:"noopener noreferrer",children:"emitDecoratorMetadata: true"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 ",(0,r.jsx)(n.strong,{children:"2.16.0"})," \u7248\u672C\u5F00\u59CB\u5168\u91CF\u4F7F\u7528 swc \u8FDB\u884C\u4EE3\u7801\u8F6C\u6362\u3002\u4E0D\u8FC7 swc \u540C\u6837\u4E5F\u5B58\u5728\u4E00\u4E9B\u9650\u5236\uFF0C\u4E3A\u6B64\u6211\u4EEC\u6DFB\u52A0\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#sourcetype",children:"sourceType"})," \u914D\u7F6E\uFF0C\u5F53\u6E90\u7801\u683C\u5F0F\u4E3A 'commonjs' \u65F6\u5173\u95ED swc\uFF0C \u4F46\u8FD9\u79CD\u65B9\u5F0F\u5E76\u4E0D\u7B26\u5408\u7528\u6237\u76F4\u89C9\uFF0C\u53E6\u5916\uFF0Cswc \u683C\u5F0F\u5316\u8F93\u51FA\u7684 cjs \u6A21\u5F0F\u6CA1\u6709\u7ED9\u6BCF\u4E2A\u5BFC\u51FA\u540D\u79F0\u6DFB\u52A0\u6CE8\u91CA\uFF0C\u8FD9\u5728 node \u4E2D\u4F7F\u7528\u53EF\u80FD\u4F1A\u5E26\u6765\u4E00\u4E9B\u95EE\u9898\u3002\n\u56E0\u4E3A\u6211\u4EEC\u5E9F\u5F03\u4E86\u6B64\u884C\u4E3A\uFF0C\u56DE\u5230\u4E86\u6700\u521D\u7684\u8BBE\u8BA1 - ",(0,r.jsx)(n.strong,{children:"\u53EA\u5728\u9700\u8981\u7684\u573A\u666F\u4E0B\u4F7F\u7528 swc \u4F5C\u4E3A\u8865\u5145"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",children:["\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86 Hook \u673A\u5236\uFF0C\u5141\u8BB8\u6211\u4EEC\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u4E0D\u540C\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002\nModern.js Module Hook \u4F7F\u7528\u4E86 ",(0,r.jsx)(n.a,{href:"https://github.com/webpack/tapable",target:"_blank",rel:"noopener noreferrer",children:"tapable"})," \u5B9E\u73B0\uFF0C\u6269\u5C55\u4E86 esbuild \u7684\u63D2\u4EF6\u673A\u5236\uFF0C\u82E5 esbuild plugins \u5DF2\u7ECF\u6EE1\u8DB3\u4E86\u4F60\u7684\u9700\u6C42,\u5EFA\u8BAE\u76F4\u63A5\u4F7F\u7528\u5B83\u3002\n\u4E0B\u9762\u5C55\u5F00\u8BF4\u660E\u5176\u7528\u6CD5:"]}),"\n",(0,r.jsxs)(n.h3,{id:"hook-\u7C7B\u578B",children:["Hook \u7C7B\u578B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-\u7C7B\u578B",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"asyncseriesbailhook",children:["AsyncSeriesBailHook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncseriesbailhook",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4E32\u884C\u6267\u884C\u7684 hooks\uFF0C\u5982\u679C\u67D0\u4E2A tapped function \u8FD4\u56DE\u975E undefined \u7ED3\u679C\uFF0C\u5219\u540E\u7EED\u5176\u4ED6\u7684 tapped function \u505C\u6B62\u6267\u884C\u3002"}),"\n",(0,r.jsxs)(n.h4,{id:"asyncserieswaterfallhooks",children:["AsyncSeriesWaterFallHooks",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncserieswaterfallhooks",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4E32\u884C\u6267\u884C\u7684 hooks\uFF0C\u5176\u7ED3\u679C\u4F1A\u4F20\u9012\u7ED9\u4E0B\u4E00\u4E2A tapped function"}),"\n",(0,r.jsxs)(n.h3,{id:"hook-api",children:["Hook API",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-api",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"load",children:["load",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#load",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesBailHook"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," \u89E6\u53D1\uFF0C\u6839\u636E\u6A21\u5757\u8DEF\u5F84\u6765\u83B7\u53D6\u6A21\u5757\u5185\u5BB9"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"interface LoadArgs {\n path: string;\n namespace: string;\n suffix: string;\n}\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u8FD4\u56DE\u53C2\u6570"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type LoadResult =\n | {\n contents: string; // \u6A21\u5757\u5185\u5BB9\n map?: SourceMap; // https://esbuild.github.io/api/#sourcemap\n loader?: Loader; // https://esbuild.github.io/api/#loader\n resolveDir?: string;\n }\n | undefined;\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.load.tapPromise('load content from memfs', async args => {\n const contents = memfs.readFileSync(args.path);\n return {\n contents: contents,\n loader: 'js',\n };\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"transform",children:["transform",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transform",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," \u89E6\u53D1\uFF0C\n\u5C06 load \u9636\u6BB5\u83B7\u53D6\u7684\u6A21\u5757\u5185\u5BB9\u8FDB\u884C\u8F6C\u6362"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570(\u8FD4\u56DE\u53C2\u6570)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export type Source = {\n code: string;\n map?: SourceMap;\n path: string;\n loader?: string;\n};\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.transform.tapPromise('6to5', async args => {\n const result = babelTransform(args.code, { presets: ['@babel/preset-env'] });\n return {\n code: result.code,\n map: result.map,\n };\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"renderchunk",children:["renderChunk",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#renderchunk",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-end",target:"_blank",rel:"noopener noreferrer",children:"onEnd callbacks"})," \u89E6\u53D1\uFF0C\n\u7C7B\u4F3C\u4E8E transform hook\uFF0C\u4F46\u662F\u4F5C\u7528\u5728 esbuild \u751F\u6210\u7684\u4EA7\u7269"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570(\u8FD4\u56DE\u53C2\u6570)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export type AssetChunk = {\n type: 'asset';\n contents: string | Buffer;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n originalFileName?: string;\n};\n\nexport type JsChunk = {\n type: 'chunk';\n contents: string;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n map?: SourceMap;\n modules?: Record;\n originalFileName?: string;\n};\n\nexport type Chunk = AssetChunk | JsChunk;\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.renderChunk.tapPromise('minify', async chunk => {\n if (chunk.type === 'chunk') {\n const code = chunk.contents.toString();\n const result = await minify.call(compiler, code);\n return {\n ...chunk,\n contents: result.code,\n map: result.map,\n };\n }\n return chunk;\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",children:["\u7C7B\u578B\u6587\u4EF6\u751F\u6210",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B\u6587\u4EF6\u751F\u6210",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#dts",children:(0,r.jsx)(n.code,{children:"buildConfig.dts"})})," \u914D\u7F6E\u4E3B\u8981\u7528\u4E8E\u7C7B\u578B\u6587\u4EF6\u7684\u751F\u6210\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",children:["\u5173\u95ED\u7C7B\u578B\u751F\u6210",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5173\u95ED\u7C7B\u578B\u751F\u6210",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u7C7B\u578B\u751F\u6210\u529F\u80FD\u662F\u5F00\u542F\u7684\uFF0C\u5982\u679C\u9700\u8981\u5173\u95ED\u7684\u8BDD\uFF0C\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n dts: false,\n },\n});\n"})}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsx)(n.p,{children:"\u5173\u95ED\u7C7B\u578B\u6587\u4EF6\u540E\uFF0C\u4E00\u822C\u6765\u8BF4\u6784\u5EFA\u901F\u5EA6\u4F1A\u6709\u6240\u63D0\u5347\u3002"})})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",children:["\u6253\u5305\u7C7B\u578B\u6587\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6253\u5305\u7C7B\u578B\u6587\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"buildType: 'bundleless'"})," \u7684\u65F6\u5019\uFF0C\u7C7B\u578B\u6587\u4EF6\u7684\u751F\u6210\u662F\u4F7F\u7528\u9879\u76EE\u7684 ",(0,r.jsx)(n.code,{children:"tsc"})," \u547D\u4EE4\u6765\u5B8C\u6210\u751F\u4EA7\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Modern.js Module \u540C\u65F6\u8FD8\u652F\u6301\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305"}),"\uFF0C\u4E0D\u8FC7\u4F7F\u7528\u8BE5\u529F\u80FD\u7684\u65F6\u5019\u9700\u8981\u6CE8\u610F\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u4E0D\u4F1A\u5F00\u542F\u7C7B\u578B\u68C0\u67E5\u3002"}),"\n",(0,r.jsxs)(n.li,{children:["\u4E00\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5B58\u5728\u9519\u8BEF\u7684\u8BED\u6CD5\u4F1A\u5BFC\u81F4\u6253\u5305\u8FC7\u7A0B\u5931\u8D25\u3002\u56E0\u6B64\u5BF9\u4E8E\u8FD9\u79CD\u60C5\u51B5\uFF0C\u9700\u8981\u624B\u52A8\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,r.jsx)(n.code,{children:"buildConfig.externals"})})," \u5C06\u8FD9\u7C7B\u7B2C\u4E09\u65B9\u5305\u6392\u9664\uFF0C\u6216\u8005\u76F4\u63A5\u5173\u95ED",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:"dts.respectExternal"}),"\u4ECE\u800C\u4E0D\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6\u6307\u5411\u7684\u662F\u4E00\u4E2A ",(0,r.jsx)(n.code,{children:".ts"})," \u6587\u4EF6\u7684\u60C5\u51B5\uFF0C\u76EE\u524D\u65E0\u6CD5\u5904\u7406\u3002\u6BD4\u5982\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684 ",(0,r.jsx)(n.code,{children:"package.json"})," \u4E2D\u5B58\u5728\u8FD9\u6837\u7684\u5185\u5BB9\uFF1A ",(0,r.jsx)(n.code,{children:'{"types": "./src/index.ts"'}),"\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5BF9\u4E8E\u4E0A\u8FF0\u95EE\u9898\uFF0C\u6211\u4EEC\u63A8\u8350\u7684\u5904\u7406\u65B9\u5F0F\u662F\u9996\u5148\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210 d.ts \u6587\u4EF6\uFF0C\u7136\u540E\u5C06 index.d.ts \u4F5C\u4E3A\u5165\u53E3\u8FDB\u884C\u6253\u5305\u5904\u7406\uFF0C\u5E76\u4E14\u5173\u95ED ",(0,r.jsx)(n.code,{children:"dts.respectExternal"}),"\u3002\u5728\u4E4B\u540E\u7684\u6F14\u8FDB\u6211\u4EEC\u4E5F\u4F1A\u9010\u6E10\u5411\u8FD9\u79CD\u5904\u7406\u65B9\u5F0F\u9760\u62E2\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u522B\u540D\u8F6C\u6362",children:["\u522B\u540D\u8F6C\u6362",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u522B\u540D\u8F6C\u6362",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728 bundleless \u6784\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u5982\u679C\u6E90\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u522B\u540D\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="./src/index.ts"',children:"import utils from '@common/utils';\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7684\u4EA7\u7269\u7C7B\u578B\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u8FD9\u4E9B\u522B\u540D\u3002\u4E0D\u8FC7 Modern.js Module \u4F1A\u5BF9 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7684\u7C7B\u578B\u6587\u4EF6\u91CC\u7684\u522B\u540D\u8FDB\u884C\u8F6C\u6362\u5904\u7406\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u4E00\u4E9B\u793A\u4F8B",children:["\u4E00\u4E9B\u793A\u4F8B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E00\u4E9B\u793A\u4F8B",children:"#"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6B64\u65F6\u6253\u5305\u7684\u7C7B\u578B\u6587\u4EF6\u8F93\u51FA\u8DEF\u5F84\u4E3A `./dist/types`\uFF0C\u5E76\u4E14\u5C06\u4F1A\u8BFB\u53D6\u9879\u76EE\u4E0B\u7684 other-tsconfig.json \u6587\u4EF6\n buildConfig: {\n buildType: 'bundle',\n dts: {\n tsconfigPath: './other-tsconfig.json',\n distPath: './types',\n },\n outDir: './dist',\n },\n});\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6B64\u65F6\u7C7B\u578B\u6587\u4EF6\u6CA1\u6709\u8FDB\u884C\u6253\u5305\uFF0C\u8F93\u51FA\u8DEF\u5F84\u4E3A `./dist/types`\n buildConfig: [\n {\n buildType: 'bundle',\n dts: false,\n outDir: './dist',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u6784\u5EFA\u8FC7\u7A0B",children:["\u6784\u5EFA\u8FC7\u7A0B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u8FC7\u7A0B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,r.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u53D1\u751F"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u6839\u636E ",(0,r.jsx)(n.code,{children:"buildConfig.outDir"})," \u6E05\u7406\u4EA7\u7269\u76EE\u5F55\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u7F16\u8BD1 ",(0,r.jsx)(n.code,{children:"js/ts"})," \u6E90\u4EE3\u7801\u751F\u6210 bundle / bundleless \u7684 JS \u6784\u5EFA\u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210 bundle / bundleless \u7684\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5904\u7406 ",(0,r.jsx)(n.code,{children:"copy"})," \u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u6784\u5EFA\u62A5\u9519",children:["\u6784\u5EFA\u62A5\u9519",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u62A5\u9519",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u53D1\u751F\u6784\u5EFA\u62A5\u9519\u7684\u65F6\u5019\uFF0C\u57FA\u4E8E\u4EE5\u4E0A\u4E86\u89E3\u5230\u7684\u4FE1\u606F\uFF0C\u53EF\u4EE5\u5F88\u5BB9\u6613\u7684\u660E\u767D\u5728\u7EC8\u7AEF\u51FA\u73B0\u7684\u62A5\u9519\u5185\u5BB9\uFF1A"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"js \u6216\u8005 ts \u6784\u5EFA\u7684\u62A5\u9519\uFF1A"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'error ModuleBuildError:\n\n\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 bundle failed: \u2502\n\u2502 - format is "cjs" \u2502\n\u2502 - target is "esnext" \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n\nDetailed Information:\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u8FC7\u7A0B\u7684\u62A5\u9519\uFF1A"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"error ModuleBuildError:\n\nbundle DTS failed:\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5BF9\u4E8E ",(0,r.jsx)(n.code,{children:"js/ts"})," \u6784\u5EFA\u9519\u8BEF\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4ECE\u62A5\u9519\u4FE1\u606F\u4E2D\u77E5\u9053\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"buildType"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"format"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"target"})]}),"\n",(0,r.jsx)(n.li,{children:"\u5176\u4ED6\u5177\u4F53\u62A5\u9519\u4FE1\u606F"}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u8C03\u8BD5\u6A21\u5F0F",children:["\u8C03\u8BD5\u6A21\u5F0F",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8C03\u8BD5\u6A21\u5F0F",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE ",(0,r.jsx)(n.strong,{children:"2.36.0"})," \u7248\u672C\u5F00\u59CB\uFF0C\u4E3A\u4E86\u4FBF\u4E8E\u6392\u67E5\u95EE\u9898\uFF0CModern.js Module \u63D0\u4F9B\u4E86\u8C03\u8BD5\u6A21\u5F0F\uFF0C\u4F60\u53EF\u4EE5\u5728\u6267\u884C\u6784\u5EFA\u65F6\u6DFB\u52A0 DEBUG=module \u73AF\u5883\u53D8\u91CF\u6765\u5F00\u542F\u8C03\u8BD5\u6A21\u5F0F\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"DEBUG=module modern build\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u8C03\u8BD5\u6A21\u5F0F\u4E0B\uFF0C\u4F60\u4F1A\u770B\u5230 Shell \u4E2D\u8F93\u51FA\u66F4\u8BE6\u7EC6\u7684\u6784\u5EFA\u65E5\u5FD7\uFF0C\u8FD9\u4E3B\u8981\u4EE5\u6D41\u7A0B\u65E5\u5FD7\u4E3A\u4E3B\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"module run beforeBuildTask hooks +6ms\nmodule run beforeBuildTask hooks done +0ms\nmodule [DTS] Build Start +139ms\nmodule [CJS] Build Start +1ms\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u53E6\u5916\uFF0CModule \u8FD8\u63D0\u4F9B\u4E86\u8C03\u8BD5\u5185\u90E8\u5DE5\u4F5C\u6D41\u7A0B\u7684\u80FD\u529B\u3002\u4F60\u53EF\u4EE5\u901A\u8FC7\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF ",(0,r.jsx)(n.code,{children:"DEBUG=module:*"})," \u6765\u5F00\u542F\u66F4\u8BE6\u7EC6\u7684\u8C03\u8BD5\u65E5\u5FD7:"]}),"\n",(0,r.jsxs)(n.p,{children:["\u76EE\u524D\u53EA\u652F\u6301\u4E86 ",(0,r.jsx)(n.code,{children:"DEBUG=module:resolve"}),"\uFF0C\u53EF\u4EE5\u67E5\u770B Module \u5185\u90E8\u6A21\u5757\u89E3\u6790\u7684\u8BE6\u7EC6\u65E5\u5FD7:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:" module:resolve onResolve args: {\n path: './src/hooks/misc.ts',\n importer: '',\n namespace: 'file',\n resolveDir: '/Users/bytedance/modern.js/packages/solutions/module-tools',\n kind: 'entry-point',\n pluginData: undefined\n} +0ms\n module:resolve onResolve result: {\n path: '/Users/bytedance/modern.js/packages/solutions/module-tools/src/hooks/misc.ts',\n external: false,\n namespace: 'file',\n sideEffects: undefined,\n suffix: ''\n} +0ms\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fin-depth-about-build.md"]={toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4},{text:"Hook API",id:"hook-api",depth:3},{text:"load",id:"load",depth:4},{text:"transform",id:"transform",depth:4},{text:"renderChunk",id:"renderchunk",depth:4},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2}],title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2454.1092ba62.js.LICENSE.txt b/modern-js/module-tools/static/js/async/131.7e780f65.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2454.1092ba62.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/131.7e780f65.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1310.d1270024.js b/modern-js/module-tools/static/js/async/1310.d1270024.js new file mode 100644 index 0000000000..46f9e09195 --- /dev/null +++ b/modern-js/module-tools/static/js/async/1310.d1270024.js @@ -0,0 +1,2 @@ +/*! For license information please see 1310.d1270024.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1310"],{35756:function(e,n,i){"use strict";i.r(n);var d=i("39980"),l=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",pre:"pre",strong:"strong",ul:"ul",li:"li",ol:"ol",em:"em"},(0,l.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",children:["\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",children:"#"})]}),"\n",(0,d.jsxs)(n.h2,{id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",children:["\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["\u5F53\u4F60\u5728\u521D\u59CB\u5316\u7684\u9879\u76EE\u91CC\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0CModern.js Module \u4F1A\u6839\u636E\u5F53\u524D\u914D\u7F6E\u5185\u5BB9\uFF0C\u751F\u6210\u76F8\u5E94\u7684\u6784\u5EFA\u4EA7\u7269\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u6A21\u677F\u521B\u5EFA\u7684\u9ED8\u8BA4\u914D\u7F6E\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6CE8\u518C Modern.js Module \u7684 CLI \u5DE5\u5177\n plugins: [moduleTools()],\n // \u6307\u5B9A\u6784\u5EFA\u9884\u8BBE\u914D\u7F6E\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.strong,{children:"\u9ED8\u8BA4\u751F\u6210\u4EA7\u7269\u5177\u6709\u4EE5\u4E0B\u7279\u70B9"}),"\uFF1A"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4F1A\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://nodejs.org/api/modules.html#modules-commonjs-modules",target:"_blank",rel:"noopener noreferrer",children:"CommonJS"})," \u548C ",(0,d.jsx)(n.a,{href:"https://nodejs.org/api/esm.html#modules-ecmascript-modules",target:"_blank",rel:"noopener noreferrer",children:"ESM"})," \u4E24\u4EFD\u4EA7\u7269\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EE3\u7801\u8BED\u6CD5\u652F\u6301\u5230 ",(0,d.jsx)(n.code,{children:"ES6"})," ,\u66F4\u9AD8\u7EA7\u7684\u8BED\u6CD5\u5C06\u4F1A\u88AB\u8F6C\u6362\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6240\u6709\u7684\u4EE3\u7801\u7ECF\u8FC7\u6253\u5305\u53D8\u6210\u4E86\u4E00\u4E2A\u6587\u4EF6\uFF0C\u5373\u8FDB\u884C\u4E86 ",(0,d.jsx)(n.strong,{children:"bundle"})," \u5904\u7406\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u8F93\u51FA\u6839\u76EE\u5F55\u4E3A\u9879\u76EE\u4E0B\u7684 ",(0,d.jsx)(n.code,{children:"dist"})," \u76EE\u5F55\uFF0C\u7C7B\u578B\u6587\u4EF6\u8F93\u51FA\u7684\u76EE\u5F55\u4E3A ",(0,d.jsx)(n.code,{children:"dist/types"}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"\u770B\u5230\u8FD9\u91CC\u4F60\u53EF\u80FD\u4F1A\u6709\u4EE5\u4E0B\u7591\u95EE\uFF1A"}),"\n",(0,d.jsxs)(n.ol,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"buildPreset"})," \u662F\u4EC0\u4E48\uFF1F"]}),"\n",(0,d.jsx)(n.li,{children:"\u4EA7\u7269\u7684\u8FD9\u4E9B\u7279\u70B9\u662F\u7531\u4EC0\u4E48\u51B3\u5B9A\u7684\uFF1F"}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u9996\u5148\u6765\u4E86\u89E3\u4E00\u4E0B ",(0,d.jsx)(n.code,{children:"buildPreset"}),"\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"\u6784\u5EFA\u9884\u8BBE",children:["\u6784\u5EFA\u9884\u8BBE",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u9884\u8BBE",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"buildPreset"})," \u4EE3\u8868\u7740\u63D0\u524D\u51C6\u5907\u597D\u7684\u4E00\u7EC4\u6216\u8005\u591A\u7EC4\u6784\u5EFA\u76F8\u5173\u7684\u914D\u7F6E\uFF0C\u53EA\u9700\u8981\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u5BF9\u5E94\u7684\u9884\u8BBE\u503C\uFF0C\u5C31\u53EF\u4EE5\u7701\u53BB\u9EBB\u70E6\u4E14\u590D\u6742\u7684\u914D\u7F6E\u5DE5\u4F5C\uFF0C\u5F97\u5230\u7B26\u5408\u9884\u671F\u7684\u4EA7\u7269\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"Modern.js Module \u4E3B\u8981\u5185\u7F6E\u4E86\u4E24\u5957\u6784\u5EFA\u9884\u8BBE\uFF0C\u5305\u62EC:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"npm-component"}),": \u7528\u4E8E\u6784\u5EFA\u7EC4\u4EF6\u5E93\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"npm-library"}),": \u7528\u4E8E\u6253\u5305\u5176\u4ED6\u5E93\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u5982\u5DE5\u5177\u5E93\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u540C\u65F6\uFF0C\u8FD8\u63D0\u4F9B\u4E00\u4E9B\u53D8\u4F53\uFF0C\u4F8B\u5982 ",(0,d.jsx)(n.code,{children:"npm-library-with-umd"})," \u548C ",(0,d.jsx)(n.code,{children:"npm-library-es5"}),"\uFF0C\u987E\u540D\u601D\u4E49\uFF0C\u5206\u522B\u5BF9\u5E94\u5E26\u6709 umd \u4EA7\u7269\u548C\u652F\u6301\u5230 es5 \u8BED\u6CD5\u7684\u5E93\u9884\u8BBE\u3002\n\u8BE6\u7EC6\u914D\u7F6E\u53EF\u4EE5\u67E5\u770B\u5176 ",(0,d.jsx)(n.a,{href:"/api/config/build-preset",children:"API"})," \u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u9664\u6B64\u4E4B\u5916\uFF0C\u6211\u4EEC\u4E5F\u53EF\u4EE5\u5B8C\u5168\u81EA\u5B9A\u4E49\u6784\u5EFA\u914D\u7F6E:"}),"\n",(0,d.jsxs)(n.h2,{id:"\u6784\u5EFA\u914D\u7F6E",children:["\u6784\u5EFA\u914D\u7F6E",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u914D\u7F6E",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsxs)(n.strong,{children:[(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879"]}),"\u3002\u5728\u6700\u5F00\u59CB\u63D0\u5230\u7684\u5173\u4E8E\u201C",(0,d.jsx)(n.em,{children:"\u6784\u5EFA\u4EA7\u7269\u7684\u7279\u70B9"}),"\u201D\uFF0C\u5176\u5B9E\u90FD\u662F ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u6240\u652F\u6301\u7684\u5C5E\u6027\u3002\u76EE\u524D\u6240\u652F\u6301\u7684\u5C5E\u6027\u8986\u76D6\u4E86\u5927\u90E8\u5206\u6A21\u5757\u7C7B\u578B\u9879\u76EE\u5728\u6784\u5EFA\u4EA7\u7269\u65F6\u7684\u9700\u6C42\uFF0C",(0,d.jsx)(n.code,{children:"buildConfig"})," \u4E0D\u4EC5\u5305\u542B\u4E00\u4E9B\u4EA7\u7269\u6240\u5177\u5907\u7684\u5C5E\u6027\uFF0C\u4E5F\u5305\u542B\u4E86\u6784\u5EFA\u4EA7\u7269\u6240\u9700\u8981\u7684\u4E00\u4E9B\u7279\u6027\u529F\u80FD\u3002\u63A5\u4E0B\u6765\u4ECE\u5206\u7C7B\u7684\u89D2\u5EA6\u7B80\u5355\u7F57\u5217\u4E00\u4E0B\uFF1A"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u6784\u5EFA\u4EA7\u7269\u7684\u57FA\u672C\u5C5E\u6027\u5305\u62EC\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u662F\u5426\u88AB\u6253\u5305\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#buildtype",children:(0,d.jsx)(n.code,{children:"buildConfig.buildType"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u5BF9\u4E8E\u8BED\u6CD5\u7684\u652F\u6301\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#target",children:(0,d.jsx)(n.code,{children:"buildConfig.target"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u683C\u5F0F\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#format",children:(0,d.jsx)(n.code,{children:"buildConfig.format"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u7C7B\u578B\u6587\u4EF6\u5982\u4F55\u5904\u7406\uFF0C\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#dts",children:(0,d.jsx)(n.code,{children:"buildConfig.dts"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u7684 sourceMap \u5982\u4F55\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#sourcemap",children:(0,d.jsx)(n.code,{children:"buildConfig.sourceMap"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u5BF9\u5E94\u7684\u8F93\u5165\uFF08\u6216\u8005\u662F\u6E90\u6587\u4EF6\uFF09\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,d.jsx)(n.code,{children:"buildConfig.input"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u8F93\u51FA\u7684\u76EE\u5F55\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#outdir",children:(0,d.jsx)(n.code,{children:"buildConfig.outDir"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,d.jsx)(n.code,{children:"buildConfig.sourceDir"})}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u6784\u5EFA\u4EA7\u7269\u6240\u9700\u7684\u5E38\u7528\u529F\u80FD\u5305\u62EC\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u522B\u540D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#alias",children:(0,d.jsx)(n.code,{children:"buildConfig.alias"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u9759\u6001\u8D44\u6E90\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#asset",children:(0,d.jsx)(n.code,{children:"buildConfig.asset"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u6709\uFF1A","\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,d.jsx)(n.code,{children:"buildConfig.autoExternal"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,d.jsx)(n.code,{children:"buildConfig.externals"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(n.li,{children:["\u62F7\u8D1D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#copy",children:(0,d.jsx)(n.code,{children:"buildConfig.copy"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u5168\u5C40\u53D8\u91CF\u66FF\u6362\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#define",children:(0,d.jsx)(n.code,{children:"buildConfig.define"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A ",(0,d.jsx)(n.a,{href:"https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"JSX"})," \u7F16\u8BD1\u65B9\u5F0F\uFF0C\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#jsx",children:(0,d.jsx)(n.code,{children:"buildConfig.jsx"})}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u4E00\u4E9B\u9AD8\u7EA7\u5C5E\u6027\u6216\u8005\u4F7F\u7528\u9891\u7387\u4E0D\u9AD8\u7684\u529F\u80FD\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u4EE3\u7801\u538B\u7F29\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#minify",children:(0,d.jsx)(n.code,{children:"buildConfig.minify"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EE3\u7801\u5206\u5272\uFF1A",(0,d.jsx)(n.a,{href:"/api/config/build-config#splitting",children:(0,d.jsx)(n.code,{children:"buildConfig.spitting"})})]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A\u6784\u5EFA\u4EA7\u7269\u7528\u4E8E NodeJS \u73AF\u5883\u8FD8\u662F\u6D4F\u89C8\u5668\u73AF\u5883\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#platform",children:(0,d.jsx)(n.code,{children:"buildConfig.platform"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["umd \u4EA7\u7269\u76F8\u5173\uFF1A","\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A umd \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#umdglobals",children:(0,d.jsx)(n.code,{children:"buildConfig.umdGlobals"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A umd \u4EA7\u7269\u7684\u6A21\u5757\u540D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#umdmodulename",children:(0,d.jsx)(n.code,{children:"buildConfig.umdModuleName"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"\u9664\u4E86\u4EE5\u4E0A\u5206\u7C7B\u4EE5\u5916\uFF0C\u5173\u4E8E\u8FD9\u4E9B API \u7684\u5E38\u89C1\u95EE\u9898\u548C\u6700\u4F73\u5B9E\u8DF5\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u94FE\u63A5\u6765\u4E86\u89E3\uFF1A"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:(0,d.jsxs)(n.a,{href:"/guide/advance/in-depth-about-build#bundle--bundleless",children:["\u5173\u4E8E ",(0,d.jsx)(n.code,{children:"bundle"})," \u548C ",(0,d.jsx)(n.code,{children:"bundleless"})]})}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsxs)(n.a,{href:"/guide/advance/in-depth-about-build#input--sourcedir",children:["\u5173\u4E8E ",(0,d.jsx)(n.code,{children:"input"})," \u548C ",(0,d.jsx)(n.code,{children:"sourceDir"})]}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#dts",children:"\u5173\u4E8E\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6"}),"\u3002"]}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#define",children:"\u5982\u4F55\u4F7F\u7528 define"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/external-dependency",children:"\u5982\u4F55\u5904\u7406\u7B2C\u4E09\u65B9\u4F9D\u8D56"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/copy",children:"\u5982\u4F55\u4F7F\u7528\u62F7\u8D1D"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/build-umd",children:"\u5982\u4F55\u6784\u5EFA umd \u4EA7\u7269"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/asset",children:"\u5982\u4F55\u4F7F\u7528\u9759\u6001\u8D44\u6E90"})}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",children:["\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["\u4E86\u89E3 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u548C ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u540E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5C06\u4E8C\u8005\u8FDB\u884C\u7ED3\u5408\u4F7F\u7528\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5728\u5B9E\u9645\u9879\u76EE\u4E2D,\u6211\u4EEC\u53EF\u4EE5\u5148\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u6765\u5FEB\u901F\u83B7\u53D6\u4E00\u5957\u9ED8\u8BA4\u6784\u5EFA\u914D\u7F6E\u3002\u5982\u679C\u9700\u8981\u81EA\u5B9A\u4E49,\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u8FDB\u884C\u8986\u76D6\u548C\u6269\u5C55\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u6269\u5C55\u7684\u903B\u8F91\u5982\u4E0B:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u5F53 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u6570\u7EC4\u65F6\uFF0C\u4F1A\u5728\u539F\u6765\u7684\u9884\u8BBE\u57FA\u7840\u4E0A\u6DFB\u52A0\u65B0\u7684\u914D\u7F6E\u9879\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: [\n {\n format: 'iife',\n target: 'es2020',\n outDir: './dist/global'\n }\n ]\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u8FD9\u4F1A\u5728\u539F\u672C\u9884\u8BBE\u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u751F\u6210\u4E00\u4EFD IIFE \u683C\u5F0F\u3001\u652F\u6301\u5230 ES2020 \u8BED\u6CD5\u7684\u4EA7\u7269\uFF0C\u8F93\u51FA\u76EE\u5F55\u4E3A\u9879\u76EE\u4E0B\u7684 ",(0,d.jsx)(n.code,{children:"dist/global"})," \u76EE\u5F55\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u5F53 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u5BF9\u8C61\u65F6,\u4F1A\u5C06\u5BF9\u8C61\u4E2D\u7684\u914D\u7F6E\u9879\u8986\u76D6\u5230\u9884\u8BBE\u4E2D\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: {\n sourceMap: true,\n }\n});\n"})}),"\n",(0,d.jsx)(n.p,{children:"\u8FD9\u4F1A\u4F7F\u5F97\u6BCF\u4E00\u9879\u6784\u5EFA\u4EFB\u52A1\u90FD\u4F1A\u751F\u6210 sourceMap \u6587\u4EF6\u3002"})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,l.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fmodify-output-product.md"]={toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2}],title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1881.32ba02bd.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1310.d1270024.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1881.32ba02bd.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1310.d1270024.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1342.6f7bd018.js b/modern-js/module-tools/static/js/async/1342.6f7bd018.js deleted file mode 100644 index 26a39eba10..0000000000 --- a/modern-js/module-tools/static/js/async/1342.6f7bd018.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 1342.6f7bd018.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1342"],{30669:function(e,n,s){"use strict";s.r(n);var r=s("39980"),d=s("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"general-questions",children:["General Questions",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#general-questions",children:"#"})]}),"\n",(0,r.jsxs)(n.h2,{id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",children:["What is the relationship between Modern.js Module and Rsbuild?",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#what-is-the-relationship-between-modernjs-module-and-rsbuild",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module uses esbuild to build toolkits and component libraries, and Rsbuild focuses on solving web application building scenarios."}),"\n",(0,r.jsxs)(n.h2,{id:"can-modernjs-module-use-webpack-plugins-or-loaders",children:["Can Modern.js Module use webpack plugins or loaders?",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#can-modernjs-module-use-webpack-plugins-or-loaders",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module is based on esbuild for building and cannot use tools from the webpack-related ecosystem.\nYou can find more community plugins for esbuild ",(0,r.jsx)(n.a,{href:"https://github.com/esbuild/community-plugins",target:"_blank",rel:"noopener noreferrer",children:"here"})]}),"\n",(0,r.jsxs)(n.p,{children:["If the UMD product produced by Modern.js Module does not meet your requirements, you can use Rsbuild and add ",(0,r.jsx)(n.a,{href:"https://rsbuild.dev/plugins/list/plugin-umd",target:"_blank",rel:"noopener noreferrer",children:"UMD Plugin"})," to build UMD products."]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Fbasic.mdx"]={toc:[{text:"What is the relationship between Modern.js Module and Rsbuild?",id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",depth:2},{text:"Can Modern.js Module use webpack plugins or loaders?",id:"can-modernjs-module-use-webpack-plugins-or-loaders",depth:2}],title:"General Questions",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1276.e7748929.js b/modern-js/module-tools/static/js/async/1563.bf6e86c1.js similarity index 97% rename from modern-js/module-tools/static/js/async/1276.e7748929.js rename to modern-js/module-tools/static/js/async/1563.bf6e86c1.js index 0b53fd083d..74a3cf1ea4 100644 --- a/modern-js/module-tools/static/js/async/1276.e7748929.js +++ b/modern-js/module-tools/static/js/async/1563.bf6e86c1.js @@ -1,2 +1,2 @@ -/*! For license information please see 1276.e7748929.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1276"],{67982:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580"),t=s("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",ol:"ol",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",strong:"strong"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"vue-plugin",children:["Vue Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vue-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Vue plugin provides support for building Vue 3 components. The plugin internally integrates ",(0,i.jsx)(n.a,{href:"https://github.com/pipe01/esbuild-plugin-vue3",target:"_blank",rel:"noopener noreferrer",children:"esbuild-plugin-vue3"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Notice that we have some limitation:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"The current implementation of this plugin integrates directly with the community plugin and therefore does not support writing jsx/tsx in sfc."}),"\n",(0,i.jsxs)(n.li,{children:["If you want to generate d.ts for the components, please use the official recommendation ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/vue-tsc",target:"_blank",rel:"noopener noreferrer",children:"vue-tsc"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Only support bundle, we recommend to set input to ",(0,i.jsx)(n.code,{children:"['src/**/*.vue']"})," or ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(t.SU,{command:"add @modern-js/plugin-module-vue -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginVue } from '@modern-js/plugin-module-vue';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginVue()],\n buildConfig: {\n buildType: 'bundle',\n format: 'esm',\n input: ['src/index.vue'],\n dts: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"options",children:["Options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#options",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"vuejsxpluginoptions",children:["vueJsxPluginOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vuejsxpluginoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"Type:"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type VueJSXPluginOptions = {\n /** transform `on: { click: xx }` to `onClick: xxx` */\n transformOn?: boolean;\n /** enable optimization or not. */\n optimize?: boolean;\n /** merge static and dynamic class / style attributes / onXXX handlers */\n mergeProps?: boolean;\n /** configuring custom elements */\n isCustomElement?: (tag: string) => boolean;\n /** enable object slots syntax */\n enableObjectSlots?: boolean;\n /** Replace the function used when compiling JSX expressions */\n pragma?: string;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default:"})," ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Options passed to ",(0,i.jsx)(n.code,{children:"@vue/babel-plugin-jsx"}),", please refer to the ",(0,i.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx documentation"})," for detailed usage."]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-vue.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Options",id:"options",depth:2},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3}],title:"Vue Plugin",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 1563.bf6e86c1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1563"],{39875:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580"),t=s("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",ol:"ol",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",strong:"strong"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"vue-plugin",children:["Vue Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vue-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Vue plugin provides support for building Vue 3 components. The plugin internally integrates ",(0,i.jsx)(n.a,{href:"https://github.com/pipe01/esbuild-plugin-vue3",target:"_blank",rel:"noopener noreferrer",children:"esbuild-plugin-vue3"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Notice that we have some limitation:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"The current implementation of this plugin integrates directly with the community plugin and therefore does not support writing jsx/tsx in sfc."}),"\n",(0,i.jsxs)(n.li,{children:["If you want to generate d.ts for the components, please use the official recommendation ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/vue-tsc",target:"_blank",rel:"noopener noreferrer",children:"vue-tsc"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Only support bundle, we recommend to set input to ",(0,i.jsx)(n.code,{children:"['src/**/*.vue']"})," or ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(t.SU,{command:"add @modern-js/plugin-module-vue -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginVue } from '@modern-js/plugin-module-vue';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginVue()],\n buildConfig: {\n buildType: 'bundle',\n format: 'esm',\n input: ['src/index.vue'],\n dts: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"options",children:["Options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#options",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"vuejsxpluginoptions",children:["vueJsxPluginOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vuejsxpluginoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"Type:"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type VueJSXPluginOptions = {\n /** transform `on: { click: xx }` to `onClick: xxx` */\n transformOn?: boolean;\n /** enable optimization or not. */\n optimize?: boolean;\n /** merge static and dynamic class / style attributes / onXXX handlers */\n mergeProps?: boolean;\n /** configuring custom elements */\n isCustomElement?: (tag: string) => boolean;\n /** enable object slots syntax */\n enableObjectSlots?: boolean;\n /** Replace the function used when compiling JSX expressions */\n pragma?: string;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default:"})," ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Options passed to ",(0,i.jsx)(n.code,{children:"@vue/babel-plugin-jsx"}),", please refer to the ",(0,i.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx documentation"})," for detailed usage."]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-vue.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Options",id:"options",depth:2},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3}],title:"Vue Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1276.e7748929.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1563.bf6e86c1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1276.e7748929.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1563.bf6e86c1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/301.c0705076.js b/modern-js/module-tools/static/js/async/1586.aa3224bf.js similarity index 78% rename from modern-js/module-tools/static/js/async/301.c0705076.js rename to modern-js/module-tools/static/js/async/1586.aa3224bf.js index 8a3ce936bb..9439e3bcf1 100644 --- a/modern-js/module-tools/static/js/async/301.c0705076.js +++ b/modern-js/module-tools/static/js/async/1586.aa3224bf.js @@ -1,2 +1,2 @@ -/*! For license information please see 301.c0705076.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["301"],{67541:function(t,e,n){"use strict";n.r(e);var o=n("39980"),s=n("9580");function _(t){return(0,o.jsx)(o.Fragment,{})}function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),t.components);return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(_,{...t})}):_(t)}e.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-test.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 1586.aa3224bf.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1586"],{2910:function(t,e,n){"use strict";n.r(e);var o=n("39980"),s=n("9580");function _(t){return(0,o.jsx)(o.Fragment,{})}function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),t.components);return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(_,{...t})}):_(t)}e.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-test.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2974.159183a5.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1586.aa3224bf.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2974.159183a5.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1586.aa3224bf.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1600.854a5d28.js b/modern-js/module-tools/static/js/async/1600.854a5d28.js new file mode 100644 index 0000000000..ec021c8611 --- /dev/null +++ b/modern-js/module-tools/static/js/async/1600.854a5d28.js @@ -0,0 +1,2 @@ +/*! For license information please see 1600.854a5d28.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1600"],{26166:function(e,n,r){"use strict";r.r(n);var s=r("39980"),o=r("9580"),l=r("23657");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"import-\u63D2\u4EF6",children:["Import \u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#import-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u63D0\u4F9B\u4E0E ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"})," \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E ",(0,s.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," \u5B9E\u73B0\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE ",(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," 2.16.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BE5\u63D2\u4EF6\u529F\u80FD\u5185\u7F6E\u5728 Modern.js Module \u4E2D\uFF0C\u7531 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:(0,s.jsx)(n.code,{children:"transformImport"})}),"\n\u914D\u7F6E\u63D0\u4F9B\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(l.SU,{command:"add @modern-js/plugin-module-import -D"}),"\n",(0,s.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginImport } from '@modern-js/plugin-module-import';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'antd',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u8FD9\u6837\u6211\u4EEC\u5C31\u53EF\u4EE5\u5728 Modern.js Module \u4E2D\u4F7F\u7528\u81EA\u52A8\u5BFC\u5165\u7684\u80FD\u529B\u4E86\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Options = {\n pluginImport?: ImportItem[];\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"pluginimport",children:["pluginImport",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pluginimport",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"object[]"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5176\u4E2D\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," (Speedy Web Compiler) \u662F\u57FA\u4E8E Rust \u8BED\u8A00\u7F16\u5199\u7684\uFF0C\u800C\u8BE5\u63D2\u4EF6\u662F\u57FA\u4E8E SWC\uFF0C\u79FB\u690D\u81EA ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"}),"\uFF0C\u914D\u7F6E\u9009\u9879\u4FDD\u6301\u4E86\u4E00\u81F4\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E00\u4E9B\u914D\u7F6E\u53EF\u4EE5\u4F20\u5165\u51FD\u6570\uFF0C\u4F8B\u5982 ",(0,s.jsx)(n.code,{children:"customName"}),"\uFF0C",(0,s.jsx)(n.code,{children:"customStyleName"})," \u7B49\uFF0C \u4F46\u5728 Modern.js Module \u91CC\uFF0C\u6211\u4EEC\u4E0D\u5EFA\u8BAE\u5728\u6B64\u914D\u7F6E\u9879\u91CC\u4F7F\u7528\u51FD\u6570\u3002\n\u56E0\u4E3A\u6211\u4EEC\u4F1A\u5728 esbuild \u7684\u63D2\u4EF6\u91CC\u8C03\u7528 SWC\uFF0C\u7136\u540E\u518D\u5F53 Rust \u901A\u8FC7 Node-API \u8C03\u7528\u8FD9\u4E9B\u914D\u7F6E\u51FD\u6570\u65F6\uFF0C\u4F1A\u51FA\u73B0\u6B7B\u9501\u73B0\u8C61\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u7B80\u5355\u7684\u51FD\u6570\u903B\u8F91\u5176\u5B9E\u53EF\u4EE5\u901A\u8FC7\u6A21\u7248\u8BED\u8A00\u6765\u4EE3\u66FF\uFF0C\u4E0B\u9762\u662F\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"customName"})," \u4F7F\u7528\u6A21\u677F\u7684\u793A\u4F8B\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { MyButton as Btn } from 'foo';\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ member }}',\n },\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5176\u4E2D\u7684 ",(0,s.jsx)(n.code,{children:"{{ member }}"})," \u4F1A\u88AB\u66FF\u6362\u4E3A\u76F8\u5E94\u7684\u5F15\u5165\u6210\u5458\uFF0C\u8F6C\u6362\u540E:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/MyButton';\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u53EF\u4EE5\u770B\u51FA\u914D\u7F6E ",(0,s.jsx)(n.code,{children:'customName: "foo/es/{{ member }}"'})," \u7684\u6548\u679C\u7B49\u540C\u4E8E\u914D\u7F6E ",(0,s.jsx)(n.code,{children:" customName: (member) => `foo/es/${member}` "})," \u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u91CC\u4F7F\u7528\u5230\u7684\u6A21\u7248\u662F ",(0,s.jsx)(n.a,{href:"https://handlebarsjs.com",target:"_blank",rel:"noopener noreferrer",children:"handlebars"}),"\uFF0C\u6A21\u7248\u914D\u7F6E\u4E2D\u8FD8\u5185\u7F6E\u4E86\u4E00\u4E9B\u6709\u7528\u7684\u8F85\u52A9\u5DE5\u5177\uFF0C\u8FD8\u662F\u4EE5\u4E0A\u9762\u7684\u5BFC\u5165\u8BED\u53E5\u4E3A\u4F8B\uFF0C\u914D\u7F6E\u6210\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ kebabCase member }}',\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u4F1A\u8F6C\u6362\u6210\u4E0B\u9762\u7684\u7ED3\u679C\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/my-button';\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 ",(0,s.jsx)(n.code,{children:"kebabCase"})," \u4EE5\u5916\u8FD8\u6709 ",(0,s.jsx)(n.code,{children:"camelCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"snakeCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"upperCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"lowerCase"})," \u53EF\u4EE5\u4F7F\u7528\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-import.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"pluginImport",id:"pluginimport",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2}],title:"Import \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2377.66c1b3fa.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1600.854a5d28.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2377.66c1b3fa.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1600.854a5d28.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3934.38c21141.js b/modern-js/module-tools/static/js/async/1684.f3977b44.js similarity index 99% rename from modern-js/module-tools/static/js/async/3934.38c21141.js rename to modern-js/module-tools/static/js/async/1684.f3977b44.js index ffe261d16c..1a8374a1ac 100644 --- a/modern-js/module-tools/static/js/async/3934.38c21141.js +++ b/modern-js/module-tools/static/js/async/1684.f3977b44.js @@ -1,2 +1,2 @@ -/*! For license information please see 3934.38c21141.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3934"],{16770:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",strong:"strong",ol:"ol",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879\uFF0C\u5B83\u5305\u542B\u4E86\u6784\u5EFA\u7684\u6240\u6709\u914D\u7F6E\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728\u5F00\u59CB\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u524D\uFF0C\u8BF7\u5148\u9605\u8BFB\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u5176\u4F5C\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5BF9\u4E8E TypeScript \u9879\u76EE\uFF0C\u53EA\u9700\u8981\u5728 ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u4E2D\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"}),", Modern.js Module \u4F1A\u81EA\u52A8\u8BC6\u522B ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u91CC\u7684\u522B\u540D\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u989D\u5916\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"alias"})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: {\n '@common': './src/common',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4EE5\u4E0A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u5982\u679C\u5728\u4EE3\u7801\u4E2D\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"}),", \u5219\u4F1A\u6620\u5C04\u5230 ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," \u8DEF\u5F84\u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"alias"})," \u7684\u503C\u5B9A\u4E49\u4E3A\u51FD\u6570\u65F6\uFF0C\u53EF\u4EE5\u63A5\u53D7\u9884\u8BBE\u7684 alias \u5BF9\u8C61\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n alias['@common'] = './src/common';\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4E5F\u53EF\u4EE5\u5728\u51FD\u6570\u4E2D\u8FD4\u56DE\u4E00\u4E2A\u65B0\u5BF9\u8C61\u4F5C\u4E3A\u6700\u7EC8\u7ED3\u679C\uFF0C\u65B0\u5BF9\u8C61\u4F1A\u8986\u76D6\u9884\u8BBE\u7684 alias \u5BF9\u8C61\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n return {\n '@common': './src/common',\n };\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5305\u542B\u9759\u6001\u8D44\u6E90\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u6587\u4EF6\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53 asset.name \u4E3A string \u7C7B\u578B\u65F6\uFF0C\u4F1A\u81EA\u52A8\u5BF9 [name]\u3001[ext]\u3001[hash] \u8FDB\u884C\u66FF\u6362\uFF0C\u5206\u522B\u66FF\u6362\u4E3A\u6587\u4EF6\u540D\u3001\u62D3\u5C55\u540D\u3001\u6587\u4EF6 hash\u3002\n\u5982\u679C\u60F3\u8981\u66F4\u9AD8\u7684\u81EA\u7531\u5EA6\uFF0C\u53EF\u4EE5\u628A asset.name \u4F5C\u4E3A\u65B9\u6CD5\u4F7F\u7528\uFF0C\u8FD4\u56DE\u503C\u5373\u4E3A\u6587\u4EF6\u540D\u3002\u6B64\u65F6\uFF0C\u8BE5\u65B9\u6CD5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570 assetPath\uFF0C\u5BF9\u5E94\u8D44\u6E90\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u8BBE\u7F6E\u9759\u6001\u8D44\u6E90\u88AB\u81EA\u52A8\u5185\u8054\u4E3A base64 \u7684\u4F53\u79EF\u9608\u503C\u3002"}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u5728\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u9ED8\u8BA4\u4F1A\u5185\u8054\u4F53\u79EF\u5C0F\u4E8E 10KB \u7684\u56FE\u7247\u3001\u5B57\u4F53\u3001\u5A92\u4F53\u7B49\u8D44\u6E90\uFF0C\u5C06\u5B83\u4EEC\u901A\u8FC7 Base64 \u7F16\u7801\uFF0C\u5E76\u5185\u8054\u5230\u4EA7\u7269\u4E2D\uFF0C\u4E0D\u518D\u4F1A\u53D1\u9001\u72EC\u7ACB\u7684 HTTP \u8BF7\u6C42\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u4FEE\u6539 ",(0,i.jsx)(n.code,{children:"limit"})," \u53C2\u6570\u6765\u8C03\u6574\u8FD9\u4E2A\u9608\u503C\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06 ",(0,i.jsx)(n.code,{children:"limit"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"0"})," \u6765\u907F\u514D\u8D44\u6E90\u5185\u8054\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u8DEF\u5F84\uFF0C\u4F1A\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6253\u5305\u65F6\u7ED9\u672A\u5185\u8054\u8D44\u6E90\u7684 CDN \u524D\u7F00\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C\u6240\u6709\u9759\u6001\u8D44\u6E90\u90FD\u4F1A\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"https://xxx/"})," \u524D\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6253\u5305\u65F6\u5C06 SVG \u4F5C\u4E3A\u4E00\u4E2A React \u7EC4\u4EF6\u5904\u7406\uFF0Coptions \u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),"\uFF0C\u53E6\u5916\u8FD8\u652F\u6301\u4E86 ",(0,i.jsx)(n.code,{children:"include"})," \u548C ",(0,i.jsx)(n.code,{children:"exclude"})," \u4E24\u4E2A\u914D\u7F6E\u9879\uFF0C\u7528\u4E8E\u5339\u914D\u9700\u8981\u5904\u7406\u7684 SVG \u6587\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F svgr \u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\u7684\u65B9\u5F0F\u5C06 SVG \u5F53\u505A\u7EC4\u4EF6\u4F7F\u7528\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5F00\u542F\u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u65B0\u5EFA\u4E00\u4E2A\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\uFF0C\u5E76\u5728 ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\uFF0C\u4FEE\u6539\u4F7F\u7528 SVG \u7684\u7C7B\u578B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u4E0D\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u914D\u7F6E\u4F7F\u7528 SVGR \u65F6 SVG \u7684\u5BFC\u51FA\u5F62\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6B64\u9009\u9879\u8BBE\u7F6E\u4E3A 'named' \u65F6\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u8BED\u6CD5\u5BFC\u5165\u7EC4\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u547D\u540D\u5BFC\u51FA\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"ReactComponent"}),"\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"})," \u8FDB\u884C\u81EA\u5B9A\u4E49\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6839\u636E ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," \u548C ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"})," \u81EA\u52A8\u6DFB\u52A0\u4EA7\u7269\u91CC js \u6587\u4EF6\u548C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u7684\u540E\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u95ED\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".js"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.ts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F\u540E\uFF0C\u5F53 type \u4E3A ",(0,i.jsx)(n.code,{children:"module"})," \u65F6\uFF0Cnode \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u4F5C\u4E3A esm \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA cjs \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.cts"}),";\n\u53CD\u4E4B\uFF0C\u5982\u679C\u7F3A\u5C11 type \u5B57\u6BB5\u6216\u8005 type \u4E3A ",(0,i.jsx)(n.code,{children:"commonjs"})," \u65F6\uFF0C node \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u6587\u4EF6\u4F5C\u4E3A cjs \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA esm \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".mjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.mts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728 bundleless \u6A21\u5F0F\u4E0B\u4F7F\u7528\u65F6\uFF0C\u6211\u4EEC\u4F1A\u6709\u4E00\u6B65\u989D\u5916\u7684\u64CD\u4F5C\uFF0C\u90A3\u5C31\u662F\u5904\u7406\u6BCF\u4E2A\u6587\u4EF6\u91CC\u7684 import/export \u8BED\u53E5\u3002\u6211\u4EEC\u4F1A\u7ED9\u76F8\u5BF9\u8DEF\u5F84\u52A0\u4E0A js \u6587\u4EF6\u540E\u7F00\uFF0C\u53EF\u80FD\u662F ",(0,i.jsx)(n.code,{children:".mjs"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u8FD9\u53D6\u51B3\u4E8E\u4F60\u7684\u5305\u914D\u7F6E\uFF0C\u6B64\u884C\u4E3A\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"\u5173\u95ED\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6CE8\u610F ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," \u89C4\u5219\u4F1A\u7834\u574F\u6B64\u884C\u4E3A\uFF0C\u4F60\u9700\u8981\u7981\u7528\u6B64\u89C4\u5219\n\u5982\u679C\u4F60\u9700\u8981\u5728 bundleless \u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u8BF7\u8865\u9F50 ",(0,i.jsx)(n.code,{children:"index"}),"\uFF0C\u4F8B\u5982 utils \u662F\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C \u4F60\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u6539\u5199\u4E3A ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u81EA\u52A8\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'}),"\uFF0C\u4E0D\u4F1A\u5C06\u5176\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4EA7\u7269\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6211\u4EEC\u5E0C\u671B\u5173\u95ED\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406\u884C\u4E3A\u65F6\u5019\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5B9E\u73B0\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u6837\u5BF9\u4E8E ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u9762\u7684\u4F9D\u8D56\u90FD\u4F1A\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u53EA\u60F3\u8981\u5173\u95ED\u5176\u4E2D\u67D0\u4E2A\u4E0B\u9762\u7684\u4F9D\u8D56\u5904\u7406\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," \u7684\u5BF9\u8C61\u5F62\u5F0F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS , CSS \u548C DTS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\u4F60\u60F3\u4E3A JS \u548C CSS \u6587\u4EF6\u6DFB\u52A0\u7248\u6743\u4FE1\u606F:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6784\u5EFA\u7C7B\u578B\uFF0C",(0,i.jsx)(n.code,{children:"bundle"})," \u4F1A\u6253\u5305\u4F60\u7684\u4EE3\u7801\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u53EA\u505A\u4EE3\u7801\u7684\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5C06\u6587\u4EF6\u6216\u76EE\u5F55\u62F7\u8D1D\u5230\u6307\u5B9A\u4F4D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './src/assets', to: '' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": \u6307\u5B9A\u5E76\u884C\u6267\u884C\u591A\u5C11\u4E2A\u590D\u5236\u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": \u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})}),"\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\uFF0C\u6CE8\u5165\u5230\u4EE3\u7801\u4E2D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u7531\u4E8E ",(0,i.jsx)(n.code,{children:"define"})," \u529F\u80FD\u662F\u7531\u5168\u5C40\u6587\u672C\u66FF\u6362\u5B9E\u73B0\u7684\uFF0C\u6240\u4EE5\u9700\u8981\u4FDD\u8BC1\u5168\u5C40\u53D8\u91CF\u503C\u4E3A\u5B57\u7B26\u4E32\uFF0C\u66F4\u4E3A\u5B89\u5168\u7684\u505A\u6CD5\u662F\u5C06\u6BCF\u4E2A\u5168\u5C40\u53D8\u91CF\u7684\u503C\u8F6C\u5316\u4E3A\u5B57\u7B26\u4E32\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6846\u67B6\u5185\u90E8\u4F1A\u81EA\u52A8\u8FDB\u884C JSON \u5E8F\u5217\u5316\u5904\u7406\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u624B\u52A8\u6267\u884C\u5E8F\u5217\u5316\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u9700\u8981\u81EA\u52A8\u5E8F\u5217\u5316\uFF0C\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," \u5B9A\u4E49 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," \u6765\u5B9E\u73B0\u3002\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0D\u8FC7\u8981\u6CE8\u610F\uFF1A\u5982\u679C\u9879\u76EE\u662F\u4E00\u4E2A TypeScript \u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u53EF\u80FD\u9700\u8981\u5728\u9879\u76EE\u6E90\u4EE3\u7801\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(n.code,{children:".d.ts"})," \u6587\u4EF6\u91CC\u589E\u52A0\u4EE5\u4E0B\u5185\u5BB9\uFF1A"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"d.ts"})," \u6587\u4EF6\uFF0C\u5219\u53EF\u4EE5\u624B\u52A8\u521B\u5EFA\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FDB\u884C\u73AF\u5883\u53D8\u91CF\u66FF\u6362\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u4E0A\u9762\u7684\u914D\u7F6E\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u5C06\u4E0B\u9762\u8FD9\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u524D\u4EE3\u7801\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"})," \u7684\u65F6\u5019\uFF0C\u8F6C\u6362\u4E3A\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u540E\u4EE3\u7801\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u4E3A\u4E86\u9632\u6B62\u5168\u5C40\u66FF\u6362\u66FF\u6362\u8FC7\u5EA6\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u65F6\u9075\u5FAA\u4EE5\u4E0B\u4E24\u4E2A\u539F\u5219\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5168\u5C40\u5E38\u91CF\u4F7F\u7528\u5927\u5199"}),"\n",(0,i.jsx)(n.li,{children:"\u81EA\u5B9A\u4E49\u5168\u5C40\u5E38\u91CF\u524D\u7F00\u540E\u7F00\uFF0C\u786E\u4FDD\u72EC\u4E00\u65E0\u4E8C"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u7684\u76F8\u5173\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4F1A\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u63A7\u5236\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\uFF0C\u662F\u5426\u5141\u8BB8\u6784\u5EFA\u6210\u529F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\u4F1A\u5BFC\u81F4\u6784\u5EFA\u5931\u8D25"}),"\u3002\u5C06 ",(0,i.jsx)(n.code,{children:"abortOnError"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u540E\uFF0C\u5373\u4F7F\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u7C7B\u578B\u95EE\u9898\uFF0C\u6784\u5EFA\u4F9D\u7136\u4F1A\u6210\u529F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5F53\u5173\u95ED\u8BE5\u914D\u7F6E\u540E\uFF0C\u65E0\u6CD5\u4FDD\u8BC1\u7C7B\u578B\u6587\u4EF6\u80FD\u6B63\u5E38\u751F\u6210\uFF0C\u4E14\u4E0D\u4FDD\u8BC1\u5185\u5BB9\u6B63\u786E\u3002\u5728 ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"})," \u65F6\uFF0C\u5373\u6253\u5305\u6A21\u5F0F\u4E0B\uFF0C\u7C7B\u578B\u6587\u4EF6\u4E00\u5B9A\u4E0D\u4F1A\u751F\u6210\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7C7B\u578B\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6BD4\u5982\u8F93\u51FA\u5230 ",(0,i.jsx)(n.code,{children:"outDir"})," \u4E0B\u9762\u7684 ",(0,i.jsx)(n.code,{children:"types"})," \u76EE\u5F55\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F tsc '--build' \u9009\u9879\u3002\u5F53\u4F7F\u7528 project reference \u65F6\uFF0C\n\u53EF\u4EE5\u4F7F\u7528 '--build' \u9009\u9879\u4EE5\u5B9E\u73B0\u9879\u76EE\u4E4B\u95F4\u7684\u534F\u540C\u5DE5\u4F5C\u4EE5\u52A0\u5FEB\u6784\u5EFA\u901F\u5EA6\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u9009\u9879\u8981\u6C42\u7248\u672C > 2.43.0\uFF0C\n\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 2.42.0 \u7248\u672C\u66FE\u8BD5\u9A8C\u6027\u5730\u5F00\u542F\u6B64\u9009\u9879\uFF0C\u4F46\u5176\u5E26\u6765\u7684\u8BB8\u591A\u95EE\u9898\u4F7F\u6211\u4EEC\u4E0D\u5F97\u4E0D\u52A8\u6001\u5F00\u542F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0C\u4E3A\u4E86\u6EE1\u8DB3\u6784\u5EFA\u9700\u6C42\uFF0C\u4F60\u5FC5\u987B\u663E\u5F0F\u5730\u5728 tsconfig.json \u91CC\u8BBE\u7F6E 'declarationDir' \u6216\u8005 'outDir'\uFF0C\n\u5982\u679C\u4F60\u7528\u7684\u4E0D\u662F TS >= 5.0 \u7248\u672C\uFF0C\u4F60\u8FD8\u9700\u8981\u663E\u5F0F\u5730\u8BBE\u7F6E 'declaration' \u548C 'emitDeclarationOnly'\u3002\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u662F\u5426\u5728\u6784\u5EFA\u65F6\u53EA\u751F\u6210\u7C7B\u578B\u6587\u4EF6\uFF0C\u4E0D\u751F\u6210 JavaScript \u4EA7\u7269\u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u65F6\uFF0C\u4E0D\u4F1A\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\uFF0C\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u65F6\uFF0C\u4F1A\u6839\u636E ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"})," \u6765\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6253\u5305\u4E09\u65B9\u7C7B\u578B\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u6784\u5EFA\u5DE5\u5177\u8FD8\u672A\u5BF9 export \u8FDB\u884C\u5206\u6790\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u7684\u4EFB\u4F55\u4E00\u4E2A\u4E09\u65B9\u5305\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u65F6\uFF0C\u90FD\u53EF\u80FD\u4F1A\u4E2D\u65AD\u5F53\u524D\u7684\u6784\u5EFA\u6D41\u7A0B\uFF0C\u8FD9\u4F1A\u5BFC\u81F4\u6784\u5EFA\u6D41\u7A0B\u4E0D\u53EF\u63A7\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u8FD9\u4E2A\u914D\u7F6E\u6765\u907F\u514D\u8BE5\u95EE\u9898\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u5E9F\u5F03"}),"\uFF0C\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," \u914D\u7F6E\u66FF\u4EE3\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u7528\u4E8E\u751F\u6210\u7C7B\u578B\u6587\u4EF6\u7684 tsconfig \u6587\u4EF6\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539\u5E95\u5C42\u7684 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u914D\u7F6E"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6211\u4EEC\u9700\u8981\u4FEE\u6539\u751F\u6210\u6587\u4EF6\u7684\u540E\u7F00\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6CE8\u518C\u4E00\u4E2A esbuild \u63D2\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u5728\u539F\u672C esbuild \u6784\u5EFA\u7684\u57FA\u7840\u4E0A\u505A\u4E86\u8BB8\u591A\u6269\u5C55\uFF0C\u56E0\u6B64\u4F7F\u7528\u6B64\u914D\u7F6E\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F18\u5148\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u914D\u7F6E\uFF0C\u4F8B\u5982 esbuild \u5E76\u4E0D\u652F\u6301 ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\uFF0C\u4F46\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 SWC \u652F\u6301\u4E86\u6B64\u573A\u666F\uFF0C\u6B64\u65F6\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"esbuildOptions"})," \u8BBE\u7F6E",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\u4F1A\u62A5\u9519\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u76EE\u524D\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"enhanced-resolve"})," \u66FF\u4EE3\u4E86 esbuild \u7684 resolve \u89E3\u6790\u7B97\u6CD5\uFF0C\u6240\u4EE5\u4FEE\u6539 esbuild resolve \u76F8\u5173\u914D\u7F6E\u65E0\u6548\uFF0C\u8BA1\u5212\u5728\u672A\u6765\u4F1A\u5207\u6362\u56DE\u6765\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u8F93\u51FA\u7684 JS \u4EE3\u7801\u53EF\u80FD\u4F1A\u4F9D\u8D56\u4E00\u4E9B\u8F85\u52A9\u51FD\u6570\u6765\u652F\u6301\u76EE\u6807\u73AF\u5883\u6216\u8005\u8F93\u51FA\u683C\u5F0F\uFF0C\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u4F1A\u88AB\u5185\u8054\u5728\u9700\u8981\u5B83\u7684\u6587\u4EF6\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\uFF0C\u5C06\u5185\u8054\u7684\u8F85\u52A9\u51FD\u6570\u8F6C\u6362\u4E3A\u4ECE\u5916\u90E8\u6A21\u5757 ",(0,i.jsx)(n.code,{children:"@swc/helpers"})," \u5BFC\u5165\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4F7F\u7528\u8BE5\u914D\u7F6E\u524D\u540E\u7684\u4EA7\u7269\u53D8\u5316\u6BD4\u8F83\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u524D\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u8F85\u52A9\u51FD\u6570\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// \u8F85\u52A9\u51FD\u6570\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u4ECE @swc/helpers \u5BFC\u5165\u7684\u8F85\u52A9\u51FD\u6570\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u5728\u6253\u5305\u65F6\u6392\u9664\u4E00\u4E9B\u5916\u90E8\u4F9D\u8D56\uFF0C\u907F\u514D\u5C06\u8FD9\u4E9B\u4F9D\u8D56\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Externals = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // \u907F\u514D\u6253\u5305 React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u540C ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," \u914D\u7F6E\uFF0C\u7528\u4E8E\u5728\u8F93\u51FA\u6587\u4EF6\u672B\u5C3E\u6DFB\u52A0\u6CE8\u91CA\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u8BBE\u7F6E JavaScript \u4EA7\u7269\u8F93\u51FA\u7684\u683C\u5F0F\uFF0C\u5176\u4E2D ",(0,i.jsx)(n.code,{children:"iife"})," \u548C ",(0,i.jsx)(n.code,{children:"umd"})," \u53EA\u5728 ",(0,i.jsx)(n.code,{children:"buildType"})," \u4E3A ",(0,i.jsx)(n.code,{children:"bundle"})," \u65F6\u751F\u6548\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'esm \u4EE3\u8868 "ECMAScript \u6A21\u5757"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 import \u548C export \u8BED\u6CD5\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'cjs \u4EE3\u8868 "CommonJS"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 exports\u3001require \u548C module \u8BED\u6CD5\uFF0C\u901A\u5E38\u4E3A Node.js \u73AF\u5883\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'iife \u4EE3\u8868 "\u7ACB\u5373\u8C03\u7528\u51FD\u6570\u8868\u8FBE\u5F0F"\uFF0C\u5B83\u5C06\u4EE3\u7801\u5305\u88F9\u5728\u51FD\u6570\u8868\u8FBE\u5F0F\u4E2D\uFF0C\u786E\u4FDD\u4EE3\u7801\u4E2D\u7684\u4EFB\u4F55\u53D8\u91CF\u4E0D\u4F1A\u610F\u5916\u5730\u4E0E\u5168\u5C40\u8303\u56F4\u4E2D\u7684\u53D8\u91CF\u51B2\u7A81\uFF0C\u901A\u5E38\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u8FD0\u884C\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'umd \u4EE3\u8868 "Universal Module Definition"\uFF0C\u7528\u4E8E\u5728\u4E0D\u540C\u73AF\u5883\uFF08\u6D4F\u89C8\u5668\u3001Node.js \u7B49\uFF09\u4E2D\u8FD0\u884C\u3002umd \u683C\u5F0F\u7684\u6A21\u5757\u53EF\u4EE5\u5728\u591A\u79CD\u73AF\u5883\u4E0B\u4F7F\u7528\uFF0C\u65E2\u53EF\u4EE5\u4F5C\u4E3A\u5168\u5C40\u53D8\u91CF\u8BBF\u95EE\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7\u6A21\u5757\u52A0\u8F7D\u5668\uFF08\u5982 RequireJS\uFF09\u8FDB\u884C\u6A21\u5757\u5316\u52A0\u8F7D\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5EFA\u751F\u547D\u5468\u671F\u94A9\u5B50,\u5141\u8BB8\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u7279\u5B9A\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u5728 apply \u65B9\u6CD5\u91CC\u62FF\u5230 compiler \u5B9E\u4F8B\uFF0C\u4FEE\u6539\u5176\u5C5E\u6027\uFF0C\u4EE5\u53CA\u5728\u4E0D\u540C\u9636\u6BB5\u6267\u884C\u81EA\u5B9A\u4E49\u903B\u8F91\uFF0C\u5BF9\u4E8E Hook \u7684\u8BE6\u7EC6\u4ECB\u7ECD\uFF0C\n\u53C2\u8003",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-hook-%E4%BB%8B%E5%85%A5%E6%9E%84%E5%BB%BA%E6%B5%81%E7%A8%8B",children:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B"}),"\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u6570\u7EC4\u5F62\u5F0F\u53EF\u4EE5\u6307\u5B9A\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u6570\u7EC4\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u4EE5 ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u548C ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," \u4E3A\u5165\u53E3\u5206\u522B\u8FDB\u884C\u6784\u5EFA\u3002",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0D\u652F\u6301\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"input"})," \u4E3A\u76EE\u5F55\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u540C\u65F6\u5904\u7406 ",(0,i.jsx)(n.code,{children:"src/a"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u6570\u7EC4\u6A21\u5F0F\u8FD8\u652F\u6301\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"!"})," \u6765\u8FC7\u6EE4\u90E8\u5206\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0A\u9762\u7684\u914D\u7F6E\u5C06\u6253\u5305 ",(0,i.jsx)(n.code,{children:"src"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\uFF0C\u540C\u65F6\u4F1A\u8FC7\u6EE4\u4EE5 ",(0,i.jsx)(n.code,{children:"spec.ts"})," \u4E3A\u540E\u7F00\u7684\u6587\u4EF6\u3002\u8FD9\u5728\u6D4B\u8BD5\u6587\u4EF6\u4E0E\u6E90\u7801\u6587\u4EF6\u5728\u540C\u4E00\u4E2A\u6839\u76EE\u5F55\u4E0B\u7684\u60C5\u51B5\u4F1A\u5F88\u6709\u7528\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5728 bundle \u6A21\u5F0F\u4E0B\u9700\u8981\u4FEE\u6539\u4EA7\u7269\u7684\u8F93\u51FA\u6587\u4EF6\u540D\u79F0\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5BF9\u8C61\u5F62\u5F0F\u8FDB\u884C\u914D\u7F6E\u3002"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7684 Key \u662F\u4EA7\u7269\u7684\u6587\u4EF6\u540D\u79F0\uFF0CValue \u662F\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A JSX \u7684\u7F16\u8BD1\u65B9\u5F0F\uFF0C\u9ED8\u8BA4\u652F\u6301 React 17 \u53CA\u66F4\u9AD8\u7248\u672C\uFF0C\u81EA\u52A8\u6CE8\u5165 JSX \u8FD0\u884C\u65F6\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"automatic | transform | preserve"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u652F\u6301 React 16\uFF0C\u5219\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"transform"}),"\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u4E0D\u9700\u8981\u8F6C\u6362 JSX ,\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"preserve"}),", \u4F46\u6B64\u65F6\u8BF7\u4E0D\u8981",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-swc",children:"\u4F7F\u7528 swc"})," \u505A\u4EE3\u7801\u8F6C\u6362\u3002\n\u5173\u4E8E JSX Transform \u7684\u66F4\u591A\u8BF4\u660E\uFF0C\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u94FE\u63A5\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8FD9\u4E2A\u9009\u9879\u7528\u4E8E\u6784\u5EFA\u5206\u6790\uFF0C\u5F00\u542F\u8BE5\u9009\u9879\u540E\uFF0Cesbuild \u4F1A\u4EE5 JSON \u683C\u5F0F\u751F\u6210\u6709\u5173\u6784\u5EFA\u7684\u4E00\u4E9B\u5143\u6570\u636E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"metafile"})," \u751F\u6210\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C build \u6784\u5EFA\u540E\uFF0C\u4EA7\u7269\u76EE\u5F55\u4E0B\u4F1A\u751F\u6210 ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," \u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," \u548C ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," \u7B49\u5DE5\u5177\u8FDB\u884C\u53EF\u89C6\u5316\u5206\u6790\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528 esbuild \u6216\u8005 terser \u538B\u7F29\u4EE3\u7801\uFF0C\u4E5F\u53EF\u4EE5\u4F20\u5165 ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u8F93\u51FA\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u751F\u6210\u7528\u4E8E Node.js \u73AF\u5883\u4E0B\u7684\u4EE3\u7801\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6307\u5B9A\u4E3A ",(0,i.jsx)(n.code,{children:"browser"}),"\uFF0C\u4F1A\u751F\u6210\u7528\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u7684\u4EE3\u7801\u3002\n\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," \u6784\u5EFA\u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u5BF9\u5F15\u7528\u8DEF\u5F84\u8FDB\u884C\u91CD\u5B9A\u5411\uFF0C\u786E\u4FDD\u6307\u5411\u4E86\u6B63\u786E\u7684\u4EA7\u7269\uFF0C\u4F8B\u5982\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import './index.less'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import './index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from './close.svg'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import icon from '../asset/close.svg'"}),"\uFF08\u4F9D\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A\uFF09"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (\u5982\u679C\u751F\u6210\u4E86 utils.mjs\uFF0C\u89C6\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u573A\u666F\u4E0B\uFF0C\u4F60\u53EF\u80FD\u4E0D\u9700\u8981\u8FD9\u4E9B\u529F\u80FD\uFF0C\u90A3\u4E48\u53EF\u4EE5\u901A\u8FC7\u6B64\u914D\u7F6E\u5173\u95ED\u5B83\uFF0C\u5173\u95ED\u540E\uFF0C\u5176\u5F15\u7528\u8DEF\u5F84\u5C06\u4E0D\u4F1A\u53D1\u751F\u6539\u53D8\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // \u5173\u95ED\u5BF9\u522B\u540D\u8DEF\u5F84\u7684\u4FEE\u6539\n style: false, // \u5173\u95ED\u5BF9\u6837\u5F0F\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n asset: false, // \u5173\u95ED\u5BF9\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n autoExtension: false, // \u5173\u95ED\u5BF9 js \u6587\u4EF6\u540E\u7F00\u7684\u4FEE\u6539\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u81EA\u5B9A\u4E49\u6A21\u5757\u89E3\u6790\u9009\u9879"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"package.json \u4E2D\uFF0C\u5728\u89E3\u6790\u5305\u7684\u5165\u53E3\u70B9\u65F6\u5C1D\u8BD5\u7684\u5B57\u6BB5\u5217\u8868\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A\u53D6\u51B3\u4E8E",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u6211\u4EEC\u60F3\u8981\u5148\u52A0\u8F7D ",(0,i.jsx)(n.code,{children:"js:source"})," \u5B57\u6BB5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u6BD4 package.json \u4E2D exports \u5B57\u6BB5\u7684\u4F18\u5148\u7EA7\u4F4E\uFF0C\u5982\u679C\u4E00\u4E2A\u5165\u53E3\u70B9\u4ECE exports \u6210\u529F\u89E3\u6790\uFF0C",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u5C06\u88AB\u5FFD\u7565\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u652F\u6301\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E css \u6587\u4EF6\uFF0C\u8BF7\u4E0D\u8981\u4F7F\u7528\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u76EE\u524D Module \u4EC5\u652F\u6301 ['.less', '.css', '.sass', '.scss'] \u540E\u7F00\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["Node \u7684\u89E3\u6790\u7B97\u6CD5\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:".mjs"})," \u548C ",(0,i.jsx)(n.code,{children:"cjs"})," \u89C6\u4E3A\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u56E0\u6B64\u8FD9\u91CC\u9ED8\u8BA4\u4E5F\u4E0D\u4F1A\uFF0C\u4F46\u662F\u53EF\u4EE5\u901A\u8FC7\u66F4\u6539\u6B64\u914D\u7F6E\u6765\u5305\u542B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u6784\u5EFA cjs / esm \u4EA7\u7269\u65F6\u6CE8\u5165\u4E00\u4E9B\u57AB\u7247\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u53EA\u80FD\u5728 commonjs \u91CC\u4F7F\u7528\uFF0C\u5F00\u542F\u6B64\u9009\u9879\u540E\uFF0C\u5F53\u4EA7\u7269\u683C\u5F0F\u4E3A esm \u65F6\uFF0C\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u7F16\u8BD1\u4E3A ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u4EE3\u7801\u89C1 ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"shims"}),"\uFF0C\n\u9700\u8981\u6CE8\u610F\u7684\u662F esm shims \u53EA\u4F1A\u5728 ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," \u4E3A node \u65F6\u6CE8\u5165\uFF0C\u56E0\u4E3A\u7528\u5230\u4E86 url \u6A21\u5757\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u901A\u8FC7 package.json \u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u6765\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4E09\u65B9\u5305\u7684 package.json \u662F\u4E0D\u53EF\u9760\u7684\u3002\n\u4F8B\u5982\u6211\u4EEC\u5F15\u7528\u4E86\u4E00\u4E2A\u4E09\u65B9\u5305\u7684\u6837\u5F0F\u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F46\u662F\u8FD9\u4E2A\u4E09\u65B9\u5305\u7684 package.json \u91CC\u5E76\u6CA1\u6709\u5C06\u6837\u5F0F\u6587\u4EF6\u914D\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u91CC\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u540C\u65F6\u4F60\u53C8\u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," \u4E3A ",(0,i.jsx)(n.code,{children:"true"}),"\uFF0C\u5728\u63A7\u5236\u53F0\u53EF\u4EE5\u770B\u5230\u7C7B\u4F3C\u7684\u8B66\u544A\u4FE1\u606F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u65F6\u5019\u5C31\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u914D\u7F6E\u9879\uFF0C\u624B\u52A8\u914D\u7F6E\u6A21\u5757\u7684",(0,i.jsx)(n.code,{children:'"sideEffects"'}),"\uFF0C\u914D\u7F6E\u652F\u6301\u6B63\u5219\u548C\u51FD\u6570\u5F62\u5F0F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6DFB\u52A0\u6B64\u914D\u7F6E\u540E\uFF0C\u6253\u5305\u65F6\u5C06\u4E0D\u4F1A\u518D\u8BFB\u53D6 package.json \u91CC\u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6307\u5B9A\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55,\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"src"}),"\uFF0C\u7528\u4E8E\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6784\u5EFA\u65F6\u57FA\u4E8E\u6E90\u7801\u76EE\u5F55\u7ED3\u6784\u751F\u6210\u5BF9\u5E94\u7684\u4EA7\u7269\u76EE\u5F55\u3002\n\u7B49\u540C\u4E8E",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63A7\u5236 sourceMap \u5982\u4F55\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u5DF2\u5E9F\u5F03\uFF0C\u6B64\u914D\u7F6E\u4E0D\u4F1A\u4EA7\u751F\u4EFB\u4F55\u5F71\u54CD\u3002"})})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u6E90\u7801\u7684\u683C\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u5C06\u6E90\u7801\u4F5C\u4E3A EsModule \u8FDB\u884C\u5904\u7406\u3002\u5F53\u6E90\u7801\u4F7F\u7528\u7684\u662F CommonJS \u7684\u65F6\u5019\uFF0C\u9700\u8981\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"commonjs"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u5F00\u542F\u4EE3\u7801\u5206\u5272\u3002\n\u4EC5\u652F\u6301 ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," \u548C ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),"\uFF0C\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6837\u5F0F\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Less"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Less"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"4.1.3"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sass",children:["sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Sass \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Sass"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Sass"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"1.5.4"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u914D\u7F6E PostCSS \u7684\u9009\u9879\uFF0C\u4F20\u5165\u7684\u503C\u4F1A\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002\u6CE8\u610F ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u662F\u6D45\u62F7\u8D1D\uFF0C\u56E0\u6B64\u4F1A\u5B8C\u5168\u8986\u76D6\u5185\u7F6E\u7684 plugins \u6570\u7EC4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u8BF7\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // \u4EE5\u4E0B\u63D2\u4EF6\u9ED8\u8BA4\u542F\u7528\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // \u4EE5\u4E0B\u63D2\u4EF6\u4EC5\u5728 target \u4E3A `es5` \u65F6\u542F\u7528\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6253\u5305\u6A21\u5F0F\u4E0B\u662F\u5426\u5C06 CSS \u6837\u5F0F\u63D2\u5165\u5230 JavaScript \u4EE3\u7801\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5C06 ",(0,i.jsx)(n.code,{children:"inject"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u6765\u5F00\u542F\u6B64\u529F\u80FD\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230\u6E90\u7801\u4E2D\u5F15\u7528\u7684 CSS \u4EE3\u7801\u88AB\u5305\u542B\u5728\u4E86\u6253\u5305\u540E\u7684 JS \u4EA7\u7269\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u4F60\u5728\u6E90\u7801\u91CC\u5199\u4E86 ",(0,i.jsx)(n.code,{children:"import './index.scss'"}),"\uFF0C\u90A3\u4E48\u5728\u4EA7\u7269\u4E2D\u4F60\u4F1A\u770B\u5230\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"inject"})," \u540E\uFF0C\u4F60\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["CSS \u6587\u4EF6\u4E2D\u7684 ",(0,i.jsx)(n.code,{children:"@import"})," \u4E0D\u4F1A\u88AB\u5904\u7406\u3002\u5982\u679C\u4F60\u7684 CSS \u6587\u4EF6\u4E2D\u6709 ",(0,i.jsx)(n.code,{children:"@import"})," \uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5728 JS \u6587\u4EF6\u4E2D\u624B\u52A8\u5F15\u5165 CSS \u6587\u4EF6\uFF08less,scss \u6587\u4EF6\u4E0D\u9700\u8981\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u4F1A\u6709\u9884\u5904\u7406\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u9700\u8981\u8003\u8651 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u7684\u5F71\u54CD\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u7684\u6784\u5EFA\u5668\u4F1A\u8BA4\u4E3A CSS \u662F\u6709\u526F\u4F5C\u7528\u7684\uFF0C\u5982\u679C\u4F60\u7684\u9879\u76EE\u4E2D\u6216\u8005\u4E09\u65B9\u5305\u7684 package.json \u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u5B57\u6BB5\u5E76\u4E14\u6CA1\u6709\u5305\u542B\u6B64 CSS \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u5C06\u4F1A\u5F97\u5230\u4E00\u4E2A\u8B66\u544A\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"})," \u6765\u89E3\u51B3\u3002"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6839\u636E\u6587\u4EF6\u540D\u81EA\u52A8\u542F\u7528 CSS Modules\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : \u4E3A\u4EE5 ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," \u6587\u4EF6\u540D\u7ED3\u5C3E\u7684\u6837\u5F0F\u6587\u4EF6\u542F\u7528 CSS Modules\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : \u7981\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : \u4E3A\u5339\u914D\u6B63\u5219\u6761\u4EF6\u7684\u6240\u6709\u6587\u4EF6\u542F\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules \u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4E00\u4E2A\u5E38\u7528\u7684\u914D\u7F6E\u662F ",(0,i.jsx)(n.code,{children:"localsConvention"}),"\uFF0C\u5B83\u53EF\u4EE5\u6539\u53D8 CSS Modules \u7684\u7C7B\u540D\u751F\u6210\u89C4\u5219\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E\u4EE5\u4E0B\u6837\u5F0F\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," \u6765\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u4E4B\u524D\uFF0C\u4F60\u9700\u8981\u542F\u7528 Modern.js Module \u7684 Tailwind CSS \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BF7\u9605\u8BFB",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u7AE0\u8282\u6765\u4E86\u89E3\u5F00\u542F\u65B9\u5F0F\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u7C7B\u578B",children:["\u7C7B\u578B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u51FD\u6570\u8FD4\u56DE\u7684\u5BF9\u8C61\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u7684\u4F7F\u7528\u65B9\u5F0F\u548C Tailwind CSS \u4E00\u81F4: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"\u5FEB\u901F\u4F20\u9001\u95E8"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E\u9879\uFF0C\u90A3\u4E48 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u5C06\u4F1A\u88AB ",(0,i.jsx)(n.code,{children:"designSystem"})," \u7684\u503C\u6240\u8986\u76D6\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u914D\u7F6E\u7684\u4F7F\u7528\u65B9\u5F0F\u4E0E Tailwind CSS \u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," \u7528\u4E8E\u4E3A\u751F\u6210\u7684 JavaScript \u4EE3\u7801\u8BBE\u7F6E\u76EE\u6807\u73AF\u5883\u3002\u5B83\u8BA9 Modern.js Module \u5C06\u76EE\u6807\u73AF\u5883\u65E0\u6CD5\u8BC6\u522B\u7684 JavaScript \u8BED\u6CD5\u8F6C\u6362\u4E3A\u5728\u8FD9\u4E9B\u73AF\u5883\u4E2D\u53EF\u7528\u7684\u4F4E\u7248\u672C JavaScript \u8BED\u6CD5\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06\u4EE3\u7801\u7F16\u8BD1\u5230 ",(0,i.jsx)(n.code,{children:"es5"})," \u8BED\u6CD5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E0E babel-plugin-import \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E SWC \u5B9E\u73B0\uFF0C\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u53C2\u8003",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9",children:"\u300CImport \u63D2\u4EF6\u2014\u2014\u6CE8\u610F\u4E8B\u9879\u300D"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u6A21\u5757\u5316 ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," \u7684\u5BFC\u5165\uFF0C\u5220\u9664\u672A\u4F7F\u7528\u7684 lodash \u6A21\u5757\uFF0C\u4ECE\u800C\u51CF\u5C11 lodash \u4EE3\u7801\u4F53\u79EF\u3002\u8FD9\u9879\u4F18\u5316\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," \u548C ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," \u5B9E\u73B0\u3002\n\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0CModern.js Module \u4F1A\u81EA\u52A8\u5C06 lodash \u7684\u4EE3\u7801\u5F15\u7528\u6307\u5411\u5B50\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6BD4\u5982\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8F6C\u6362\u540E\u7684\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"TypeScript \u914D\u7F6E\u6587\u4EF6\u7684\u8DEF\u5F84\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"react"})," \u548C ",(0,i.jsx)(n.code,{children:"react-dom"})," \u4F1A\u88AB\u770B\u505A\u662F\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF0C\u4E0D\u4F1A\u88AB\u6253\u5305\u8FDB UMD \u4EA7\u7269\u4E2D\uFF0C\u800C\u662F\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.React"})," \u548C ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})," \u7684\u65B9\u5F0F\u8FDB\u884C\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6 UMD \u4EA7\u7269\u4F1A\u53BB\u6302\u8F7D\u5230 ",(0,i.jsx)(n.code,{children:"global.myLib"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9700\u8981\u9075\u5B88 UMD \u89C4\u8303\uFF0CUMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u4E0D\u80FD\u548C\u5168\u5C40\u53D8\u91CF\u540D\u51B2\u7A81\u3002"}),"\n",(0,i.jsxs)(n.li,{children:["\u6A21\u5757\u540D\u4F1A\u88AB\u8F6C\u6362\u4E3A\u9A7C\u5CF0\u547D\u540D\uFF0C\u5982 ",(0,i.jsx)(n.code,{children:"my-lib"})," \u4F1A\u88AB\u8F6C\u6362\u4E3A ",(0,i.jsx)(n.code,{children:"myLib"}),"\uFF0C\u53EF\u53C2\u8003",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsx)(n.p,{children:"\u540C\u65F6\u51FD\u6570\u5F62\u5F0F\u53EF\u4EE5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570\uFF0C\u4E3A\u5F53\u524D\u6253\u5305\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n});\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"sass",id:"sass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 1684.f3977b44.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1684"],{62584:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",strong:"strong",ol:"ol",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879\uFF0C\u5B83\u5305\u542B\u4E86\u6784\u5EFA\u7684\u6240\u6709\u914D\u7F6E\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728\u5F00\u59CB\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u524D\uFF0C\u8BF7\u5148\u9605\u8BFB\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u5176\u4F5C\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5BF9\u4E8E TypeScript \u9879\u76EE\uFF0C\u53EA\u9700\u8981\u5728 ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u4E2D\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"}),", Modern.js Module \u4F1A\u81EA\u52A8\u8BC6\u522B ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u91CC\u7684\u522B\u540D\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u989D\u5916\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"alias"})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: {\n '@common': './src/common',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4EE5\u4E0A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u5982\u679C\u5728\u4EE3\u7801\u4E2D\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"}),", \u5219\u4F1A\u6620\u5C04\u5230 ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," \u8DEF\u5F84\u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"alias"})," \u7684\u503C\u5B9A\u4E49\u4E3A\u51FD\u6570\u65F6\uFF0C\u53EF\u4EE5\u63A5\u53D7\u9884\u8BBE\u7684 alias \u5BF9\u8C61\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n alias['@common'] = './src/common';\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4E5F\u53EF\u4EE5\u5728\u51FD\u6570\u4E2D\u8FD4\u56DE\u4E00\u4E2A\u65B0\u5BF9\u8C61\u4F5C\u4E3A\u6700\u7EC8\u7ED3\u679C\uFF0C\u65B0\u5BF9\u8C61\u4F1A\u8986\u76D6\u9884\u8BBE\u7684 alias \u5BF9\u8C61\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n return {\n '@common': './src/common',\n };\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5305\u542B\u9759\u6001\u8D44\u6E90\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u6587\u4EF6\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53 asset.name \u4E3A string \u7C7B\u578B\u65F6\uFF0C\u4F1A\u81EA\u52A8\u5BF9 [name]\u3001[ext]\u3001[hash] \u8FDB\u884C\u66FF\u6362\uFF0C\u5206\u522B\u66FF\u6362\u4E3A\u6587\u4EF6\u540D\u3001\u62D3\u5C55\u540D\u3001\u6587\u4EF6 hash\u3002\n\u5982\u679C\u60F3\u8981\u66F4\u9AD8\u7684\u81EA\u7531\u5EA6\uFF0C\u53EF\u4EE5\u628A asset.name \u4F5C\u4E3A\u65B9\u6CD5\u4F7F\u7528\uFF0C\u8FD4\u56DE\u503C\u5373\u4E3A\u6587\u4EF6\u540D\u3002\u6B64\u65F6\uFF0C\u8BE5\u65B9\u6CD5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570 assetPath\uFF0C\u5BF9\u5E94\u8D44\u6E90\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u8BBE\u7F6E\u9759\u6001\u8D44\u6E90\u88AB\u81EA\u52A8\u5185\u8054\u4E3A base64 \u7684\u4F53\u79EF\u9608\u503C\u3002"}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u5728\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u9ED8\u8BA4\u4F1A\u5185\u8054\u4F53\u79EF\u5C0F\u4E8E 10KB \u7684\u56FE\u7247\u3001\u5B57\u4F53\u3001\u5A92\u4F53\u7B49\u8D44\u6E90\uFF0C\u5C06\u5B83\u4EEC\u901A\u8FC7 Base64 \u7F16\u7801\uFF0C\u5E76\u5185\u8054\u5230\u4EA7\u7269\u4E2D\uFF0C\u4E0D\u518D\u4F1A\u53D1\u9001\u72EC\u7ACB\u7684 HTTP \u8BF7\u6C42\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u4FEE\u6539 ",(0,i.jsx)(n.code,{children:"limit"})," \u53C2\u6570\u6765\u8C03\u6574\u8FD9\u4E2A\u9608\u503C\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06 ",(0,i.jsx)(n.code,{children:"limit"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"0"})," \u6765\u907F\u514D\u8D44\u6E90\u5185\u8054\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u8DEF\u5F84\uFF0C\u4F1A\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6253\u5305\u65F6\u7ED9\u672A\u5185\u8054\u8D44\u6E90\u7684 CDN \u524D\u7F00\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C\u6240\u6709\u9759\u6001\u8D44\u6E90\u90FD\u4F1A\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"https://xxx/"})," \u524D\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6253\u5305\u65F6\u5C06 SVG \u4F5C\u4E3A\u4E00\u4E2A React \u7EC4\u4EF6\u5904\u7406\uFF0Coptions \u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),"\uFF0C\u53E6\u5916\u8FD8\u652F\u6301\u4E86 ",(0,i.jsx)(n.code,{children:"include"})," \u548C ",(0,i.jsx)(n.code,{children:"exclude"})," \u4E24\u4E2A\u914D\u7F6E\u9879\uFF0C\u7528\u4E8E\u5339\u914D\u9700\u8981\u5904\u7406\u7684 SVG \u6587\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F svgr \u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\u7684\u65B9\u5F0F\u5C06 SVG \u5F53\u505A\u7EC4\u4EF6\u4F7F\u7528\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5F00\u542F\u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u65B0\u5EFA\u4E00\u4E2A\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\uFF0C\u5E76\u5728 ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\uFF0C\u4FEE\u6539\u4F7F\u7528 SVG \u7684\u7C7B\u578B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u4E0D\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u914D\u7F6E\u4F7F\u7528 SVGR \u65F6 SVG \u7684\u5BFC\u51FA\u5F62\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6B64\u9009\u9879\u8BBE\u7F6E\u4E3A 'named' \u65F6\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u8BED\u6CD5\u5BFC\u5165\u7EC4\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u547D\u540D\u5BFC\u51FA\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"ReactComponent"}),"\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"})," \u8FDB\u884C\u81EA\u5B9A\u4E49\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6839\u636E ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," \u548C ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"})," \u81EA\u52A8\u6DFB\u52A0\u4EA7\u7269\u91CC js \u6587\u4EF6\u548C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u7684\u540E\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u95ED\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".js"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.ts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F\u540E\uFF0C\u5F53 type \u4E3A ",(0,i.jsx)(n.code,{children:"module"})," \u65F6\uFF0Cnode \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u4F5C\u4E3A esm \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA cjs \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.cts"}),";\n\u53CD\u4E4B\uFF0C\u5982\u679C\u7F3A\u5C11 type \u5B57\u6BB5\u6216\u8005 type \u4E3A ",(0,i.jsx)(n.code,{children:"commonjs"})," \u65F6\uFF0C node \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u6587\u4EF6\u4F5C\u4E3A cjs \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA esm \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".mjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.mts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728 bundleless \u6A21\u5F0F\u4E0B\u4F7F\u7528\u65F6\uFF0C\u6211\u4EEC\u4F1A\u6709\u4E00\u6B65\u989D\u5916\u7684\u64CD\u4F5C\uFF0C\u90A3\u5C31\u662F\u5904\u7406\u6BCF\u4E2A\u6587\u4EF6\u91CC\u7684 import/export \u8BED\u53E5\u3002\u6211\u4EEC\u4F1A\u7ED9\u76F8\u5BF9\u8DEF\u5F84\u52A0\u4E0A js \u6587\u4EF6\u540E\u7F00\uFF0C\u53EF\u80FD\u662F ",(0,i.jsx)(n.code,{children:".mjs"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u8FD9\u53D6\u51B3\u4E8E\u4F60\u7684\u5305\u914D\u7F6E\uFF0C\u6B64\u884C\u4E3A\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"\u5173\u95ED\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6CE8\u610F ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," \u89C4\u5219\u4F1A\u7834\u574F\u6B64\u884C\u4E3A\uFF0C\u4F60\u9700\u8981\u7981\u7528\u6B64\u89C4\u5219\n\u5982\u679C\u4F60\u9700\u8981\u5728 bundleless \u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u8BF7\u8865\u9F50 ",(0,i.jsx)(n.code,{children:"index"}),"\uFF0C\u4F8B\u5982 utils \u662F\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C \u4F60\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u6539\u5199\u4E3A ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u81EA\u52A8\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'}),"\uFF0C\u4E0D\u4F1A\u5C06\u5176\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4EA7\u7269\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6211\u4EEC\u5E0C\u671B\u5173\u95ED\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406\u884C\u4E3A\u65F6\u5019\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5B9E\u73B0\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u6837\u5BF9\u4E8E ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u9762\u7684\u4F9D\u8D56\u90FD\u4F1A\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u53EA\u60F3\u8981\u5173\u95ED\u5176\u4E2D\u67D0\u4E2A\u4E0B\u9762\u7684\u4F9D\u8D56\u5904\u7406\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," \u7684\u5BF9\u8C61\u5F62\u5F0F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS , CSS \u548C DTS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\u4F60\u60F3\u4E3A JS \u548C CSS \u6587\u4EF6\u6DFB\u52A0\u7248\u6743\u4FE1\u606F:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6784\u5EFA\u7C7B\u578B\uFF0C",(0,i.jsx)(n.code,{children:"bundle"})," \u4F1A\u6253\u5305\u4F60\u7684\u4EE3\u7801\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u53EA\u505A\u4EE3\u7801\u7684\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5C06\u6587\u4EF6\u6216\u76EE\u5F55\u62F7\u8D1D\u5230\u6307\u5B9A\u4F4D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './src/assets', to: '' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": \u6307\u5B9A\u5E76\u884C\u6267\u884C\u591A\u5C11\u4E2A\u590D\u5236\u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": \u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})}),"\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\uFF0C\u6CE8\u5165\u5230\u4EE3\u7801\u4E2D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u7531\u4E8E ",(0,i.jsx)(n.code,{children:"define"})," \u529F\u80FD\u662F\u7531\u5168\u5C40\u6587\u672C\u66FF\u6362\u5B9E\u73B0\u7684\uFF0C\u6240\u4EE5\u9700\u8981\u4FDD\u8BC1\u5168\u5C40\u53D8\u91CF\u503C\u4E3A\u5B57\u7B26\u4E32\uFF0C\u66F4\u4E3A\u5B89\u5168\u7684\u505A\u6CD5\u662F\u5C06\u6BCF\u4E2A\u5168\u5C40\u53D8\u91CF\u7684\u503C\u8F6C\u5316\u4E3A\u5B57\u7B26\u4E32\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6846\u67B6\u5185\u90E8\u4F1A\u81EA\u52A8\u8FDB\u884C JSON \u5E8F\u5217\u5316\u5904\u7406\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u624B\u52A8\u6267\u884C\u5E8F\u5217\u5316\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u9700\u8981\u81EA\u52A8\u5E8F\u5217\u5316\uFF0C\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," \u5B9A\u4E49 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," \u6765\u5B9E\u73B0\u3002\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0D\u8FC7\u8981\u6CE8\u610F\uFF1A\u5982\u679C\u9879\u76EE\u662F\u4E00\u4E2A TypeScript \u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u53EF\u80FD\u9700\u8981\u5728\u9879\u76EE\u6E90\u4EE3\u7801\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(n.code,{children:".d.ts"})," \u6587\u4EF6\u91CC\u589E\u52A0\u4EE5\u4E0B\u5185\u5BB9\uFF1A"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"d.ts"})," \u6587\u4EF6\uFF0C\u5219\u53EF\u4EE5\u624B\u52A8\u521B\u5EFA\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FDB\u884C\u73AF\u5883\u53D8\u91CF\u66FF\u6362\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u4E0A\u9762\u7684\u914D\u7F6E\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u5C06\u4E0B\u9762\u8FD9\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u524D\u4EE3\u7801\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"})," \u7684\u65F6\u5019\uFF0C\u8F6C\u6362\u4E3A\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u540E\u4EE3\u7801\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u4E3A\u4E86\u9632\u6B62\u5168\u5C40\u66FF\u6362\u66FF\u6362\u8FC7\u5EA6\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u65F6\u9075\u5FAA\u4EE5\u4E0B\u4E24\u4E2A\u539F\u5219\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5168\u5C40\u5E38\u91CF\u4F7F\u7528\u5927\u5199"}),"\n",(0,i.jsx)(n.li,{children:"\u81EA\u5B9A\u4E49\u5168\u5C40\u5E38\u91CF\u524D\u7F00\u540E\u7F00\uFF0C\u786E\u4FDD\u72EC\u4E00\u65E0\u4E8C"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u7684\u76F8\u5173\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4F1A\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u63A7\u5236\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\uFF0C\u662F\u5426\u5141\u8BB8\u6784\u5EFA\u6210\u529F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\u4F1A\u5BFC\u81F4\u6784\u5EFA\u5931\u8D25"}),"\u3002\u5C06 ",(0,i.jsx)(n.code,{children:"abortOnError"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u540E\uFF0C\u5373\u4F7F\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u7C7B\u578B\u95EE\u9898\uFF0C\u6784\u5EFA\u4F9D\u7136\u4F1A\u6210\u529F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5F53\u5173\u95ED\u8BE5\u914D\u7F6E\u540E\uFF0C\u65E0\u6CD5\u4FDD\u8BC1\u7C7B\u578B\u6587\u4EF6\u80FD\u6B63\u5E38\u751F\u6210\uFF0C\u4E14\u4E0D\u4FDD\u8BC1\u5185\u5BB9\u6B63\u786E\u3002\u5728 ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"})," \u65F6\uFF0C\u5373\u6253\u5305\u6A21\u5F0F\u4E0B\uFF0C\u7C7B\u578B\u6587\u4EF6\u4E00\u5B9A\u4E0D\u4F1A\u751F\u6210\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7C7B\u578B\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6BD4\u5982\u8F93\u51FA\u5230 ",(0,i.jsx)(n.code,{children:"outDir"})," \u4E0B\u9762\u7684 ",(0,i.jsx)(n.code,{children:"types"})," \u76EE\u5F55\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F tsc '--build' \u9009\u9879\u3002\u5F53\u4F7F\u7528 project reference \u65F6\uFF0C\n\u53EF\u4EE5\u4F7F\u7528 '--build' \u9009\u9879\u4EE5\u5B9E\u73B0\u9879\u76EE\u4E4B\u95F4\u7684\u534F\u540C\u5DE5\u4F5C\u4EE5\u52A0\u5FEB\u6784\u5EFA\u901F\u5EA6\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u9009\u9879\u8981\u6C42\u7248\u672C > 2.43.0\uFF0C\n\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 2.42.0 \u7248\u672C\u66FE\u8BD5\u9A8C\u6027\u5730\u5F00\u542F\u6B64\u9009\u9879\uFF0C\u4F46\u5176\u5E26\u6765\u7684\u8BB8\u591A\u95EE\u9898\u4F7F\u6211\u4EEC\u4E0D\u5F97\u4E0D\u52A8\u6001\u5F00\u542F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0C\u4E3A\u4E86\u6EE1\u8DB3\u6784\u5EFA\u9700\u6C42\uFF0C\u4F60\u5FC5\u987B\u663E\u5F0F\u5730\u5728 tsconfig.json \u91CC\u8BBE\u7F6E 'declarationDir' \u6216\u8005 'outDir'\uFF0C\n\u5982\u679C\u4F60\u7528\u7684\u4E0D\u662F TS >= 5.0 \u7248\u672C\uFF0C\u4F60\u8FD8\u9700\u8981\u663E\u5F0F\u5730\u8BBE\u7F6E 'declaration' \u548C 'emitDeclarationOnly'\u3002\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u662F\u5426\u5728\u6784\u5EFA\u65F6\u53EA\u751F\u6210\u7C7B\u578B\u6587\u4EF6\uFF0C\u4E0D\u751F\u6210 JavaScript \u4EA7\u7269\u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u65F6\uFF0C\u4E0D\u4F1A\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\uFF0C\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u65F6\uFF0C\u4F1A\u6839\u636E ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"})," \u6765\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6253\u5305\u4E09\u65B9\u7C7B\u578B\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u6784\u5EFA\u5DE5\u5177\u8FD8\u672A\u5BF9 export \u8FDB\u884C\u5206\u6790\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u7684\u4EFB\u4F55\u4E00\u4E2A\u4E09\u65B9\u5305\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u65F6\uFF0C\u90FD\u53EF\u80FD\u4F1A\u4E2D\u65AD\u5F53\u524D\u7684\u6784\u5EFA\u6D41\u7A0B\uFF0C\u8FD9\u4F1A\u5BFC\u81F4\u6784\u5EFA\u6D41\u7A0B\u4E0D\u53EF\u63A7\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u8FD9\u4E2A\u914D\u7F6E\u6765\u907F\u514D\u8BE5\u95EE\u9898\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u5E9F\u5F03"}),"\uFF0C\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," \u914D\u7F6E\u66FF\u4EE3\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u7528\u4E8E\u751F\u6210\u7C7B\u578B\u6587\u4EF6\u7684 tsconfig \u6587\u4EF6\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539\u5E95\u5C42\u7684 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u914D\u7F6E"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6211\u4EEC\u9700\u8981\u4FEE\u6539\u751F\u6210\u6587\u4EF6\u7684\u540E\u7F00\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6CE8\u518C\u4E00\u4E2A esbuild \u63D2\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u5728\u539F\u672C esbuild \u6784\u5EFA\u7684\u57FA\u7840\u4E0A\u505A\u4E86\u8BB8\u591A\u6269\u5C55\uFF0C\u56E0\u6B64\u4F7F\u7528\u6B64\u914D\u7F6E\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F18\u5148\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u914D\u7F6E\uFF0C\u4F8B\u5982 esbuild \u5E76\u4E0D\u652F\u6301 ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\uFF0C\u4F46\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 SWC \u652F\u6301\u4E86\u6B64\u573A\u666F\uFF0C\u6B64\u65F6\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"esbuildOptions"})," \u8BBE\u7F6E",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\u4F1A\u62A5\u9519\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u76EE\u524D\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"enhanced-resolve"})," \u66FF\u4EE3\u4E86 esbuild \u7684 resolve \u89E3\u6790\u7B97\u6CD5\uFF0C\u6240\u4EE5\u4FEE\u6539 esbuild resolve \u76F8\u5173\u914D\u7F6E\u65E0\u6548\uFF0C\u8BA1\u5212\u5728\u672A\u6765\u4F1A\u5207\u6362\u56DE\u6765\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u8F93\u51FA\u7684 JS \u4EE3\u7801\u53EF\u80FD\u4F1A\u4F9D\u8D56\u4E00\u4E9B\u8F85\u52A9\u51FD\u6570\u6765\u652F\u6301\u76EE\u6807\u73AF\u5883\u6216\u8005\u8F93\u51FA\u683C\u5F0F\uFF0C\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u4F1A\u88AB\u5185\u8054\u5728\u9700\u8981\u5B83\u7684\u6587\u4EF6\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\uFF0C\u5C06\u5185\u8054\u7684\u8F85\u52A9\u51FD\u6570\u8F6C\u6362\u4E3A\u4ECE\u5916\u90E8\u6A21\u5757 ",(0,i.jsx)(n.code,{children:"@swc/helpers"})," \u5BFC\u5165\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4F7F\u7528\u8BE5\u914D\u7F6E\u524D\u540E\u7684\u4EA7\u7269\u53D8\u5316\u6BD4\u8F83\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u524D\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u8F85\u52A9\u51FD\u6570\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// \u8F85\u52A9\u51FD\u6570\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u4ECE @swc/helpers \u5BFC\u5165\u7684\u8F85\u52A9\u51FD\u6570\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u5728\u6253\u5305\u65F6\u6392\u9664\u4E00\u4E9B\u5916\u90E8\u4F9D\u8D56\uFF0C\u907F\u514D\u5C06\u8FD9\u4E9B\u4F9D\u8D56\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Externals = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // \u907F\u514D\u6253\u5305 React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u540C ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," \u914D\u7F6E\uFF0C\u7528\u4E8E\u5728\u8F93\u51FA\u6587\u4EF6\u672B\u5C3E\u6DFB\u52A0\u6CE8\u91CA\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u8BBE\u7F6E JavaScript \u4EA7\u7269\u8F93\u51FA\u7684\u683C\u5F0F\uFF0C\u5176\u4E2D ",(0,i.jsx)(n.code,{children:"iife"})," \u548C ",(0,i.jsx)(n.code,{children:"umd"})," \u53EA\u5728 ",(0,i.jsx)(n.code,{children:"buildType"})," \u4E3A ",(0,i.jsx)(n.code,{children:"bundle"})," \u65F6\u751F\u6548\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'esm \u4EE3\u8868 "ECMAScript \u6A21\u5757"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 import \u548C export \u8BED\u6CD5\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'cjs \u4EE3\u8868 "CommonJS"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 exports\u3001require \u548C module \u8BED\u6CD5\uFF0C\u901A\u5E38\u4E3A Node.js \u73AF\u5883\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'iife \u4EE3\u8868 "\u7ACB\u5373\u8C03\u7528\u51FD\u6570\u8868\u8FBE\u5F0F"\uFF0C\u5B83\u5C06\u4EE3\u7801\u5305\u88F9\u5728\u51FD\u6570\u8868\u8FBE\u5F0F\u4E2D\uFF0C\u786E\u4FDD\u4EE3\u7801\u4E2D\u7684\u4EFB\u4F55\u53D8\u91CF\u4E0D\u4F1A\u610F\u5916\u5730\u4E0E\u5168\u5C40\u8303\u56F4\u4E2D\u7684\u53D8\u91CF\u51B2\u7A81\uFF0C\u901A\u5E38\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u8FD0\u884C\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'umd \u4EE3\u8868 "Universal Module Definition"\uFF0C\u7528\u4E8E\u5728\u4E0D\u540C\u73AF\u5883\uFF08\u6D4F\u89C8\u5668\u3001Node.js \u7B49\uFF09\u4E2D\u8FD0\u884C\u3002umd \u683C\u5F0F\u7684\u6A21\u5757\u53EF\u4EE5\u5728\u591A\u79CD\u73AF\u5883\u4E0B\u4F7F\u7528\uFF0C\u65E2\u53EF\u4EE5\u4F5C\u4E3A\u5168\u5C40\u53D8\u91CF\u8BBF\u95EE\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7\u6A21\u5757\u52A0\u8F7D\u5668\uFF08\u5982 RequireJS\uFF09\u8FDB\u884C\u6A21\u5757\u5316\u52A0\u8F7D\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5EFA\u751F\u547D\u5468\u671F\u94A9\u5B50,\u5141\u8BB8\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u7279\u5B9A\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u5728 apply \u65B9\u6CD5\u91CC\u62FF\u5230 compiler \u5B9E\u4F8B\uFF0C\u4FEE\u6539\u5176\u5C5E\u6027\uFF0C\u4EE5\u53CA\u5728\u4E0D\u540C\u9636\u6BB5\u6267\u884C\u81EA\u5B9A\u4E49\u903B\u8F91\uFF0C\u5BF9\u4E8E Hook \u7684\u8BE6\u7EC6\u4ECB\u7ECD\uFF0C\n\u53C2\u8003",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-hook-%E4%BB%8B%E5%85%A5%E6%9E%84%E5%BB%BA%E6%B5%81%E7%A8%8B",children:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B"}),"\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u6570\u7EC4\u5F62\u5F0F\u53EF\u4EE5\u6307\u5B9A\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u6570\u7EC4\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u4EE5 ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u548C ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," \u4E3A\u5165\u53E3\u5206\u522B\u8FDB\u884C\u6784\u5EFA\u3002",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0D\u652F\u6301\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"input"})," \u4E3A\u76EE\u5F55\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u540C\u65F6\u5904\u7406 ",(0,i.jsx)(n.code,{children:"src/a"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u6570\u7EC4\u6A21\u5F0F\u8FD8\u652F\u6301\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"!"})," \u6765\u8FC7\u6EE4\u90E8\u5206\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0A\u9762\u7684\u914D\u7F6E\u5C06\u6253\u5305 ",(0,i.jsx)(n.code,{children:"src"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\uFF0C\u540C\u65F6\u4F1A\u8FC7\u6EE4\u4EE5 ",(0,i.jsx)(n.code,{children:"spec.ts"})," \u4E3A\u540E\u7F00\u7684\u6587\u4EF6\u3002\u8FD9\u5728\u6D4B\u8BD5\u6587\u4EF6\u4E0E\u6E90\u7801\u6587\u4EF6\u5728\u540C\u4E00\u4E2A\u6839\u76EE\u5F55\u4E0B\u7684\u60C5\u51B5\u4F1A\u5F88\u6709\u7528\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5728 bundle \u6A21\u5F0F\u4E0B\u9700\u8981\u4FEE\u6539\u4EA7\u7269\u7684\u8F93\u51FA\u6587\u4EF6\u540D\u79F0\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5BF9\u8C61\u5F62\u5F0F\u8FDB\u884C\u914D\u7F6E\u3002"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7684 Key \u662F\u4EA7\u7269\u7684\u6587\u4EF6\u540D\u79F0\uFF0CValue \u662F\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A JSX \u7684\u7F16\u8BD1\u65B9\u5F0F\uFF0C\u9ED8\u8BA4\u652F\u6301 React 17 \u53CA\u66F4\u9AD8\u7248\u672C\uFF0C\u81EA\u52A8\u6CE8\u5165 JSX \u8FD0\u884C\u65F6\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"automatic | transform | preserve"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u652F\u6301 React 16\uFF0C\u5219\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"transform"}),"\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u4E0D\u9700\u8981\u8F6C\u6362 JSX ,\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"preserve"}),", \u4F46\u6B64\u65F6\u8BF7\u4E0D\u8981",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-swc",children:"\u4F7F\u7528 swc"})," \u505A\u4EE3\u7801\u8F6C\u6362\u3002\n\u5173\u4E8E JSX Transform \u7684\u66F4\u591A\u8BF4\u660E\uFF0C\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u94FE\u63A5\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8FD9\u4E2A\u9009\u9879\u7528\u4E8E\u6784\u5EFA\u5206\u6790\uFF0C\u5F00\u542F\u8BE5\u9009\u9879\u540E\uFF0Cesbuild \u4F1A\u4EE5 JSON \u683C\u5F0F\u751F\u6210\u6709\u5173\u6784\u5EFA\u7684\u4E00\u4E9B\u5143\u6570\u636E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"metafile"})," \u751F\u6210\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C build \u6784\u5EFA\u540E\uFF0C\u4EA7\u7269\u76EE\u5F55\u4E0B\u4F1A\u751F\u6210 ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," \u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," \u548C ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," \u7B49\u5DE5\u5177\u8FDB\u884C\u53EF\u89C6\u5316\u5206\u6790\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528 esbuild \u6216\u8005 terser \u538B\u7F29\u4EE3\u7801\uFF0C\u4E5F\u53EF\u4EE5\u4F20\u5165 ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u8F93\u51FA\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u751F\u6210\u7528\u4E8E Node.js \u73AF\u5883\u4E0B\u7684\u4EE3\u7801\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6307\u5B9A\u4E3A ",(0,i.jsx)(n.code,{children:"browser"}),"\uFF0C\u4F1A\u751F\u6210\u7528\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u7684\u4EE3\u7801\u3002\n\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," \u6784\u5EFA\u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u5BF9\u5F15\u7528\u8DEF\u5F84\u8FDB\u884C\u91CD\u5B9A\u5411\uFF0C\u786E\u4FDD\u6307\u5411\u4E86\u6B63\u786E\u7684\u4EA7\u7269\uFF0C\u4F8B\u5982\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import './index.less'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import './index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from './close.svg'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import icon from '../asset/close.svg'"}),"\uFF08\u4F9D\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A\uFF09"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (\u5982\u679C\u751F\u6210\u4E86 utils.mjs\uFF0C\u89C6\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u573A\u666F\u4E0B\uFF0C\u4F60\u53EF\u80FD\u4E0D\u9700\u8981\u8FD9\u4E9B\u529F\u80FD\uFF0C\u90A3\u4E48\u53EF\u4EE5\u901A\u8FC7\u6B64\u914D\u7F6E\u5173\u95ED\u5B83\uFF0C\u5173\u95ED\u540E\uFF0C\u5176\u5F15\u7528\u8DEF\u5F84\u5C06\u4E0D\u4F1A\u53D1\u751F\u6539\u53D8\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // \u5173\u95ED\u5BF9\u522B\u540D\u8DEF\u5F84\u7684\u4FEE\u6539\n style: false, // \u5173\u95ED\u5BF9\u6837\u5F0F\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n asset: false, // \u5173\u95ED\u5BF9\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n autoExtension: false, // \u5173\u95ED\u5BF9 js \u6587\u4EF6\u540E\u7F00\u7684\u4FEE\u6539\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u81EA\u5B9A\u4E49\u6A21\u5757\u89E3\u6790\u9009\u9879"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"package.json \u4E2D\uFF0C\u5728\u89E3\u6790\u5305\u7684\u5165\u53E3\u70B9\u65F6\u5C1D\u8BD5\u7684\u5B57\u6BB5\u5217\u8868\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A\u53D6\u51B3\u4E8E",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u6211\u4EEC\u60F3\u8981\u5148\u52A0\u8F7D ",(0,i.jsx)(n.code,{children:"js:source"})," \u5B57\u6BB5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u6BD4 package.json \u4E2D exports \u5B57\u6BB5\u7684\u4F18\u5148\u7EA7\u4F4E\uFF0C\u5982\u679C\u4E00\u4E2A\u5165\u53E3\u70B9\u4ECE exports \u6210\u529F\u89E3\u6790\uFF0C",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u5C06\u88AB\u5FFD\u7565\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u652F\u6301\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E css \u6587\u4EF6\uFF0C\u8BF7\u4E0D\u8981\u4F7F\u7528\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u76EE\u524D Module \u4EC5\u652F\u6301 ['.less', '.css', '.sass', '.scss'] \u540E\u7F00\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["Node \u7684\u89E3\u6790\u7B97\u6CD5\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:".mjs"})," \u548C ",(0,i.jsx)(n.code,{children:"cjs"})," \u89C6\u4E3A\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u56E0\u6B64\u8FD9\u91CC\u9ED8\u8BA4\u4E5F\u4E0D\u4F1A\uFF0C\u4F46\u662F\u53EF\u4EE5\u901A\u8FC7\u66F4\u6539\u6B64\u914D\u7F6E\u6765\u5305\u542B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u6784\u5EFA cjs / esm \u4EA7\u7269\u65F6\u6CE8\u5165\u4E00\u4E9B\u57AB\u7247\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u53EA\u80FD\u5728 commonjs \u91CC\u4F7F\u7528\uFF0C\u5F00\u542F\u6B64\u9009\u9879\u540E\uFF0C\u5F53\u4EA7\u7269\u683C\u5F0F\u4E3A esm \u65F6\uFF0C\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u7F16\u8BD1\u4E3A ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u4EE3\u7801\u89C1 ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"shims"}),"\uFF0C\n\u9700\u8981\u6CE8\u610F\u7684\u662F esm shims \u53EA\u4F1A\u5728 ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," \u4E3A node \u65F6\u6CE8\u5165\uFF0C\u56E0\u4E3A\u7528\u5230\u4E86 url \u6A21\u5757\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u901A\u8FC7 package.json \u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u6765\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4E09\u65B9\u5305\u7684 package.json \u662F\u4E0D\u53EF\u9760\u7684\u3002\n\u4F8B\u5982\u6211\u4EEC\u5F15\u7528\u4E86\u4E00\u4E2A\u4E09\u65B9\u5305\u7684\u6837\u5F0F\u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F46\u662F\u8FD9\u4E2A\u4E09\u65B9\u5305\u7684 package.json \u91CC\u5E76\u6CA1\u6709\u5C06\u6837\u5F0F\u6587\u4EF6\u914D\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u91CC\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u540C\u65F6\u4F60\u53C8\u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," \u4E3A ",(0,i.jsx)(n.code,{children:"true"}),"\uFF0C\u5728\u63A7\u5236\u53F0\u53EF\u4EE5\u770B\u5230\u7C7B\u4F3C\u7684\u8B66\u544A\u4FE1\u606F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u65F6\u5019\u5C31\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u914D\u7F6E\u9879\uFF0C\u624B\u52A8\u914D\u7F6E\u6A21\u5757\u7684",(0,i.jsx)(n.code,{children:'"sideEffects"'}),"\uFF0C\u914D\u7F6E\u652F\u6301\u6B63\u5219\u548C\u51FD\u6570\u5F62\u5F0F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6DFB\u52A0\u6B64\u914D\u7F6E\u540E\uFF0C\u6253\u5305\u65F6\u5C06\u4E0D\u4F1A\u518D\u8BFB\u53D6 package.json \u91CC\u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6307\u5B9A\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55,\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"src"}),"\uFF0C\u7528\u4E8E\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6784\u5EFA\u65F6\u57FA\u4E8E\u6E90\u7801\u76EE\u5F55\u7ED3\u6784\u751F\u6210\u5BF9\u5E94\u7684\u4EA7\u7269\u76EE\u5F55\u3002\n\u7B49\u540C\u4E8E",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63A7\u5236 sourceMap \u5982\u4F55\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u5DF2\u5E9F\u5F03\uFF0C\u6B64\u914D\u7F6E\u4E0D\u4F1A\u4EA7\u751F\u4EFB\u4F55\u5F71\u54CD\u3002"})})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u6E90\u7801\u7684\u683C\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u5C06\u6E90\u7801\u4F5C\u4E3A EsModule \u8FDB\u884C\u5904\u7406\u3002\u5F53\u6E90\u7801\u4F7F\u7528\u7684\u662F CommonJS \u7684\u65F6\u5019\uFF0C\u9700\u8981\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"commonjs"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u5F00\u542F\u4EE3\u7801\u5206\u5272\u3002\n\u4EC5\u652F\u6301 ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," \u548C ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),"\uFF0C\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6837\u5F0F\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Less"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Less"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"4.1.3"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sass",children:["sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Sass \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Sass"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Sass"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"1.5.4"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u914D\u7F6E PostCSS \u7684\u9009\u9879\uFF0C\u4F20\u5165\u7684\u503C\u4F1A\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002\u6CE8\u610F ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u662F\u6D45\u62F7\u8D1D\uFF0C\u56E0\u6B64\u4F1A\u5B8C\u5168\u8986\u76D6\u5185\u7F6E\u7684 plugins \u6570\u7EC4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u8BF7\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // \u4EE5\u4E0B\u63D2\u4EF6\u9ED8\u8BA4\u542F\u7528\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // \u4EE5\u4E0B\u63D2\u4EF6\u4EC5\u5728 target \u4E3A `es5` \u65F6\u542F\u7528\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6253\u5305\u6A21\u5F0F\u4E0B\u662F\u5426\u5C06 CSS \u6837\u5F0F\u63D2\u5165\u5230 JavaScript \u4EE3\u7801\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5C06 ",(0,i.jsx)(n.code,{children:"inject"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u6765\u5F00\u542F\u6B64\u529F\u80FD\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230\u6E90\u7801\u4E2D\u5F15\u7528\u7684 CSS \u4EE3\u7801\u88AB\u5305\u542B\u5728\u4E86\u6253\u5305\u540E\u7684 JS \u4EA7\u7269\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u4F60\u5728\u6E90\u7801\u91CC\u5199\u4E86 ",(0,i.jsx)(n.code,{children:"import './index.scss'"}),"\uFF0C\u90A3\u4E48\u5728\u4EA7\u7269\u4E2D\u4F60\u4F1A\u770B\u5230\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"inject"})," \u540E\uFF0C\u4F60\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["CSS \u6587\u4EF6\u4E2D\u7684 ",(0,i.jsx)(n.code,{children:"@import"})," \u4E0D\u4F1A\u88AB\u5904\u7406\u3002\u5982\u679C\u4F60\u7684 CSS \u6587\u4EF6\u4E2D\u6709 ",(0,i.jsx)(n.code,{children:"@import"})," \uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5728 JS \u6587\u4EF6\u4E2D\u624B\u52A8\u5F15\u5165 CSS \u6587\u4EF6\uFF08less,scss \u6587\u4EF6\u4E0D\u9700\u8981\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u4F1A\u6709\u9884\u5904\u7406\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u9700\u8981\u8003\u8651 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u7684\u5F71\u54CD\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u7684\u6784\u5EFA\u5668\u4F1A\u8BA4\u4E3A CSS \u662F\u6709\u526F\u4F5C\u7528\u7684\uFF0C\u5982\u679C\u4F60\u7684\u9879\u76EE\u4E2D\u6216\u8005\u4E09\u65B9\u5305\u7684 package.json \u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u5B57\u6BB5\u5E76\u4E14\u6CA1\u6709\u5305\u542B\u6B64 CSS \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u5C06\u4F1A\u5F97\u5230\u4E00\u4E2A\u8B66\u544A\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"})," \u6765\u89E3\u51B3\u3002"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6839\u636E\u6587\u4EF6\u540D\u81EA\u52A8\u542F\u7528 CSS Modules\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : \u4E3A\u4EE5 ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," \u6587\u4EF6\u540D\u7ED3\u5C3E\u7684\u6837\u5F0F\u6587\u4EF6\u542F\u7528 CSS Modules\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : \u7981\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : \u4E3A\u5339\u914D\u6B63\u5219\u6761\u4EF6\u7684\u6240\u6709\u6587\u4EF6\u542F\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules \u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4E00\u4E2A\u5E38\u7528\u7684\u914D\u7F6E\u662F ",(0,i.jsx)(n.code,{children:"localsConvention"}),"\uFF0C\u5B83\u53EF\u4EE5\u6539\u53D8 CSS Modules \u7684\u7C7B\u540D\u751F\u6210\u89C4\u5219\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E\u4EE5\u4E0B\u6837\u5F0F\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," \u6765\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u4E4B\u524D\uFF0C\u4F60\u9700\u8981\u542F\u7528 Modern.js Module \u7684 Tailwind CSS \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BF7\u9605\u8BFB",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u7AE0\u8282\u6765\u4E86\u89E3\u5F00\u542F\u65B9\u5F0F\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u7C7B\u578B",children:["\u7C7B\u578B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u51FD\u6570\u8FD4\u56DE\u7684\u5BF9\u8C61\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u7684\u4F7F\u7528\u65B9\u5F0F\u548C Tailwind CSS \u4E00\u81F4: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"\u5FEB\u901F\u4F20\u9001\u95E8"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E\u9879\uFF0C\u90A3\u4E48 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u5C06\u4F1A\u88AB ",(0,i.jsx)(n.code,{children:"designSystem"})," \u7684\u503C\u6240\u8986\u76D6\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u914D\u7F6E\u7684\u4F7F\u7528\u65B9\u5F0F\u4E0E Tailwind CSS \u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," \u7528\u4E8E\u4E3A\u751F\u6210\u7684 JavaScript \u4EE3\u7801\u8BBE\u7F6E\u76EE\u6807\u73AF\u5883\u3002\u5B83\u8BA9 Modern.js Module \u5C06\u76EE\u6807\u73AF\u5883\u65E0\u6CD5\u8BC6\u522B\u7684 JavaScript \u8BED\u6CD5\u8F6C\u6362\u4E3A\u5728\u8FD9\u4E9B\u73AF\u5883\u4E2D\u53EF\u7528\u7684\u4F4E\u7248\u672C JavaScript \u8BED\u6CD5\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06\u4EE3\u7801\u7F16\u8BD1\u5230 ",(0,i.jsx)(n.code,{children:"es5"})," \u8BED\u6CD5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E0E babel-plugin-import \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E SWC \u5B9E\u73B0\uFF0C\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u53C2\u8003",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9",children:"\u300CImport \u63D2\u4EF6\u2014\u2014\u6CE8\u610F\u4E8B\u9879\u300D"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u6A21\u5757\u5316 ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," \u7684\u5BFC\u5165\uFF0C\u5220\u9664\u672A\u4F7F\u7528\u7684 lodash \u6A21\u5757\uFF0C\u4ECE\u800C\u51CF\u5C11 lodash \u4EE3\u7801\u4F53\u79EF\u3002\u8FD9\u9879\u4F18\u5316\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," \u548C ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," \u5B9E\u73B0\u3002\n\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0CModern.js Module \u4F1A\u81EA\u52A8\u5C06 lodash \u7684\u4EE3\u7801\u5F15\u7528\u6307\u5411\u5B50\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6BD4\u5982\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8F6C\u6362\u540E\u7684\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"TypeScript \u914D\u7F6E\u6587\u4EF6\u7684\u8DEF\u5F84\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"react"})," \u548C ",(0,i.jsx)(n.code,{children:"react-dom"})," \u4F1A\u88AB\u770B\u505A\u662F\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF0C\u4E0D\u4F1A\u88AB\u6253\u5305\u8FDB UMD \u4EA7\u7269\u4E2D\uFF0C\u800C\u662F\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.React"})," \u548C ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})," \u7684\u65B9\u5F0F\u8FDB\u884C\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6 UMD \u4EA7\u7269\u4F1A\u53BB\u6302\u8F7D\u5230 ",(0,i.jsx)(n.code,{children:"global.myLib"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9700\u8981\u9075\u5B88 UMD \u89C4\u8303\uFF0CUMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u4E0D\u80FD\u548C\u5168\u5C40\u53D8\u91CF\u540D\u51B2\u7A81\u3002"}),"\n",(0,i.jsxs)(n.li,{children:["\u6A21\u5757\u540D\u4F1A\u88AB\u8F6C\u6362\u4E3A\u9A7C\u5CF0\u547D\u540D\uFF0C\u5982 ",(0,i.jsx)(n.code,{children:"my-lib"})," \u4F1A\u88AB\u8F6C\u6362\u4E3A ",(0,i.jsx)(n.code,{children:"myLib"}),"\uFF0C\u53EF\u53C2\u8003",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsx)(n.p,{children:"\u540C\u65F6\u51FD\u6570\u5F62\u5F0F\u53EF\u4EE5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570\uFF0C\u4E3A\u5F53\u524D\u6253\u5305\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n});\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"sass",id:"sass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/1980.79b63473.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1684.f3977b44.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/1980.79b63473.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1684.f3977b44.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6148.214fdab7.js b/modern-js/module-tools/static/js/async/1711.1e576c94.js similarity index 98% rename from modern-js/module-tools/static/js/async/6148.214fdab7.js rename to modern-js/module-tools/static/js/async/1711.1e576c94.js index c191a521b7..5c3546dcb2 100644 --- a/modern-js/module-tools/static/js/async/6148.214fdab7.js +++ b/modern-js/module-tools/static/js/async/1711.1e576c94.js @@ -1,2 +1,2 @@ -/*! For license information please see 6148.214fdab7.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6148"],{87327:function(e,l,n){"use strict";n.r(l);var d=n("39980"),i=n("9580"),s=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(l.h1,{id:"node-polyfill-\u63D2\u4EF6",children:["Node Polyfill \u63D2\u4EF6",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfill-\u63D2\u4EF6",children:"#"})]}),"\n",(0,d.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,d.jsx)(l.div,{className:"rspress-directive-title",children:"Node Polyfill \u4ECB\u7ECD"}),(0,d.jsx)(l.div,{className:"rspress-directive-content",children:(0,d.jsx)(l.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u4F1A\u5728\u6D4F\u89C8\u5668\u7AEF\u4F7F\u7528 Node \u6A21\u5757\u3002\u4F46\u5728\u5F53\u524D\u4EE3\u7801\u9700\u8981\u540C\u65F6\u5728 Node \u7AEF\u548C\u6D4F\u89C8\u5668\u7AEF\u8FD0\u884C\u65F6\uFF0C\u7528\u5230\u4E00\u4E9B Node \u6A21\u5757\u662F\u6709\u53EF\u80FD\u7684\u3002Node Polyfill \u4E3A\u8FD9\u4E9B Node \u6A21\u5757\u63D0\u4F9B\u4E86\u6D4F\u89C8\u5668\u7248\u672C\u7684 polyfills\u3002"})})]}),"\n",(0,d.jsx)(l.p,{children:"\u901A\u8FC7\u4F7F\u7528 Node Polyfill \u63D2\u4EF6\uFF0C\u4F1A\u81EA\u52A8\u6CE8\u5165 Node \u6838\u5FC3\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u7AEF\u7684 polyfills\uFF0C\u8BA9\u4F60\u53EF\u4EE5\u5728\u6D4F\u89C8\u5668\u7AEF\u653E\u5FC3\u4F7F\u7528\u8FD9\u4E9B\u6A21\u5757\u3002"}),"\n",(0,d.jsxs)(l.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,d.jsxs)(l.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,d.jsx)(s.SU,{command:"add @modern-js/plugin-module-node-polyfill -D"}),"\n",(0,d.jsxs)(l.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginNodePolyfill()],\n});\n"})}),"\n",(0,d.jsxs)(l.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"type NodePolyfillOptions = {\n exclude?: string[];\n overrides?: Record;\n};\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"exclude",children:["exclude",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u6392\u9664\u8981\u6CE8\u5165\u7684 Node Polyfill\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n exclude: ['console'],\n }),\n ],\n});\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"overrides",children:["overrides",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#overrides",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u8986\u76D6\u5185\u7F6E\u7684 Node Polyfill\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n overrides: {\n fs: path.join(__dirname, './custom-fs.js'),\n },\n }),\n ],\n});\n"})}),"\n",(0,d.jsxs)(l.h2,{id:"node-polyfills",children:["Node Polyfills",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfills",children:"#"})]}),"\n",(0,d.jsxs)(l.h3,{id:"globals",children:["Globals",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#globals",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"Buffer"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"console"})}),"\n"]}),"\n",(0,d.jsx)(l.p,{children:"\u5F53\u4F60\u5728\u4EE3\u7801\u4E2D\u4F7F\u7528\u4EE5\u4E0A\u5168\u5C40\u53D8\u91CF\u65F6\uFF0C\u5BF9\u5E94 polyfill \u4F1A\u88AB\u81EA\u52A8\u6CE8\u5165\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"const bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"modules",children:["Modules",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#modules",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"assert"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"buffer"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"console"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"constants"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"crypto"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"domain"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"events"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"http"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"https"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"os"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"path"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"punycode"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"querystring"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"stream"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_duplex"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_passthrough"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_readable"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_transform"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_writable"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"string_decoder"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"sys"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"timers"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"tty"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"url"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"util"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"vm"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"zlib"})}),"\n"]}),"\n",(0,d.jsxs)(l.p,{children:["\u5F53\u4F60\u901A\u8FC7 ",(0,d.jsx)(l.code,{children:"require"})," \u6216 ",(0,d.jsx)(l.code,{children:"import"})," \u7B49\u8BED\u6CD5\u5728\u4EE3\u7801\u4E2D\u5F15\u7528\u4EE5\u4E0A\u6A21\u5757\u65F6\uFF0C\u5BF9\u5E94 polyfill \u4F1A\u88AB\u6CE8\u5165\u3002"]}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { Buffer } from 'buffer';\n\nconst bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"fallbacks",children:["Fallbacks",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#fallbacks",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"child_process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"cluster"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"dgram"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"dns"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"fs"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"module"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"net"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"readline"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"repl"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"tls"})}),"\n"]}),"\n",(0,d.jsx)(l.p,{children:"\u76EE\u524D\u6D4F\u89C8\u5668\u7AEF\u6CA1\u6709\u4EE5\u4E0A\u6A21\u5757\u7684 polyfill\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u4EE5\u4E0A\u6A21\u5757\u65F6\uFF0C\u4F1A\u81EA\u52A8 fallback \u4E3A\u4E00\u4E2A\u7A7A\u5BF9\u8C61\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import fs from 'fs';\n\nconsole.log(fs); // -> {}\n"})})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,i.ah)(),e.components);return l?(0,d.jsx)(l,{...e,children:(0,d.jsx)(r,{...e})}):r(e)}l.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-node-polyfill.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"exclude",id:"exclude",depth:3},{text:"overrides",id:"overrides",depth:3},{text:"Node Polyfills",id:"node-polyfills",depth:2},{text:"Globals",id:"globals",depth:3},{text:"Modules",id:"modules",depth:3},{text:"Fallbacks",id:"fallbacks",depth:3}],title:"Node Polyfill \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 1711.1e576c94.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1711"],{41696:function(e,l,n){"use strict";n.r(l);var d=n("39980"),i=n("9580"),s=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(l.h1,{id:"node-polyfill-\u63D2\u4EF6",children:["Node Polyfill \u63D2\u4EF6",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfill-\u63D2\u4EF6",children:"#"})]}),"\n",(0,d.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,d.jsx)(l.div,{className:"rspress-directive-title",children:"Node Polyfill \u4ECB\u7ECD"}),(0,d.jsx)(l.div,{className:"rspress-directive-content",children:(0,d.jsx)(l.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u4F1A\u5728\u6D4F\u89C8\u5668\u7AEF\u4F7F\u7528 Node \u6A21\u5757\u3002\u4F46\u5728\u5F53\u524D\u4EE3\u7801\u9700\u8981\u540C\u65F6\u5728 Node \u7AEF\u548C\u6D4F\u89C8\u5668\u7AEF\u8FD0\u884C\u65F6\uFF0C\u7528\u5230\u4E00\u4E9B Node \u6A21\u5757\u662F\u6709\u53EF\u80FD\u7684\u3002Node Polyfill \u4E3A\u8FD9\u4E9B Node \u6A21\u5757\u63D0\u4F9B\u4E86\u6D4F\u89C8\u5668\u7248\u672C\u7684 polyfills\u3002"})})]}),"\n",(0,d.jsx)(l.p,{children:"\u901A\u8FC7\u4F7F\u7528 Node Polyfill \u63D2\u4EF6\uFF0C\u4F1A\u81EA\u52A8\u6CE8\u5165 Node \u6838\u5FC3\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u7AEF\u7684 polyfills\uFF0C\u8BA9\u4F60\u53EF\u4EE5\u5728\u6D4F\u89C8\u5668\u7AEF\u653E\u5FC3\u4F7F\u7528\u8FD9\u4E9B\u6A21\u5757\u3002"}),"\n",(0,d.jsxs)(l.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,d.jsxs)(l.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,d.jsx)(s.SU,{command:"add @modern-js/plugin-module-node-polyfill -D"}),"\n",(0,d.jsxs)(l.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginNodePolyfill()],\n});\n"})}),"\n",(0,d.jsxs)(l.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"type NodePolyfillOptions = {\n exclude?: string[];\n overrides?: Record;\n};\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"exclude",children:["exclude",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u6392\u9664\u8981\u6CE8\u5165\u7684 Node Polyfill\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n exclude: ['console'],\n }),\n ],\n});\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"overrides",children:["overrides",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#overrides",children:"#"})]}),"\n",(0,d.jsx)(l.p,{children:"\u8986\u76D6\u5185\u7F6E\u7684 Node Polyfill\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n overrides: {\n fs: path.join(__dirname, './custom-fs.js'),\n },\n }),\n ],\n});\n"})}),"\n",(0,d.jsxs)(l.h2,{id:"node-polyfills",children:["Node Polyfills",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfills",children:"#"})]}),"\n",(0,d.jsxs)(l.h3,{id:"globals",children:["Globals",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#globals",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"Buffer"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"console"})}),"\n"]}),"\n",(0,d.jsx)(l.p,{children:"\u5F53\u4F60\u5728\u4EE3\u7801\u4E2D\u4F7F\u7528\u4EE5\u4E0A\u5168\u5C40\u53D8\u91CF\u65F6\uFF0C\u5BF9\u5E94 polyfill \u4F1A\u88AB\u81EA\u52A8\u6CE8\u5165\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"const bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"modules",children:["Modules",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#modules",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"assert"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"buffer"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"console"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"constants"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"crypto"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"domain"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"events"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"http"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"https"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"os"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"path"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"punycode"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"querystring"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"stream"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_duplex"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_passthrough"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_readable"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_transform"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"_stream_writable"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"string_decoder"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"sys"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"timers"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"tty"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"url"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"util"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"vm"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"zlib"})}),"\n"]}),"\n",(0,d.jsxs)(l.p,{children:["\u5F53\u4F60\u901A\u8FC7 ",(0,d.jsx)(l.code,{children:"require"})," \u6216 ",(0,d.jsx)(l.code,{children:"import"})," \u7B49\u8BED\u6CD5\u5728\u4EE3\u7801\u4E2D\u5F15\u7528\u4EE5\u4E0A\u6A21\u5757\u65F6\uFF0C\u5BF9\u5E94 polyfill \u4F1A\u88AB\u6CE8\u5165\u3002"]}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import { Buffer } from 'buffer';\n\nconst bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,d.jsxs)(l.h3,{id:"fallbacks",children:["Fallbacks",(0,d.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#fallbacks",children:"#"})]}),"\n",(0,d.jsxs)(l.ul,{children:["\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"child_process"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"cluster"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"dgram"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"dns"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"fs"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"module"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"net"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"readline"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"repl"})}),"\n",(0,d.jsx)(l.li,{children:(0,d.jsx)(l.code,{children:"tls"})}),"\n"]}),"\n",(0,d.jsx)(l.p,{children:"\u76EE\u524D\u6D4F\u89C8\u5668\u7AEF\u6CA1\u6709\u4EE5\u4E0A\u6A21\u5757\u7684 polyfill\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u4EE5\u4E0A\u6A21\u5757\u65F6\uFF0C\u4F1A\u81EA\u52A8 fallback \u4E3A\u4E00\u4E2A\u7A7A\u5BF9\u8C61\u3002"}),"\n",(0,d.jsx)(l.pre,{children:(0,d.jsx)(l.code,{className:"language-ts",children:"import fs from 'fs';\n\nconsole.log(fs); // -> {}\n"})})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,i.ah)(),e.components);return l?(0,d.jsx)(l,{...e,children:(0,d.jsx)(r,{...e})}):r(e)}l.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-node-polyfill.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"exclude",id:"exclude",depth:3},{text:"overrides",id:"overrides",depth:3},{text:"Node Polyfills",id:"node-polyfills",depth:2},{text:"Globals",id:"globals",depth:3},{text:"Modules",id:"modules",depth:3},{text:"Fallbacks",id:"fallbacks",depth:3}],title:"Node Polyfill \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6148.214fdab7.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1711.1e576c94.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6148.214fdab7.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1711.1e576c94.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6458.2d6a7f4e.js b/modern-js/module-tools/static/js/async/1800.6e537275.js similarity index 97% rename from modern-js/module-tools/static/js/async/6458.2d6a7f4e.js rename to modern-js/module-tools/static/js/async/1800.6e537275.js index 609b8f1cf6..483eca5061 100644 --- a/modern-js/module-tools/static/js/async/6458.2d6a7f4e.js +++ b/modern-js/module-tools/static/js/async/1800.6e537275.js @@ -1,2 +1,2 @@ -/*! For license information please see 6458.2d6a7f4e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6458"],{56040:function(e,s,n){"use strict";n.r(s);var d=n("39980"),c=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ul:"ul",li:"li",strong:"strong",pre:"pre"},(0,c.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(s.h1,{id:"\u5904\u7406\u9759\u6001\u8D44\u6E90",children:["\u5904\u7406\u9759\u6001\u8D44\u6E90",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5904\u7406\u9759\u6001\u8D44\u6E90",children:"#"})]}),"\n",(0,d.jsxs)(s.p,{children:["Modern.js Module \u4F1A\u5BF9\u4EE3\u7801\u4E2D\u4F7F\u7528\u7684\u9759\u6001\u8D44\u6E90\u8FDB\u884C\u5904\u7406\u3002\u5982\u679C\u9700\u8981\u914D\u7F6E\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(s.a,{href:"/api/config/build-config#asset",children:(0,d.jsx)(s.code,{children:"buildConfig.asset"})})," API\u3002"]}),"\n",(0,d.jsxs)(s.h2,{id:"\u9ED8\u8BA4\u884C\u4E3A",children:["\u9ED8\u8BA4\u884C\u4E3A",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9ED8\u8BA4\u884C\u4E3A",children:"#"})]}),"\n",(0,d.jsx)(s.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0CModern.js Module \u4F1A\u5904\u7406\u4EE5\u4E0B\u9759\u6001\u8D44\u6E90\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.svg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.png'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.jpg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.jpeg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.gif'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.webp'"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.ttf'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.otf'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.woff'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.woff2'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.eot'"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.mp3'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.mp4'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.webm'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.ogg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.wav'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.flac'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.aac'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.mov'"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:"\u5BF9\u4E8E\u9759\u6001\u6587\u4EF6\u7684\u5904\u7406\uFF0CModern.js Module \u76EE\u524D\u9ED8\u8BA4\u652F\u6301\u7684\u529F\u80FD\u6709\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u8F93\u51FA\u9759\u6001\u8D44\u6E90\u81F3 ",(0,d.jsx)(s.code,{children:"./assets"}),"\u3002"]}),"\n",(0,d.jsxs)(s.li,{children:["\u5BF9\u4E8E\u4E0D\u8D85\u8FC7 ",(0,d.jsx)(s.strong,{children:"10kb"})," \u7684\u6587\u4EF6\u4F1A\u5185\u8054\u5230\u4EE3\u7801\u4E2D\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(s.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,d.jsx)(s.p,{children:"\u8BA9\u6211\u4EEC\u770B\u4E0B\u9762\u7684\u4F8B\u5B50\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"\u9879\u76EE\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-ts",meta:'title="./src/asset.ts"',children:"import img from './bg.png';\n"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u5982\u679C ",(0,d.jsx)(s.code,{children:"bg.png"})," \u7684\u5927\u5C0F\u5C0F\u4E8E 10 kb\uFF0C\u5219\u6B64\u65F6\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u548C\u4EA7\u7269\u5185\u5BB9\u4E3A\uFF1A"]}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-bash",children:"./dist\n\u2514\u2500\u2500 asset.js\n"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"var img_default = 'data:image/png;base64,';\n"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u5982\u679C ",(0,d.jsx)(s.code,{children:"bg.png"})," \u7684\u5927\u5C0F\u5927\u4E8E 10 kb\uFF0C\u5219\u6B64\u65F6\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u548C\u4EA7\u7269\u5185\u5BB9\u4E3A\uFF1A"]}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-bash",children:"./dist\n\u251C\u2500\u2500 asset.js\n\u2514\u2500\u2500 assets\n \u2514\u2500\u2500 bg.13e2aba2.png\n"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"import img from './assets/bg.13e2aba2.png';\n"})}),"\n",(0,d.jsx)(s.p,{children:"\u5F53\u4F60\u60F3\u8981\u4FEE\u6539\u9ED8\u8BA4\u884C\u4E3A\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B API\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"asset.path"}),"\uFF1A\u4FEE\u6539\u9759\u6001\u8D44\u6E90\u6587\u4EF6\u8F93\u51FA\u8DEF\u5F84\u3002"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"asset.limit"}),"\uFF1A\u4FEE\u6539\u5185\u8054\u9759\u6001\u8D44\u6E90\u6587\u4EF6\u7684\u9608\u503C\u3002"]}),"\n"]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,c.ah)(),e.components);return s?(0,d.jsx)(s,{...e,children:(0,d.jsx)(i,{...e})}):i(e)}s.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fasset.mdx"]={toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2}],title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file +/*! For license information please see 1800.6e537275.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1800"],{95293:function(e,s,n){"use strict";n.r(s);var d=n("39980"),c=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ul:"ul",li:"li",strong:"strong",pre:"pre"},(0,c.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(s.h1,{id:"\u5904\u7406\u9759\u6001\u8D44\u6E90",children:["\u5904\u7406\u9759\u6001\u8D44\u6E90",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5904\u7406\u9759\u6001\u8D44\u6E90",children:"#"})]}),"\n",(0,d.jsxs)(s.p,{children:["Modern.js Module \u4F1A\u5BF9\u4EE3\u7801\u4E2D\u4F7F\u7528\u7684\u9759\u6001\u8D44\u6E90\u8FDB\u884C\u5904\u7406\u3002\u5982\u679C\u9700\u8981\u914D\u7F6E\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(s.a,{href:"/api/config/build-config#asset",children:(0,d.jsx)(s.code,{children:"buildConfig.asset"})})," API\u3002"]}),"\n",(0,d.jsxs)(s.h2,{id:"\u9ED8\u8BA4\u884C\u4E3A",children:["\u9ED8\u8BA4\u884C\u4E3A",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9ED8\u8BA4\u884C\u4E3A",children:"#"})]}),"\n",(0,d.jsx)(s.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0CModern.js Module \u4F1A\u5904\u7406\u4EE5\u4E0B\u9759\u6001\u8D44\u6E90\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.svg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.png'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.jpg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.jpeg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.gif'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.webp'"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.ttf'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.otf'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.woff'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.woff2'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.eot'"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"'.mp3'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.mp4'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.webm'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.ogg'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.wav'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.flac'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.aac'"}),"\u3001",(0,d.jsx)(s.code,{children:"'.mov'"})]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:"\u5BF9\u4E8E\u9759\u6001\u6587\u4EF6\u7684\u5904\u7406\uFF0CModern.js Module \u76EE\u524D\u9ED8\u8BA4\u652F\u6301\u7684\u529F\u80FD\u6709\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u8F93\u51FA\u9759\u6001\u8D44\u6E90\u81F3 ",(0,d.jsx)(s.code,{children:"./assets"}),"\u3002"]}),"\n",(0,d.jsxs)(s.li,{children:["\u5BF9\u4E8E\u4E0D\u8D85\u8FC7 ",(0,d.jsx)(s.strong,{children:"10kb"})," \u7684\u6587\u4EF6\u4F1A\u5185\u8054\u5230\u4EE3\u7801\u4E2D\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(s.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,d.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,d.jsx)(s.p,{children:"\u8BA9\u6211\u4EEC\u770B\u4E0B\u9762\u7684\u4F8B\u5B50\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:"\u9879\u76EE\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-ts",meta:'title="./src/asset.ts"',children:"import img from './bg.png';\n"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u5982\u679C ",(0,d.jsx)(s.code,{children:"bg.png"})," \u7684\u5927\u5C0F\u5C0F\u4E8E 10 kb\uFF0C\u5219\u6B64\u65F6\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u548C\u4EA7\u7269\u5185\u5BB9\u4E3A\uFF1A"]}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-bash",children:"./dist\n\u2514\u2500\u2500 asset.js\n"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"var img_default = 'data:image/png;base64,';\n"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\u5982\u679C ",(0,d.jsx)(s.code,{children:"bg.png"})," \u7684\u5927\u5C0F\u5927\u4E8E 10 kb\uFF0C\u5219\u6B64\u65F6\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u548C\u4EA7\u7269\u5185\u5BB9\u4E3A\uFF1A"]}),"\n"]}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-bash",children:"./dist\n\u251C\u2500\u2500 asset.js\n\u2514\u2500\u2500 assets\n \u2514\u2500\u2500 bg.13e2aba2.png\n"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"import img from './assets/bg.13e2aba2.png';\n"})}),"\n",(0,d.jsx)(s.p,{children:"\u5F53\u4F60\u60F3\u8981\u4FEE\u6539\u9ED8\u8BA4\u884C\u4E3A\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B API\uFF1A"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"asset.path"}),"\uFF1A\u4FEE\u6539\u9759\u6001\u8D44\u6E90\u6587\u4EF6\u8F93\u51FA\u8DEF\u5F84\u3002"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.code,{children:"asset.limit"}),"\uFF1A\u4FEE\u6539\u5185\u8054\u9759\u6001\u8D44\u6E90\u6587\u4EF6\u7684\u9608\u503C\u3002"]}),"\n"]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,c.ah)(),e.components);return s?(0,d.jsx)(s,{...e,children:(0,d.jsx)(i,{...e})}):i(e)}s.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fasset.mdx"]={toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2}],title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/21.a800b490.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1800.6e537275.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/21.a800b490.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1800.6e537275.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1819.ba3c2c1e.js b/modern-js/module-tools/static/js/async/1819.ba3c2c1e.js new file mode 100644 index 0000000000..271b5edd2f --- /dev/null +++ b/modern-js/module-tools/static/js/async/1819.ba3c2c1e.js @@ -0,0 +1,2 @@ +/*! For license information please see 1819.ba3c2c1e.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1819"],{56290:function(e,o,r){"use strict";r.r(o);var n=r("39980"),s=r("9580");function t(e){let o=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",ul:"ul",li:"li",pre:"pre",ol:"ol",img:"img"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"storybook-faq",children:["Storybook FAQ",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-faq",children:"#"})]}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-v7-support",children:["Storybook v7 Support",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-v7-support",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook v7 is now fully supported and has become our recommended version."}),"\n",(0,n.jsxs)(o.h2,{id:"using-storybook-addon-or-other-configurations-does-not-work",children:["Using Storybook Addon or other configurations does not work",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#using-storybook-addon-or-other-configurations-does-not-work",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Modern.js Module is currently using Storybook version v6, if you are using Addon version v7 you may not be able to get the addon to work."}),"\n",(0,n.jsxs)(o.p,{children:["In addition to the Addon, other configurations may also have differences. For example, if you modify the ",(0,n.jsx)(o.code,{children:"preview.js"})," configuration file, Storybook v6 is written differently than v7:"]}),"\n",(0,n.jsxs)(o.ul,{children:["\n",(0,n.jsxs)(o.li,{children:["v6\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/6.5/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"Document"})]}),"\n",(0,n.jsxs)(o.li,{children:["v7\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"Document"})]}),"\n"]}),"\n",(0,n.jsxs)(o.h2,{id:"cannot-find-module-react-dompackagejson",children:["Cannot find module 'react-dom/package.json'",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-react-dompackagejson",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"When debug Storybook, the following problem occurs:"}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-bash",children:"ERR! Error: Cannot find module 'react-dom/package.json'\n"})}),"\n",(0,n.jsx)(o.p,{children:"You can install the react-dom dependency in the project."}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-json",children:'{\n "devDependencies": {\n "react-dom": "^17"\n }\n}\n'})}),"\n",(0,n.jsxs)(o.h2,{id:"unable-to-locate-the-specific-error-message",children:["Unable to locate the specific error message",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#unable-to-locate-the-specific-error-message",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Solutions:"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["Find ",(0,n.jsx)(o.code,{children:"@storybook/core-server/dist/cjs/dev-server.js"})]}),"\n",(0,n.jsxs)(o.li,{children:["Find this code: ",(0,n.jsx)(o.code,{children:"var _await$Promise$all = await Promise.all([preview, manager,"}),"."]}),"\n",(0,n.jsx)(o.li,{children:"Modify it\uFF1A"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"var _await$Promise$all = await Promise.all([\n preview.catch(e => console.info(e)),\n manager // TODO #13083 Restore this when compiling the preview is fast enough\n // .then((result) => {\n // if (!options.ci && !options.smokeTest) openInBrowser(address);\n // return result;\n // })\n .catch(previewBuilder.bail)]),\n _await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),\n previewResult = _await$Promise$all2[0],\n managerResult = _await$Promise$all2[1]; // TODO #13083 Remove this when compiling the preview is fast enough\n"})}),"\n",(0,n.jsxs)(o.h2,{id:"cant-find-any-stories-is-your-storybook",children:["Can`t find any stories is your Storybook",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cant-find-any-stories-is-your-storybook",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/01719a11-1939-4009-9317-5e2b491ae52f.png",alt:"storybook-error"})}),"\n",(0,n.jsx)(o.p,{children:"When you get a problem like this, you can first open the browser console and there should be some error messages. You can use the error messages to deduce if there is a problem in the code you are writing that is causing Storybook to not work properly."}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-adds-proxy-functionality",children:["Storybook Adds Proxy Functionality",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-adds-proxy-functionality",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook does not provide a solution for this, but there is one in the Storybook Issue. In the Modern.js Module, you can:"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["Add the ",(0,n.jsx)(o.code,{children:"config/storybook/middleware.js"})," file and initialize the following:"]}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"/* eslint-disable filenames/match-exported */\nmodule.exports = function expressMiddleware(router) {\n // router is express router\n // import { Router } from 'express'\n // router = new Router();\n};\n"})}),"\n",(0,n.jsxs)(o.ol,{start:"2",children:["\n",(0,n.jsxs)(o.li,{children:["add ",(0,n.jsx)(o.code,{children:"http-proxy-middleware"})," dependency"]}),"\n",(0,n.jsx)(o.li,{children:"Add proxy routing-related configuration"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:'/* eslint-disable filenames/match-exported */\nconst { createProxyMiddleware } = require("http-proxy-middleware");\n\nmodule.exports = function expressMiddleware (router) {\n router.use(\'/api\', createProxyMiddleware({\n target: "http://localhost:8000",\n changeOrigin: true\n }))\n}\n'})}),"\n",(0,n.jsxs)(o.p,{children:["Link\uFF1A",(0,n.jsx)(o.a,{href:"https://github.com/storybookjs/storybook/issues/11551",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/storybookjs/storybook/issues/11551"})]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(t,{...e})}):t(e)}o.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Fstorybook.mdx"]={toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2}],title:"Storybook FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2217.ff1da134.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1819.ba3c2c1e.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2217.ff1da134.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1819.ba3c2c1e.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1881.32ba02bd.js b/modern-js/module-tools/static/js/async/1867.578d6a53.js similarity index 97% rename from modern-js/module-tools/static/js/async/1881.32ba02bd.js rename to modern-js/module-tools/static/js/async/1867.578d6a53.js index e4fdfd8d8a..fc0010ad3a 100644 --- a/modern-js/module-tools/static/js/async/1881.32ba02bd.js +++ b/modern-js/module-tools/static/js/async/1867.578d6a53.js @@ -1,2 +1,2 @@ -/*! For license information please see 1881.32ba02bd.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1881"],{58082:function(e,n,r){"use strict";r.r(n);var o=r("39980"),s=r("9580");function a(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",div:"div",strong:"strong",h3:"h3",ul:"ul",li:"li",code:"code",pre:"pre",img:"img",h4:"h4"},(0,s.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"dev",children:["dev",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"\u672C\u7AE0\u8282\u63CF\u8FF0\u4E86 Modern.js Module \u5173\u4E8E\u8C03\u8BD5\u5DE5\u5177\u76F8\u5173\u7684\u6240\u6709\u914D\u7F6E\u3002"}),"\n",(0,o.jsxs)(n.h2,{id:"storybook",children:["storybook",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:"Deprecated"}),"\uFF1A\u8BE5\u914D\u7F6E\u5DF2\u8FC7\u65F6\uFF0C\u53EA\u9002\u7528\u4E8E StorybookV6\uFF0C\u8BE6\u60C5\u8BF7\u770B",(0,o.jsx)(n.a,{href:"/guide/basic/using-storybook",children:"\u4F7F\u7528Storybook"}),"\u3002\n"]})})]}),"\n",(0,o.jsxs)(n.h3,{id:"storybookwebpack",children:["storybook.webpack",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpack",children:"#"})]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,o.jsx)(n.code,{children:"object | Function | undefined"})]}),"\n",(0,o.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,o.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpack(config) {\n return config;\n },\n },\n },\n};\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,o.jsx)(n.code,{children:"dev.storybook.webpack"})," \u6765\u4FEE\u6539 Storybook Preview-iframe \u7684 webpack \u914D\u7F6E\u3002\u4F7F\u7528\u65B9\u5F0F\u53EF\u4EE5\u53C2\u8003 Modern.js Builder \u7684 ",(0,o.jsx)(n.a,{href:"https://modernjs.dev/builder/api/config-tools.html#toolswebpack",target:"_blank",rel:"noopener noreferrer",children:(0,o.jsx)(n.code,{children:"tools.webpack"})})," \u914D\u7F6E\u3002"]}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.img,{src:"https://storybook.js.org/71522ac365feaf3338d7c242e53378f6/manager-preview.png",alt:"Storybook"})}),"\n",(0,o.jsxs)(n.h4,{id:"\u914D\u7F6E-manager-app",children:["\u914D\u7F6E Manager App",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E-manager-app",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["\u5BF9\u4E8E Storybook Manager App \u90E8\u5206\u7684 webpack \u914D\u7F6E\uFF0C\u53EF\u4EE5\u901A\u8FC7\u589E\u52A0 ",(0,o.jsx)(n.code,{children:"./config/storybook/main.js"})," \u6587\u4EF6\u8FDB\u884C\u914D\u7F6E\u3002"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"// ./config/storybook/main.js\n\nmodule.exports = {\n // it controls the Storybook manager app\n managerWebpack: async (config, options) => {\n // update config here\n return config;\n },\n};\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"storybookwebpackchain",children:["storybook.webpackChain",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpackchain",children:"#"})]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,o.jsx)(n.code,{children:"Function | undefined"})]}),"\n",(0,o.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,o.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpackChain(chain) {\n return chain;\n },\n },\n },\n};\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,o.jsx)(n.code,{children:"dev.storybook.webpackChain"})," \u6765\u4FEE\u6539 Storybook Preview-iframe \u7684 webpack \u914D\u7F6E\u3002\u4F7F\u7528\u65B9\u5F0F\u53EF\u4EE5\u53C2\u8003 Modern.js Builder \u7684 ",(0,o.jsx)(n.a,{href:"https://modernjs.dev/builder/api/config-tools.html#toolswebpackchain",target:"_blank",rel:"noopener noreferrer",children:(0,o.jsx)(n.code,{children:"tools.webpackChain"})})," \u914D\u7F6E\u3002"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fdev.md"]={toc:[{text:"storybook",id:"storybook",depth:2},{text:"storybook.webpack",id:"storybookwebpack",depth:3},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3}],title:"dev",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 1867.578d6a53.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1867"],{27503:function(e,n,r){"use strict";r.r(n);var o=r("39980"),s=r("9580");function a(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",div:"div",strong:"strong",h3:"h3",ul:"ul",li:"li",code:"code",pre:"pre",img:"img",h4:"h4"},(0,s.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"dev",children:["dev",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"\u672C\u7AE0\u8282\u63CF\u8FF0\u4E86 Modern.js Module \u5173\u4E8E\u8C03\u8BD5\u5DE5\u5177\u76F8\u5173\u7684\u6240\u6709\u914D\u7F6E\u3002"}),"\n",(0,o.jsxs)(n.h2,{id:"storybook",children:["storybook",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:"Deprecated"}),"\uFF1A\u8BE5\u914D\u7F6E\u5DF2\u8FC7\u65F6\uFF0C\u53EA\u9002\u7528\u4E8E StorybookV6\uFF0C\u8BE6\u60C5\u8BF7\u770B",(0,o.jsx)(n.a,{href:"/guide/basic/using-storybook",children:"\u4F7F\u7528Storybook"}),"\u3002\n"]})})]}),"\n",(0,o.jsxs)(n.h3,{id:"storybookwebpack",children:["storybook.webpack",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpack",children:"#"})]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,o.jsx)(n.code,{children:"object | Function | undefined"})]}),"\n",(0,o.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,o.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpack(config) {\n return config;\n },\n },\n },\n};\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,o.jsx)(n.code,{children:"dev.storybook.webpack"})," \u6765\u4FEE\u6539 Storybook Preview-iframe \u7684 webpack \u914D\u7F6E\u3002\u4F7F\u7528\u65B9\u5F0F\u53EF\u4EE5\u53C2\u8003 Modern.js Builder \u7684 ",(0,o.jsx)(n.a,{href:"https://modernjs.dev/builder/api/config-tools.html#toolswebpack",target:"_blank",rel:"noopener noreferrer",children:(0,o.jsx)(n.code,{children:"tools.webpack"})})," \u914D\u7F6E\u3002"]}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.img,{src:"https://storybook.js.org/71522ac365feaf3338d7c242e53378f6/manager-preview.png",alt:"Storybook"})}),"\n",(0,o.jsxs)(n.h4,{id:"\u914D\u7F6E-manager-app",children:["\u914D\u7F6E Manager App",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E-manager-app",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["\u5BF9\u4E8E Storybook Manager App \u90E8\u5206\u7684 webpack \u914D\u7F6E\uFF0C\u53EF\u4EE5\u901A\u8FC7\u589E\u52A0 ",(0,o.jsx)(n.code,{children:"./config/storybook/main.js"})," \u6587\u4EF6\u8FDB\u884C\u914D\u7F6E\u3002"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"// ./config/storybook/main.js\n\nmodule.exports = {\n // it controls the Storybook manager app\n managerWebpack: async (config, options) => {\n // update config here\n return config;\n },\n};\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"storybookwebpackchain",children:["storybook.webpackChain",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpackchain",children:"#"})]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,o.jsx)(n.code,{children:"Function | undefined"})]}),"\n",(0,o.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,o.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpackChain(chain) {\n return chain;\n },\n },\n },\n};\n"})}),"\n",(0,o.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,o.jsx)(n.code,{children:"dev.storybook.webpackChain"})," \u6765\u4FEE\u6539 Storybook Preview-iframe \u7684 webpack \u914D\u7F6E\u3002\u4F7F\u7528\u65B9\u5F0F\u53EF\u4EE5\u53C2\u8003 Modern.js Builder \u7684 ",(0,o.jsx)(n.a,{href:"https://modernjs.dev/builder/api/config-tools.html#toolswebpackchain",target:"_blank",rel:"noopener noreferrer",children:(0,o.jsx)(n.code,{children:"tools.webpackChain"})})," \u914D\u7F6E\u3002"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fdev.md"]={toc:[{text:"storybook",id:"storybook",depth:2},{text:"storybook.webpack",id:"storybookwebpack",depth:3},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3}],title:"dev",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2232.e0ecfc6e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1867.578d6a53.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2232.e0ecfc6e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1867.578d6a53.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/187.5dd663d0.js b/modern-js/module-tools/static/js/async/187.5dd663d0.js new file mode 100644 index 0000000000..d9b5e68cdd --- /dev/null +++ b/modern-js/module-tools/static/js/async/187.5dd663d0.js @@ -0,0 +1,2 @@ +/*! For license information please see 187.5dd663d0.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["187"],{15884:function(e,n,s){"use strict";s.r(n);var r=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",h2:"h2",h3:"h3",code:"code",pre:"pre",ul:"ul",li:"li",ol:"ol",h4:"h4",img:"img"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",children:["\u6784\u5EFA\u76F8\u5173\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u8FD9\u91CC\u53EA\u8BB0\u5F55\u4E86\u4E00\u4E9B\u5E38\u89C1\u95EE\u9898\u548C bad case\u3002"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["\u5982\u679C\u662F\u6784\u5EFA\u4EA7\u7269\u4E0D\u7B26\u5408\u9884\u671F\u7684\u573A\u666F\uFF0C\u5C24\u5176\u662F\u914D\u7F6E\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-preset",children:"buildPreset"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\n\u8BF7\u5148\u4E86\u89E3 buildPreset \u4EE3\u8868\u4E86\u54EA\u4E9B\u914D\u7F6E\u9879\uFF0C\u518D\u6839\u636E\u6240\u6709\u7684\u914D\u7F6E\u9879\u9010\u4E2A\u68C0\u67E5"]})}),"\n",(0,r.jsxs)(n.h2,{id:"\u4EA7\u7269\u95EE\u9898",children:["\u4EA7\u7269\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4EA7\u7269\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",children:["Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["TypeSript \u63D0\u4F9B\u4E86 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\u7528\u4E8E\u63A7\u5236\u5BF9\u4E8E ",(0,r.jsx)(n.code,{children:"public class fields"})," \u7684\u8F6C\u6362\u5904\u7406\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u6709\u4E00\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n foo = 100;\n bar: string;\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u4E3A ",(0,r.jsx)(n.code,{children:"false"})," \u7684\u65F6\u5019\uFF0C\u5219\u7F16\u8BD1\u540E\u7684\u4EE3\u7801\u4F1A\u53D8\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n this.foo = 100;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u4E3A ",(0,r.jsx)(n.code,{children:"true"})," \u7684\u65F6\u5019\uFF0C\u5219\u7F16\u8BD1\u540E\u7684\u4EE3\u7801\u4F1A\u53D8\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n Object.defineProperty(this, 'foo', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 100,\n });\n Object.defineProperty(this, 'bar', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0,\n });\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u540C\u65F6\u8BE5\u914D\u7F6E\u7684\u9ED8\u8BA4\u503C\u4F1A\u6839\u636E tsconfig.json \u7684 ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#target",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"target"})})," \u914D\u7F6E\u800C\u53D8\u5316\uFF1A",(0,r.jsxs)(n.strong,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"target"})," \u662F ES2022 \u6216\u8005\u66F4\u9AD8\u7684\u65F6\u5019\uFF0C\u5219 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u9ED8\u8BA4\u914D\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"true"}),"\uFF0C\u5426\u5219\u5C31\u662F\u9ED8\u8BA4\u4E3A ",(0,r.jsx)(n.code,{children:"false"})]}),"\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5173\u4E8E TypeScript \u8FD9\u4E2A\u914D\u7F6E\u7684\u66F4\u591A\u4FE1\u606F\uFF0C\u53EF\u4EE5\u53C2\u8003\u4E0B\u9762\u7684\u94FE\u63A5\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier",target:"_blank",rel:"noopener noreferrer",children:"The useDefineForClassFields Flag and The declare Property Modifier"})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module \u76EE\u524D\u4F1A\u6839\u636E\u4E0B\u9762\u7684\u903B\u8F91\u8FDB\u884C\u5904\u7406\uFF1A"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\u9996\u5148\u6839\u636E\u5F53\u524D\u9879\u76EE\u7684 tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\u786E\u5B9A\u5728 Modern.js Module \u5185\u90E8\u5982\u4F55\u5904\u7406\u3002\u76EE\u524D\u53EA\u4F1A\u8BFB\u53D6\u5F53\u524D\u9879\u76EE\u8DEF\u5F84\u4E0B\u7684 tsconfig.json \u6587\u4EF6\u7684\u5185\u5BB9\uFF0C\u6682\u65F6\u4E0D\u652F\u6301\u6839\u636E ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#extends",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"extends"})})," \u914D\u7F6E\u6765\u83B7\u53D6\u6700\u7EC8\u7684 tsconfig \u914D\u7F6E\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u6CA1\u6709\u68C0\u6D4B tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\uFF0C\u5219\u4F1A\u6839\u636E tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"target"})," \u914D\u7F6E\u6765\u786E\u5B9A\u9ED8\u8BA4\u503C\u3002\u5982\u679C ",(0,r.jsx)(n.code,{children:"target"})," \u5927\u4E8E ",(0,r.jsx)(n.code,{children:"ES2022"}),"\uFF08\u5305\u542B ",(0,r.jsx)(n.code,{children:"EsNext"}),"\uFF09\uFF0C\u5219",(0,r.jsx)(n.code,{children:"useDefineForClassFields"}),"\u9ED8\u8BA4\u4E3A ",(0,r.jsx)(n.code,{children:"true"}),"\uFF0C\u5426\u5219\u4E3A ",(0,r.jsx)(n.code,{children:"false"}),"\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u6CA1\u6709\u68C0\u6D4B\u5230 tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"target"}),"\uFF0C\u5219\u6309\u7167 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"}),"\u7684\u503C \u4E3A ",(0,r.jsx)(n.code,{children:"true"})," \u8FDB\u884C\u5904\u7406\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",children:["babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 ",(0,r.jsx)(n.code,{children:"undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u4F7F\u7528\u7C7B\u4F3C\u4E0B\u9762\u7684\u65B9\u5F0F\u7684\u65F6\u5019\uFF0C\u4F1A\u51FA\u73B0\u8FD9\u4E2A\u95EE\u9898\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Lodash from 'lodash';\n\nexport const libs = {\n _: Lodash,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u76EE\u524D\u5728 ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"})," Github \u4E0A\u7684\u76F8\u5173 Issue\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/lodash/babel-plugin-lodash/issues/235",target:"_blank",rel:"noopener noreferrer",children:"#235"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u8FD9\u4E2A\u95EE\u9898\u7684\u89E3\u51B3\u529E\u6CD5\u662F\u79FB\u9664 ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"}),"\uFF0C\u56E0\u4E3A\u6B64\u65F6\u4E0D\u9700\u8981\u8BE5\u63D2\u4EF6\u8FDB\u884C\u6309\u9700\u5F15\u7528\uFF0C\u4F7F\u7528\u8BE5\u63D2\u4EF6\u4F1A\u4EA7\u751F\u526F\u4F5C\u7528\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u7C7B\u4F3C\u7684\u60C5\u51B5\u5728 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," \u4E0A\u4E5F\u53EF\u80FD\u4F1A\u51FA\u73B0\u3002\u6BD4\u5982\u6709\u7C7B\u4F3C\u5982\u4E0B\u7684\u4EE3\u7801\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Comps from 'components';\n\nexport const libs = {\n comps: Comps,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u6B64\u65F6 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," \u4E5F\u53EF\u80FD\u4F1A\u5BFC\u81F4 ",(0,r.jsx)(n.code,{children:"Comps"})," \u53D8\u4E3A ",(0,r.jsx)(n.code,{children:"undefined"}),"\u3002\u56E0\u6B64\u4E5F\u9700\u8981\u79FB\u9664\u5BF9\u5E94\u7684 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-module-http",children:["Cannot find module 'http'",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-http",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u4EA7\u7269\u5728\u6D4F\u89C8\u5668\u8FD0\u884C\u65F6\u62A5\u4E86\u7C7B\u4F3C ",(0,r.jsx)(n.code,{children:"Cannot find module 'http'"})," \u7684\u9519\u8BEF\uFF0C\u8BF4\u660E\u4F60\u7684\u4EA7\u7269\u6253\u5305\u8FDB\u4E86 node \u6A21\u5757\u3002\n\u8FD9\u53EF\u80FD\u4F1A\u53D1\u751F\u4E8E\u4F60\u7684\u4F9D\u8D56\u91CC\u6709\u4E00\u4E9B\u540C\u65F6\u652F\u6301 browser \u548C node \u7684\u4E09\u65B9\u5305\uFF0C\u4F8B\u5982 ",(0,r.jsx)(n.code,{children:"axios"}),"\uFF0C\u6B64\u65F6\u53EA\u9700\u8981\u5C06 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#platform",children:"platform"})," \u8BBE\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"browser"})," \u5373\u53EF\u3002\n\u5982\u679C\u4E00\u4E9B\u4E09\u65B9\u5305\u4E0D\u652F\u6301 browser, \u4F60\u53EF\u80FD\u9700\u8981\u624B\u52A8\u6CE8\u5165 ",(0,r.jsx)(n.a,{href:"/plugins/official-list/plugin-node-polyfill",children:"node polyfill"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5F02\u5E38\u7C7B\u95EE\u9898",children:["\u5F02\u5E38\u7C7B\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F02\u5E38\u7C7B\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"dynamic-require-of-react-is-not-supported",children:['Dynamic require of "react" is not supported',(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dynamic-require-of-react-is-not-supported",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"\u95EE\u9898\u63CF\u8FF0",children:["\u95EE\u9898\u63CF\u8FF0",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u95EE\u9898\u63CF\u8FF0",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u6784\u5EFA\u7684\u4EA7\u7269\u914D\u7F6E\u4E2D\u4EA7\u7269\u683C\u5F0F\u4E3A ES modules \u7684\u65F6\u5019\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u5BFC\u5165\u4E86\u7684\u7B2C\u4E09\u65B9 npm \u5305\u7684 cjs \u4EA7\u7269\uFF0C\u90A3\u4E48\u751F\u6210\u7684\u4EA7\u7269\u53EF\u80FD\u4F1A\u5728 webpack \u4E0B\u6709\u53EF\u80FD\u65E0\u6CD5\u6B63\u5E38\u8FD0\u884C\u3002"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/1280X1280.png",alt:""})}),"\n",(0,r.jsxs)(n.h4,{id:"\u89E3\u51B3\u529E\u6CD5",children:["\u89E3\u51B3\u529E\u6CD5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u89E3\u51B3\u529E\u6CD5",children:"#"})]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"\u9996\u5148\u9700\u8981\u627E\u5230\u662F\u54EA\u4E2A\u7B2C\u4E09\u65B9\u5305\u5F15\u8D77\u7684\u95EE\u9898"}),"\u3002\u4F8B\u5982\u62A5\u9519\u4FE1\u606F\u4E2D\u6307\u5411\u4E86 ",(0,r.jsx)(n.code,{children:"react"})," \u8FD9\u4E2A\u5305\uFF0C\u90A3\u4E48\u5C31\u8981\u5BFB\u627E\u5728\u54EA\u4E2A\u7B2C\u4E09\u65B9\u5305\u91CC\u5B58\u5728 ",(0,r.jsx)(n.code,{children:"require('react')"})," \u8FD9\u6837\u7684\u4EE3\u7801\u3002\u6BD4\u5982 ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/react-draggable",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"react-draggable"})})," \uFF0C\u8FD9\u4E2A\u5305\u4EC5\u5305\u542B ",(0,r.jsx)(n.code,{children:"cjs"})," \u4EA7\u7269\uFF0C\u90A3\u4E48\u95EE\u9898\u5B9A\u4F4D\u5230 ",(0,r.jsx)(n.code,{children:"react-draggable"})," \u8FD9\u4E2A\u5305\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u7136\u540E\u6211\u4EEC\u9700\u8981\u5C06\u8FD9\u4E2A\u5305\u901A\u8FC7\u4E0B\u9762\u7684\u914D\u7F6E\u8FDB\u884C\u6392\u9664\uFF0C\u5373",(0,r.jsx)(n.strong,{children:"\u4E0D\u6253\u5305\u5B58\u5728\u95EE\u9898\u7684\u7B2C\u4E09\u65B9\u5305"}),"\u3002"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n externals: ['react-draggable'],\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"\u53C2\u8003\u94FE\u63A5",children:["\u53C2\u8003\u94FE\u63A5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53C2\u8003\u94FE\u63A5",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/68423950/when-using-esbuild-with-external-react-i-get-dynamic-require-of-react-is-not-s",target:"_blank",rel:"noopener noreferrer",children:'When using esbuild with external react I get Dynamic require of "react" is not supported'})}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",children:["\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A",(0,r.jsx)(n.code,{children:"'Operation on an invalid type'"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u53EF\u80FD\u662F\u56E0\u4E3A\u8BE5\u7EC4\u4EF6\u5E93\u4F9D\u8D56\u7684 Less \u7248\u672C\u662F v3\uFF0C\u800C Modern.js Module \u9ED8\u8BA4\u662F v4\u3002v3 \u4E0E v4 \u5728 ",(0,r.jsx)(n.code,{children:"math"})," \u914D\u7F6E\u4E0A\u5B58\u5728\u6709 Break Change\uFF0C\u53EF\u4EE5\u67E5\u770B\u8FD9\u4E2A",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/73298187/less-error-operation-on-an-invalid-type-in-antd-dependency",target:"_blank",rel:"noopener noreferrer",children:"\u94FE\u63A5"})," \u4E86\u89E3\u8BE6\u60C5\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u56E0\u6B64\uFF0C\u5982\u679C\u662F\u5728\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86\u7C7B\u4F3C\u8FD9\u6837\u7684\u7EC4\u4EF6\u5E93\uFF1A"}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u6784\u5EFA\u914D\u7F6E\u4E2D\u4F7F\u7528\u4E86 ",(0,r.jsx)(n.code,{children:"buildPreset"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\u6309\u7167\u4E0B\u9762\u8FDB\u884C\u4FEE\u6539\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildPreset({ extendPreset }) {\n return extendPreset('your-build-preset', {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n });\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u6216\u8005\u4F7F\u7528\u4E86\u81EA\u5B9A\u4E49\u7684 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\u6309\u7167\u4E0B\u9762\u8FDB\u884C\u4FEE\u6539\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildConfig: {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u662F\u5728 Storybook \u4E2D\u4F7F\u7528\u4E86\u7C7B\u4F3C\u8FD9\u6837\u7684\u7EC4\u4EF6\uFF0C\u5219\u9700\u8981\u4FEE\u6539 Storybook \u7684\u8C03\u8BD5\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:"filename='.storybook/main.ts'",children:"module.exports = {\n framework: {\n options: {\n builderConfig: {\n tools: {\n webpackChain(chain, { CHAIN_ID }) {\n chain.module\n .rule(CHAIN_ID.RULE.LESS)\n .use(CHAIN_ID.USE.LESS)\n .tap(options => {\n options.lessOptions = {\n ...options.lessOptions,\n math: 'always',\n };\n return options;\n });\n },\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-dts-failed",children:["Bundleless DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u4E0D\u6253\u5305\u7684\u573A\u666F\u4E0B\uFF0C\u662F\u76F4\u63A5 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7C7B\u578B\u58F0\u660E\u6587\u4EF6\u3002\u901A\u8FC7\u7EC8\u7AEF\u6253\u5370\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u4F60\u53EF\u4EE5\u627E\u5230\u95EE\u9898\u6587\u4EF6\u3002\u5BF9\u4E8E\u6E90\u7801\u6587\u4EF6\uFF0C\u63A8\u8350\u5C06\u7C7B\u578B\u95EE\u9898\u8FDB\u884C\u4FEE\u590D\uFF0C\u8FD9\u80FD\u591F\u66F4\u597D\u5730\u4F7F\u4F60\u7684\u5305\u5F97\u5230\u590D\u7528\u3002\u4F46\u5982\u679C\u9047\u5230\u4E09\u65B9\u5305\u7684\u7C7B\u578B\u68C0\u67E5\u95EE\u9898\uFF1A"]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\u5F00\u542F ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#skipLibCheck",target:"_blank",rel:"noopener noreferrer",children:"skipLibCheck"})," \u6765\u8DF3\u8FC7\u4E09\u65B9\u5305\u7684 d.ts \u68C0\u67E5\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u4E09\u65B9\u5305\u76F4\u63A5\u5BFC\u51FA ts \u6587\u4EF6\uFF0C skipLibCheck \u5C06\u4F1A\u5931\u6548\uFF0C\u56E0\u4E3A\u5176\u53EA\u80FD\u8DF3\u8FC7 d.ts \u68C0\u67E5\uFF0C\u56E0\u6B64\u4F60\u53EA\u80FD\u5173\u95ED ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsabortonerror",children:"dts.abortOnError"})," \u6765\u5FFD\u7565\u8FD9\u4E9B\u9519\u8BEF\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"bundle-dts-failed",children:["Bundle DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u76F4\u63A5\u4F7F\u7528 ",(0,r.jsx)(n.a,{href:"https://github.com/Swatinem/rollup-plugin-dts",target:"_blank",rel:"noopener noreferrer",children:"rollup-plugin-dts"})," \u6765\u6253\u5305\u4F60\u7684\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u3002\n",(0,r.jsx)(n.strong,{children:"\u5B83\u53EF\u80FD\u65E0\u6CD5\u5904\u7406\u67D0\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u9047\u5230 Modern.js Module \u6784\u5EFA\u8FC7\u7A0B\u4E2D\u51FA\u73B0 ",(0,r.jsx)(n.code,{children:"Bundle DTS failed"})," \u7684\u9519\u8BEF\u4FE1\u606F\u6807\u9898\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u89C2\u5BDF\u62A5\u9519\u4FE1\u606F\u662F\u6765\u81EA\u67D0\u4E2A\u7B2C\u4E09\u65B9\u4F9D\u8D56\u3002\u5C1D\u8BD5\u8BBE\u7F6E ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:(0,r.jsx)(n.code,{children:"dts.respectExternal"})})," \u4E3A ",(0,r.jsx)(n.code,{children:"false"})," \u6765\u5173\u95ED\u6253\u5305\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6\u7684\u884C\u4E3A\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",children:[(0,r.jsx)(n.code,{children:"defineConfig"})," \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A",(0,r.jsx)(n.code,{children:'\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B'}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u68C0\u67E5\u9879\u76EE\u7684 tsconfig.json \u6587\u4EF6\u4E2D\u662F\u5426\u5B58\u5728 ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#include",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"include"})})," \u914D\u7F6E\uFF0C\u5982\u679C\u6CA1\u6709\uFF0C\u5219\u5C1D\u8BD5\u589E\u52A0\u4E0B\u9762\u7684\u5185\u5BB9\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "include": ["src"]\n}\n'})}),"\n",(0,r.jsxs)(n.h2,{id:"\u5176\u4ED6",children:["\u5176\u4ED6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5176\u4ED6",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",children:["bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["bundleless \u662F\u5355\u6587\u4EF6\u7F16\u8BD1\u7684\u65B9\u5F0F\uFF0C\u53EA\u9700\u8981\u5C06\u4F60\u7684 less / scss \u6587\u4EF6\u4ECE\u5165\u53E3\u91CC\u79FB\u9664\u5E76\u4E14\u5C06\u5176\u62F7\u8D1D\u5230\u4EA7\u7269\u91CC\u5373\u53EF\u3002\n\u6CE8\u610F\u6211\u4EEC\u8FD8\u4F1A\u628A js \u5F15\u7528 less / scss \u7684 moduleId \u8FDB\u884C\u6539\u5199\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#redirect",children:"redirect"})," \u914D\u7F6E\u5173\u95ED\u5B83\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u8DF3\u8FC7 less \u6587\u4EF6\u5904\u7406\u7684\u4F8B\u5B50\uFF0C\u4F60\u4F1A\u53D1\u73B0 src \u91CC\u9762\u6240\u6709\u7684 less \u6587\u4EF6\u90FD\u88AB\u62F7\u8D1D\u5230 dist \u91CC\u5E76\u4E14\u4FDD\u7559\u4E86\u4E00\u81F4\u7684\u76F8\u5BF9\u8DEF\u5F84\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildType: 'bundleless',\n buildConfig: {\n input: ['src', '!src/**/*.less'],\n redirect: {\n style: false,\n },\n copy: {\n patterns: [\n {\n from: './**/*.less',\n to: './',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",children:["\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module \u57FA\u4E8E esbuild \u5B9E\u73B0\uFF0C\u56E0\u6B64\u5982\u679C\u6709\u7279\u6B8A\u9700\u6C42\u6216\u8005\u60F3\u8981\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B\uFF0C\u53EF\u4EE5\u901A\u8FC7\u5B9E\u73B0 esbuild \u63D2\u4EF6\u6765\u89E3\u51B3\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,r.jsx)(n.code,{children:"esbuildOptions"})})," \u914D\u7F6E\u5141\u8BB8\u4FEE\u6539 Modern.js Module \u5185\u90E8\u7684 esbuild \u914D\u7F6E\uFF0C\u56E0\u6B64\u53EF\u4EE5\u901A\u8FC7\u8BE5\u914D\u7F6E\u6765\u589E\u52A0\u81EA\u5B9A\u4E49\u7684 esbuild \u63D2\u4EF6\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,r.jsxs)(n.h3,{id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",children:["\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u65B9\u6848\u4E00\uFF1A",(0,r.jsx)(n.a,{href:"https://github.com/Quramy/typed-css-modules",target:"_blank",rel:"noopener noreferrer",children:"typed-css-modules"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u65B9\u6848\u4E8C\uFF1A",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/@guanghechen/postcss-modules-dts",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules-dts"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig(async () => {\n const { dts } = await import('@guanghechen/postcss-modules-dts');\n return {\n buildConfig: {\n style: {\n modules: { ...dts },\n },\n },\n // \u4F60\u7684\u81EA\u5B9A\u4E49\u914D\u7F6E\n };\n});\n"})})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fbuild.mdx"]={toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3}],title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/301.c0705076.js.LICENSE.txt b/modern-js/module-tools/static/js/async/187.5dd663d0.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/301.c0705076.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/187.5dd663d0.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1671.3ac95ef0.js b/modern-js/module-tools/static/js/async/1877.d5f98786.js similarity index 98% rename from modern-js/module-tools/static/js/async/1671.3ac95ef0.js rename to modern-js/module-tools/static/js/async/1877.d5f98786.js index ddfb86acb8..ac3f6853d1 100644 --- a/modern-js/module-tools/static/js/async/1671.3ac95ef0.js +++ b/modern-js/module-tools/static/js/async/1877.d5f98786.js @@ -1,2 +1,2 @@ -/*! For license information please see 1671.3ac95ef0.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1671"],{61778:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",pre:"pre",h3:"h3",div:"div",ul:"ul",li:"li"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"setup-\u51FD\u6570",children:["Setup \u51FD\u6570",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#setup-\u51FD\u6570",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728",(0,i.jsx)(n.a,{href:"/plugins/guide/plugin-object",children:"\u300C\u63D2\u4EF6\u5BF9\u8C61\u300D"})," \u90E8\u5206\u6211\u4EEC\u77E5\u9053\u63D2\u4EF6\u5BF9\u8C61\u5305\u542B\u4E86\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\uFF0C\u8BE5\u51FD\u6570\u4E0D\u4EC5\u5305\u542B\u4E86\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\uFF0C\u540C\u65F6\u8FD8\u53EF\u4EE5\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u63D2\u4EF6-api-\u5BF9\u8C61",children:["\u63D2\u4EF6 API \u5BF9\u8C61",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6-api-\u5BF9\u8C61",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u63D2\u4EF6\u7684 ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\u4F1A\u63D0\u4F9B\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\uFF0C\u4F60\u53EF\u4EE5\u8C03\u7528\u8BE5\u5BF9\u8C61\u4E0A\u63D0\u4F9B\u7684\u4E00\u4E9B\u65B9\u6CD5\u6765\u83B7\u53D6\u5230\u914D\u7F6E\u3001\u9879\u76EE\u4E0A\u4E0B\u6587\u7B49\u4FE1\u606F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup(api) {\n // \u83B7\u53D6\u5E94\u7528\u539F\u59CB\u914D\u7F6E\n const config = api.useConfigContext();\n // \u83B7\u53D6\u5E94\u7528\u8FD0\u884C\u4E0A\u4E0B\u6587\n const appContext = api.useAppContext();\n // \u83B7\u53D6\u89E3\u6790\u4E4B\u540E\u7684\u6700\u7EC8\u914D\u7F6E\n const resolvedConfig = api.useResolvedConfigContext();\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apiuseappcontext",children:[(0,i.jsx)(n.code,{children:"api.useAppContext"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseappcontext",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6\u9879\u76EE\u4E0A\u4E0B\u6587\u4FE1\u606F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const useAppContext: () => IAppContext;\n\ninterface IAppContext {\n appDirectory: string;\n configFile: string | false;\n packageName: string;\n nodeModulesDirectory: string;\n internalDirectory: string;\n plugins: {\n cli?: any;\n server?: any;\n }[];\n}\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u5B9E\u9645\u7684\u7C7B\u578B\u6587\u4EF6\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8FD8\u5B58\u5728\u4E00\u4E9B\u5176\u4ED6\u5B57\u6BB5\uFF0C\u4E0D\u8FC7\u76EE\u524D\u5BF9\u4E8E Modern.js Module \u6709\u610F\u4E49\u7684\u5B57\u6BB5\u53EA\u6709\u4EE5\u4E0A\u5185\u5BB9\uFF0Capi \u5BF9\u8C61\u5176\u4ED6\u7684\u65B9\u6CD5\u4E5F\u662F\u5982\u6B64\u3002"})})]}),"\n",(0,i.jsxs)(n.h3,{id:"apiuseresolvedconfigcontext",children:[(0,i.jsx)(n.code,{children:"api.useResolvedConfigContext"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseresolvedconfigcontext",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6\u89E3\u6790\u4E4B\u540E\u7684\u6700\u7EC8\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u83B7\u53D6\u6784\u5EFA\u76F8\u5173\u7684\u6700\u7EC8\u914D\u7F6E\uFF0C\u9700\u8981\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"beforeBuild"})," Hook\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const useResolvedConfigContext: () => NormalizedConfig;\n\ninterface NormalizedConfig {\n buildConfig: PartialBuildConfig;\n buildPreset: BuildPreset;\n dev: Dev;\n plugins: PluginConfig;\n runtime: RuntimeConfig;\n runtimeByEntries?: RuntimeByEntriesConfig;\n _raw: UserConfig;\n}\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apiusehookrunners",children:[(0,i.jsx)(n.code,{children:"api.useHookRunners"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiusehookrunners",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6 Hooks \u7684\u6267\u884C\u5668\uFF0C\u5E76\u89E6\u53D1\u7279\u5B9A\u7684 Hook \u6267\u884C\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin } from '@modern-js/core';\n\nexport const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n const hookRunners = api.useHookRunners();\n // \u89E6\u53D1 afterBuild Hook\n await hookRunners.afterBuild();\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u5F02\u6B65-setup",children:["\u5F02\u6B65 setup",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F02\u6B65-setup",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CLI \u63D2\u4EF6\u7684 setup \u53EF\u4EE5\u662F\u4E00\u4E2A\u5F02\u6B65\u51FD\u6570\uFF0C\u5728\u521D\u59CB\u5316\u8FC7\u7A0B\u4E2D\u6267\u884C\u5F02\u6B65\u903B\u8F91\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n await doSomething();\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF0C\u53EA\u6709\u5F53\u524D\u63D2\u4EF6\u7684 setup \u5F02\u6B65\u51FD\u6570\u6267\u884C\u5B8C\u6BD5\uFF0C\u624D\u4F1A\u7EE7\u7EED\u6267\u884C\u4E0B\u4E00\u4E2A\u63D2\u4EF6\u7684 setup \u51FD\u6570\u3002\u56E0\u6B64\uFF0C\u4F60\u9700\u8981\u907F\u514D\u5728 setup \u51FD\u6570\u4E2D\u8FDB\u884C\u8017\u65F6\u8FC7\u957F\u7684\u5F02\u6B65\u64CD\u4F5C\uFF0C\u9632\u6B62\u5F71\u54CD CLI \u542F\u52A8\u6027\u80FD\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",children:["\u751F\u547D\u5468\u671F\u94A9\u5B50",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u751F\u547D\u5468\u671F\u94A9\u5B50",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u77E5\u9053 ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\u4F1A\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\uFF0C\u6240\u8C13 Hooks \u5BF9\u8C61\u4E5F\u53EF\u4EE5\u7406\u89E3\u662F\u5177\u6709 Modern.js Module \u751F\u547D\u5468\u671F\u94A9\u5B50\u7684\u5BF9\u8C61\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u76EE\u524D\u4E3B\u8981\u5305\u542B\u4E24\u7C7B\u94A9\u5B50\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u6784\u5EFA\u6E90\u7801\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"buildPlatform"})," \u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u751F\u6210\u5176\u4ED6\u6784\u5EFA\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u8C03\u8BD5\u94A9\u5B50\uFF1A\u8FD0\u884C ",(0,i.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u65F6\u4F1A\u89E6\u53D1\u7684\u94A9\u5B50\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u4E8E\u751F\u547D\u5468\u671F\u94A9\u5B50\u7684\u5B8C\u6574\u5217\u8868\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"/api/plugin-api/plugin-hooks",children:"API \u6587\u6863"}),"\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fsetup-function.mdx"]={toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2}],title:"Setup \u51FD\u6570",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 1877.d5f98786.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1877"],{30085:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",pre:"pre",h3:"h3",div:"div",ul:"ul",li:"li"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"setup-\u51FD\u6570",children:["Setup \u51FD\u6570",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#setup-\u51FD\u6570",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728",(0,i.jsx)(n.a,{href:"/plugins/guide/plugin-object",children:"\u300C\u63D2\u4EF6\u5BF9\u8C61\u300D"})," \u90E8\u5206\u6211\u4EEC\u77E5\u9053\u63D2\u4EF6\u5BF9\u8C61\u5305\u542B\u4E86\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\uFF0C\u8BE5\u51FD\u6570\u4E0D\u4EC5\u5305\u542B\u4E86\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\uFF0C\u540C\u65F6\u8FD8\u53EF\u4EE5\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u63D2\u4EF6-api-\u5BF9\u8C61",children:["\u63D2\u4EF6 API \u5BF9\u8C61",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6-api-\u5BF9\u8C61",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u63D2\u4EF6\u7684 ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\u4F1A\u63D0\u4F9B\u4E00\u4E2A ",(0,i.jsx)(n.code,{children:"api"})," \u5BF9\u8C61\u53C2\u6570\uFF0C\u4F60\u53EF\u4EE5\u8C03\u7528\u8BE5\u5BF9\u8C61\u4E0A\u63D0\u4F9B\u7684\u4E00\u4E9B\u65B9\u6CD5\u6765\u83B7\u53D6\u5230\u914D\u7F6E\u3001\u9879\u76EE\u4E0A\u4E0B\u6587\u7B49\u4FE1\u606F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup(api) {\n // \u83B7\u53D6\u5E94\u7528\u539F\u59CB\u914D\u7F6E\n const config = api.useConfigContext();\n // \u83B7\u53D6\u5E94\u7528\u8FD0\u884C\u4E0A\u4E0B\u6587\n const appContext = api.useAppContext();\n // \u83B7\u53D6\u89E3\u6790\u4E4B\u540E\u7684\u6700\u7EC8\u914D\u7F6E\n const resolvedConfig = api.useResolvedConfigContext();\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apiuseappcontext",children:[(0,i.jsx)(n.code,{children:"api.useAppContext"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseappcontext",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6\u9879\u76EE\u4E0A\u4E0B\u6587\u4FE1\u606F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const useAppContext: () => IAppContext;\n\ninterface IAppContext {\n appDirectory: string;\n configFile: string | false;\n packageName: string;\n nodeModulesDirectory: string;\n internalDirectory: string;\n plugins: {\n cli?: any;\n server?: any;\n }[];\n}\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u5B9E\u9645\u7684\u7C7B\u578B\u6587\u4EF6\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8FD8\u5B58\u5728\u4E00\u4E9B\u5176\u4ED6\u5B57\u6BB5\uFF0C\u4E0D\u8FC7\u76EE\u524D\u5BF9\u4E8E Modern.js Module \u6709\u610F\u4E49\u7684\u5B57\u6BB5\u53EA\u6709\u4EE5\u4E0A\u5185\u5BB9\uFF0Capi \u5BF9\u8C61\u5176\u4ED6\u7684\u65B9\u6CD5\u4E5F\u662F\u5982\u6B64\u3002"})})]}),"\n",(0,i.jsxs)(n.h3,{id:"apiuseresolvedconfigcontext",children:[(0,i.jsx)(n.code,{children:"api.useResolvedConfigContext"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseresolvedconfigcontext",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6\u89E3\u6790\u4E4B\u540E\u7684\u6700\u7EC8\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u83B7\u53D6\u6784\u5EFA\u76F8\u5173\u7684\u6700\u7EC8\u914D\u7F6E\uFF0C\u9700\u8981\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"beforeBuild"})," Hook\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const useResolvedConfigContext: () => NormalizedConfig;\n\ninterface NormalizedConfig {\n buildConfig: PartialBuildConfig;\n buildPreset: BuildPreset;\n dev: Dev;\n plugins: PluginConfig;\n runtime: RuntimeConfig;\n runtimeByEntries?: RuntimeByEntriesConfig;\n _raw: UserConfig;\n}\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apiusehookrunners",children:[(0,i.jsx)(n.code,{children:"api.useHookRunners"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiusehookrunners",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u83B7\u53D6 Hooks \u7684\u6267\u884C\u5668\uFF0C\u5E76\u89E6\u53D1\u7279\u5B9A\u7684 Hook \u6267\u884C\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin } from '@modern-js/core';\n\nexport const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n const hookRunners = api.useHookRunners();\n // \u89E6\u53D1 afterBuild Hook\n await hookRunners.afterBuild();\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u5F02\u6B65-setup",children:["\u5F02\u6B65 setup",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F02\u6B65-setup",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CLI \u63D2\u4EF6\u7684 setup \u53EF\u4EE5\u662F\u4E00\u4E2A\u5F02\u6B65\u51FD\u6570\uFF0C\u5728\u521D\u59CB\u5316\u8FC7\u7A0B\u4E2D\u6267\u884C\u5F02\u6B65\u903B\u8F91\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n await doSomething();\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF0C\u53EA\u6709\u5F53\u524D\u63D2\u4EF6\u7684 setup \u5F02\u6B65\u51FD\u6570\u6267\u884C\u5B8C\u6BD5\uFF0C\u624D\u4F1A\u7EE7\u7EED\u6267\u884C\u4E0B\u4E00\u4E2A\u63D2\u4EF6\u7684 setup \u51FD\u6570\u3002\u56E0\u6B64\uFF0C\u4F60\u9700\u8981\u907F\u514D\u5728 setup \u51FD\u6570\u4E2D\u8FDB\u884C\u8017\u65F6\u8FC7\u957F\u7684\u5F02\u6B65\u64CD\u4F5C\uFF0C\u9632\u6B62\u5F71\u54CD CLI \u542F\u52A8\u6027\u80FD\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",children:["\u751F\u547D\u5468\u671F\u94A9\u5B50",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u751F\u547D\u5468\u671F\u94A9\u5B50",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u77E5\u9053 ",(0,i.jsx)(n.code,{children:"setup"})," \u51FD\u6570\u4F1A\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\uFF0C\u6240\u8C13 Hooks \u5BF9\u8C61\u4E5F\u53EF\u4EE5\u7406\u89E3\u662F\u5177\u6709 Modern.js Module \u751F\u547D\u5468\u671F\u94A9\u5B50\u7684\u5BF9\u8C61\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u76EE\u524D\u4E3B\u8981\u5305\u542B\u4E24\u7C7B\u94A9\u5B50\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u6784\u5EFA\u6E90\u7801\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"buildPlatform"})," \u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u751F\u6210\u5176\u4ED6\u6784\u5EFA\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u8C03\u8BD5\u94A9\u5B50\uFF1A\u8FD0\u884C ",(0,i.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u65F6\u4F1A\u89E6\u53D1\u7684\u94A9\u5B50\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u4E8E\u751F\u547D\u5468\u671F\u94A9\u5B50\u7684\u5B8C\u6574\u5217\u8868\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"/api/plugin-api/plugin-hooks",children:"API \u6587\u6863"}),"\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fsetup-function.mdx"]={toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2}],title:"Setup \u51FD\u6570",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2326.b310ad1d.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1877.d5f98786.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2326.b310ad1d.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1877.d5f98786.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/19.bb39e9ef.js b/modern-js/module-tools/static/js/async/19.bb39e9ef.js new file mode 100644 index 0000000000..28c77e8836 --- /dev/null +++ b/modern-js/module-tools/static/js/async/19.bb39e9ef.js @@ -0,0 +1,2 @@ +/*! For license information please see 19.bb39e9ef.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["19"],{14132:function(n,e,o){"use strict";o.r(e);var s=o("39980"),l=o("9580");function i(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",pre:"pre",h2:"h2",strong:"strong"},(0,l.ah)(),n.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(e.h1,{id:"\u63D2\u4EF6\u5BF9\u8C61",children:["\u63D2\u4EF6\u5BF9\u8C61",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u5BF9\u8C61",children:"#"})]}),"\n",(0,s.jsx)(e.p,{children:"Modern.js Module \u7684\u63D2\u4EF6\u662F\u4E00\u4E2A\u5BF9\u8C61\uFF0C\u5BF9\u8C61\u5305\u542B\u4EE5\u4E0B\u5C5E\u6027\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsxs)(e.li,{children:[(0,s.jsx)(e.code,{children:"name"}),"\uFF1A\u63D2\u4EF6\u7684\u540D\u79F0\uFF0C\u552F\u4E00\u6807\u8BC6\u7B26\u3002"]}),"\n",(0,s.jsxs)(e.li,{children:[(0,s.jsx)(e.code,{children:"setup"}),"\uFF1A\u63D2\u4EF6\u521D\u59CB\u5316\u51FD\u6570\uFF0C\u53EA\u4F1A\u6267\u884C\u4E00\u6B21\u3002setup \u51FD\u6570\u53EF\u4EE5\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\uFF0CModern.js Module \u4F1A\u5728\u7279\u5B9A\u7684\u65F6\u673A\u6267\u884C Hooks \u5BF9\u8C61\u4E0A\u5B9A\u4E49\u7684 Hook \u5BF9\u5E94\u7684\u51FD\u6570\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(e.p,{children:["\u4F8B\u5982\u5728\u4E0B\u9762\u7684\u63D2\u4EF6\u4EE3\u7801\u793A\u4F8B\u4E2D\uFF0C\u5728\u9879\u76EE\u5F00\u59CB\u6267\u884C\u6784\u5EFA\u4EFB\u52A1\u4E4B\u524D\u4F1A\u89E6\u53D1 ",(0,s.jsx)(e.code,{children:"beforeBuild"})," \u51FD\u6570\u7684\u6267\u884C\uFF0C\u5E76\u6253\u5370 ",(0,s.jsx)(e.code,{children:"build start"})," \u7684 log \u5185\u5BB9\u3002"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="./plugins/demo.tsx"',children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n return {\n // this is hook\n beforeBuild: () => {\n console.info('build start');\n },\n };\n },\n};\n"})}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { myPlugin } from './plugins/demo';\nexport default {\n plugins: [myPlugin()],\n};\n"})}),"\n",(0,s.jsxs)(e.h2,{id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",children:["\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",children:"#"})]}),"\n",(0,s.jsxs)(e.p,{children:["\u4F7F\u7528 TypeScript \u65F6\uFF0C\u53EF\u4EE5\u5F15\u5165\u5185\u7F6E\u7684 ",(0,s.jsx)(e.code,{children:"CliPlugin"})," \u548C ",(0,s.jsx)(e.code,{children:"ModuleTools"})," \u7C7B\u578B\uFF0C\u4E3A\u63D2\u4EF6\u63D0\u4F9B\u6B63\u786E\u7684\u7C7B\u578B\u63A8\u5BFC\uFF1A"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n const foo = '1';\n\n return {\n // this is hook\n afterBuild: () => {\n //...\n },\n };\n },\n};\n"})}),"\n",(0,s.jsxs)(e.h2,{id:"\u63D2\u4EF6\u914D\u7F6E\u9879",children:["\u63D2\u4EF6\u914D\u7F6E\u9879",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E\u9879",children:"#"})]}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.strong,{children:"\u5EFA\u8BAE\u5C06\u63D2\u4EF6\u5199\u6210\u51FD\u6570\u7684\u5F62\u5F0F"}),"\uFF0C\u4F7F\u63D2\u4EF6\u80FD\u901A\u8FC7\u51FD\u6570\u5165\u53C2\u6765\u63A5\u6536\u914D\u7F6E\u9879\uFF1A"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\ntype MyPluginOptions = {\n foo: string;\n};\n\nconst myPlugin = (options: MyPluginOptions): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n console.log(options.foo);\n },\n});\n"})})]})}function d(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,l.ah)(),n.components);return e?(0,s.jsx)(e,{...n,children:(0,s.jsx)(i,{...n})}):i(n)}e.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fplugin-object.mdx"]={toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2}],title:"\u63D2\u4EF6\u5BF9\u8C61",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2436.ca618e73.js.LICENSE.txt b/modern-js/module-tools/static/js/async/19.bb39e9ef.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2436.ca618e73.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/19.bb39e9ef.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4521.5a2181e6.js b/modern-js/module-tools/static/js/async/1960.b65fe81c.js similarity index 97% rename from modern-js/module-tools/static/js/async/4521.5a2181e6.js rename to modern-js/module-tools/static/js/async/1960.b65fe81c.js index ed509814aa..3c1fb0852b 100644 --- a/modern-js/module-tools/static/js/async/4521.5a2181e6.js +++ b/modern-js/module-tools/static/js/async/1960.b65fe81c.js @@ -1,2 +1,2 @@ -/*! For license information please see 4521.5a2181e6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4521"],{42563:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580"),l=s("23657");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",ol:"ol",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",strong:"strong"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"vue-\u63D2\u4EF6",children:["Vue \u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vue-\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Vue \u63D2\u4EF6\u63D0\u4F9B\u4E86\u5BF9 Vue 3 \u7EC4\u4EF6\u6784\u5EFA\u7684\u652F\u6301\uFF0C\u63D2\u4EF6\u5185\u90E8\u96C6\u6210\u4E86 ",(0,r.jsx)(n.a,{href:"https://github.com/pipe01/esbuild-plugin-vue3",target:"_blank",rel:"noopener noreferrer",children:"esbuild-plugin-vue3"})," \u548C ",(0,r.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"}),"\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsx)(n.p,{children:"\u8BF7\u6CE8\u610F\uFF0C\u6B64\u63D2\u4EF6\u4ECD\u6709\u4E00\u4E9B\u7528\u6CD5\u9650\u5236\uFF1A"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsx)(n.li,{children:"\u76EE\u524D\u6B64\u63D2\u4EF6\u7684\u5B9E\u73B0\u662F\u76F4\u63A5\u96C6\u6210\u793E\u533A\u63D2\u4EF6\uFF0C\u56E0\u6B64\u4E0D\u652F\u6301\u5728 sfc \u91CC\u5199 jsx/tsx\u3002"}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u8981\u4E3A\u7EC4\u4EF6\u751F\u6210 d.ts\uFF0C\u8BF7\u4F7F\u7528\u5B98\u65B9\u63A8\u8350\u65B9\u5F0F ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/vue-tsc",target:"_blank",rel:"noopener noreferrer",children:"vue-tsc"}),"\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u4EC5\u652F\u6301\u6253\u5305\u573A\u666F\uFF0C\u63A8\u8350\u5C06 input \u8BBE\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"['src/**/*.vue']"})," \u6216\u8005 ",(0,r.jsx)(n.code,{children:"['src/index.ts']"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,r.jsx)(l.SU,{command:"add @modern-js/plugin-module-vue -D"}),"\n",(0,r.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginVue } from '@modern-js/plugin-module-vue';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginVue()],\n buildConfig: {\n buildType: 'bundle',\n format: 'esm',\n input: ['src/index.vue'],\n dts: false,\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"vuejsxpluginoptions",children:["vueJsxPluginOptions",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vuejsxpluginoptions",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"Type:"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type VueJSXPluginOptions = {\n /** transform `on: { click: xx }` to `onClick: xxx` */\n transformOn?: boolean;\n /** enable optimization or not. */\n optimize?: boolean;\n /** merge static and dynamic class / style attributes / onXXX handlers */\n mergeProps?: boolean;\n /** configuring custom elements */\n isCustomElement?: (tag: string) => boolean;\n /** enable object slots syntax */\n enableObjectSlots?: boolean;\n /** Replace the function used when compiling JSX expressions */\n pragma?: string;\n};\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default:"})," ",(0,r.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4F20\u9012\u7ED9 ",(0,r.jsx)(n.code,{children:"@vue/babel-plugin-jsx"})," \u7684\u9009\u9879\uFF0C\u8BF7\u67E5\u9605 ",(0,r.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"})," \u6587\u6863 \u6765\u4E86\u89E3\u5177\u4F53\u7528\u6CD5\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-vue.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3}],title:"Vue \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 1960.b65fe81c.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1960"],{25351:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580"),l=s("23657");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",ol:"ol",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",strong:"strong"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"vue-\u63D2\u4EF6",children:["Vue \u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vue-\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Vue \u63D2\u4EF6\u63D0\u4F9B\u4E86\u5BF9 Vue 3 \u7EC4\u4EF6\u6784\u5EFA\u7684\u652F\u6301\uFF0C\u63D2\u4EF6\u5185\u90E8\u96C6\u6210\u4E86 ",(0,r.jsx)(n.a,{href:"https://github.com/pipe01/esbuild-plugin-vue3",target:"_blank",rel:"noopener noreferrer",children:"esbuild-plugin-vue3"})," \u548C ",(0,r.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"}),"\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsx)(n.p,{children:"\u8BF7\u6CE8\u610F\uFF0C\u6B64\u63D2\u4EF6\u4ECD\u6709\u4E00\u4E9B\u7528\u6CD5\u9650\u5236\uFF1A"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsx)(n.li,{children:"\u76EE\u524D\u6B64\u63D2\u4EF6\u7684\u5B9E\u73B0\u662F\u76F4\u63A5\u96C6\u6210\u793E\u533A\u63D2\u4EF6\uFF0C\u56E0\u6B64\u4E0D\u652F\u6301\u5728 sfc \u91CC\u5199 jsx/tsx\u3002"}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u8981\u4E3A\u7EC4\u4EF6\u751F\u6210 d.ts\uFF0C\u8BF7\u4F7F\u7528\u5B98\u65B9\u63A8\u8350\u65B9\u5F0F ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/vue-tsc",target:"_blank",rel:"noopener noreferrer",children:"vue-tsc"}),"\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u4EC5\u652F\u6301\u6253\u5305\u573A\u666F\uFF0C\u63A8\u8350\u5C06 input \u8BBE\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"['src/**/*.vue']"})," \u6216\u8005 ",(0,r.jsx)(n.code,{children:"['src/index.ts']"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,r.jsx)(l.SU,{command:"add @modern-js/plugin-module-vue -D"}),"\n",(0,r.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginVue } from '@modern-js/plugin-module-vue';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginVue()],\n buildConfig: {\n buildType: 'bundle',\n format: 'esm',\n input: ['src/index.vue'],\n dts: false,\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"vuejsxpluginoptions",children:["vueJsxPluginOptions",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#vuejsxpluginoptions",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"Type:"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type VueJSXPluginOptions = {\n /** transform `on: { click: xx }` to `onClick: xxx` */\n transformOn?: boolean;\n /** enable optimization or not. */\n optimize?: boolean;\n /** merge static and dynamic class / style attributes / onXXX handlers */\n mergeProps?: boolean;\n /** configuring custom elements */\n isCustomElement?: (tag: string) => boolean;\n /** enable object slots syntax */\n enableObjectSlots?: boolean;\n /** Replace the function used when compiling JSX expressions */\n pragma?: string;\n};\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default:"})," ",(0,r.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4F20\u9012\u7ED9 ",(0,r.jsx)(n.code,{children:"@vue/babel-plugin-jsx"})," \u7684\u9009\u9879\uFF0C\u8BF7\u67E5\u9605 ",(0,r.jsx)(n.a,{href:"https://github.com/vuejs/babel-plugin-jsx",target:"_blank",rel:"noopener noreferrer",children:"@vue/babel-plugin-jsx"})," \u6587\u6863 \u6765\u4E86\u89E3\u5177\u4F53\u7528\u6CD5\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-vue.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3}],title:"Vue \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3253.c0c5fd3c.js.LICENSE.txt b/modern-js/module-tools/static/js/async/1960.b65fe81c.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3253.c0c5fd3c.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/1960.b65fe81c.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/21.a800b490.js b/modern-js/module-tools/static/js/async/21.a800b490.js deleted file mode 100644 index eecfaea4a4..0000000000 --- a/modern-js/module-tools/static/js/async/21.a800b490.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 21.a800b490.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["21"],{93335:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-other.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2217.ff1da134.js b/modern-js/module-tools/static/js/async/2217.ff1da134.js deleted file mode 100644 index bb9b9a70d3..0000000000 --- a/modern-js/module-tools/static/js/async/2217.ff1da134.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2217.ff1da134.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2217"],{51963:function(e,o,r){"use strict";r.r(o);var n=r("39980"),s=r("9580");function d(e){let o=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",ul:"ul",li:"li",pre:"pre",ol:"ol",img:"img"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"storybook-\u76F8\u5173\u95EE\u9898",children:["Storybook \u76F8\u5173\u95EE\u9898",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,n.jsxs)(o.h2,{id:"\u652F\u6301-storybook-v7",children:["\u652F\u6301 Storybook v7",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u652F\u6301-storybook-v7",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook v7 \u76EE\u524D\u5DF2\u5168\u9762\u652F\u6301\u5E76\u5DF2\u6210\u4E3A\u6211\u4EEC\u7684\u63A8\u8350\u4F7F\u7528\u7248\u672C\u3002"}),"\n",(0,n.jsxs)(o.h2,{id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",children:["\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Modern.js Module \u76EE\u524D\u4F7F\u7528\u7684 Storybook \u7248\u672C\u662F v6\uFF0C\u5982\u679C\u4F7F\u7528\u4E86 v7 \u7248\u672C\u7684 Addon \u53EF\u80FD\u4F1A\u51FA\u73B0\u63D2\u4EF6\u4E0D\u751F\u6548\u7684\u60C5\u51B5\u3002"}),"\n",(0,n.jsxs)(o.p,{children:["\u9664\u4E86 Addon \u4EE5\u5916\uFF0C\u5176\u4ED6\u914D\u7F6E\u4E5F\u53EF\u80FD\u4F1A\u6709\u533A\u522B\u3002\u6BD4\u5982\u4FEE\u6539 ",(0,n.jsx)(o.code,{children:"preview.js"})," \u914D\u7F6E\u6587\u4EF6\u7684\u8BDD\uFF0CStorybook v6 \u4E0E v7 \u7684\u5199\u6CD5\u4E5F\u4E0D\u76F8\u540C\uFF1A"]}),"\n",(0,n.jsxs)(o.ul,{children:["\n",(0,n.jsxs)(o.li,{children:["v6\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/6.5/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u94FE\u63A5"})]}),"\n",(0,n.jsxs)(o.li,{children:["v7\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u94FE\u63A5"})]}),"\n"]}),"\n",(0,n.jsxs)(o.h2,{id:"cannot-find-module-react-dompackagejson",children:["Cannot find module 'react-dom/package.json",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-react-dompackagejson",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"\u5728\u6267\u884C Storybook \u8C03\u8BD5\u7684\u65F6\u5019\uFF0C\u51FA\u73B0\u4E0B\u9762\u7684\u62A5\u9519\u63D0\u793A\uFF1A"}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-bash",children:"ERR! Error: Cannot find module 'react-dom/package.json'\n"})}),"\n",(0,n.jsxs)(o.p,{children:["\u89E3\u51B3\u529E\u6CD5\uFF1A\u5728\u9879\u76EE\u4E2D\u5B89\u88C5 ",(0,n.jsx)(o.code,{children:"react-dom"})," \u4F9D\u8D56\u3002"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-json",children:'{\n "devDependencies": {\n "react-dom": "^17"\n }\n}\n'})}),"\n",(0,n.jsxs)(o.h2,{id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",children:["\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"\u89E3\u51B3\u529E\u6CD5\uFF1A"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["\u627E\u5230 ",(0,n.jsx)(o.code,{children:"@storybook/core-server/dist/cjs/dev-server.js"})]}),"\n",(0,n.jsxs)(o.li,{children:["\u627E\u5230 ",(0,n.jsx)(o.code,{children:"var _await$Promise$all = await Promise.all([preview, manager"})," \u8FD9\u9644\u8FD1\u7684\u4EE3\u7801\u3002"]}),"\n",(0,n.jsx)(o.li,{children:"\u4FEE\u6539\u6210\uFF1A"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"var _await$Promise$all = await Promise.all([\n preview.catch(e => console.info(e)),\n manager // TODO #13083 Restore this when compiling the preview is fast enough\n // .then((result) => {\n // if (!options.ci && !options.smokeTest) openInBrowser(address);\n // return result;\n // })\n .catch(previewBuilder.bail)]),\n _await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),\n previewResult = _await$Promise$all2[0],\n managerResult = _await$Promise$all2[1]; // TODO #13083 Remove this when compiling the preview is fast enough\n"})}),"\n",(0,n.jsxs)(o.h2,{id:"couldnt-find-any-stories-is-your-storybook",children:["Couldn't find any stories is your Storybook",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#couldnt-find-any-stories-is-your-storybook",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/screenshot-20230703-162111.png",alt:"storybook-error"})}),"\n",(0,n.jsx)(o.p,{children:"\u5F53\u5728\u9884\u89C8\u533A\u57DF\u770B\u5230\u7C7B\u4F3C\u8FD9\u6837\u7684\u62A5\u9519\u63D0\u793A\u7684\u65F6\u5019\uFF0C\u9996\u5148\u53EF\u4EE5\u6253\u5F00\u4E00\u4E0B\u6D4F\u89C8\u5668\u7684\u63A7\u5236\u53F0\uFF0C\u5E94\u8BE5\u4F1A\u6709\u4E9B\u62A5\u9519\u4FE1\u606F\u3002\u53EF\u4EE5\u5148\u6839\u636E\u62A5\u9519\u4FE1\u606F\u6765\u63A8\u65AD\u662F\u4E0D\u662F\u7F16\u5199\u4EE3\u7801\u91CC\u51FA\u73B0\u7684\u95EE\u9898\u5BFC\u81F4 Storybook \u65E0\u6CD5\u6B63\u5E38\u8FD0\u884C\u3002\u4FEE\u590D\u540E\uFF0C\u518D\u6B21\u5237\u65B0\u67E5\u770B\u662F\u5426\u6B63\u5E38\u3002"}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",children:["Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook \u6CA1\u6709\u63D0\u4F9B\u76F8\u5173\u65B9\u6848\uFF0C\u4E0D\u8FC7 Storybook Issue \u4E2D\u6709\u627E\u5230\u76F8\u5173\u7684\u89E3\u51B3\u529E\u6CD5\u3002\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\uFF1A"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["\u6DFB\u52A0 ",(0,n.jsx)(o.code,{children:"config/storybook/middleware.js"})," \u6587\u4EF6\uFF0C\u5E76\u521D\u59CB\u5316\u4E0B\u9762\u7684\u5185\u5BB9\uFF1A"]}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"/* eslint-disable filenames/match-exported */\nmodule.exports = function expressMiddleware(router) {\n // router is express router\n // import { Router } from 'express'\n // router = new Router();\n};\n"})}),"\n",(0,n.jsxs)(o.ol,{start:"2",children:["\n",(0,n.jsx)(o.li,{children:"\u6DFB\u52A0 http-proxy-middleware \u4F9D\u8D56"}),"\n",(0,n.jsx)(o.li,{children:"\u6DFB\u52A0\u4EE3\u7406\u8DEF\u7531\u76F8\u5173\u914D\u7F6E"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:'/* eslint-disable filenames/match-exported */\nconst { createProxyMiddleware } = require("http-proxy-middleware");\n\nmodule.exports = function expressMiddleware (router) {\n router.use(\'/api\', createProxyMiddleware({\n target: "http://localhost:8000",\n changeOrigin: true\n }))\n}\n'})}),"\n",(0,n.jsxs)(o.p,{children:["\u76F8\u5173 issue \u94FE\u63A5\uFF1A",(0,n.jsx)(o.a,{href:"https://github.com/storybookjs/storybook/issues/11551",target:"_blank",rel:"noopener noreferrer",children:"#11551"}),"\u3002"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}o.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fstorybook.mdx"]={toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2},{text:"Cannot find module 'react-dom/package.json",id:"cannot-find-module-react-dompackagejson",depth:2},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2}],title:"Storybook \u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2232.e0ecfc6e.js b/modern-js/module-tools/static/js/async/2232.e0ecfc6e.js deleted file mode 100644 index ff87bfc6d1..0000000000 --- a/modern-js/module-tools/static/js/async/2232.e0ecfc6e.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2232.e0ecfc6e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2232"],{98505:function(e,n,s){"use strict";s.r(n);var r=s("39980"),a=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",h2:"h2",strong:"strong",code:"code",pre:"pre",blockquote:"blockquote"},(0,a.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"versioning-and-publishing",children:["Versioning and Publishing",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#versioning-and-publishing",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"An npm-type module project release process consists of two phases."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The first phase is during development, where the developer needs to provide a change file to record changes that need to be released."}),"\n",(0,r.jsxs)(n.li,{children:["The second phase is during release, collect all the change files to update the version, update the release log, and release new packages to the ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module provides a set of version management and release solutions, which are suitable for single-package scenarios. For npm packages in monorepo, you need to follow the strategies provided by various monorepo solutions."}),"\n",(0,r.jsxs)(n.h2,{id:"tracking-changes",children:["Tracking changes",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tracking-changes",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Changes need to be logged when they happen to the project"}),". Changes that occur in a project are typically."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"New features"}),"\n",(0,r.jsx)(n.li,{children:"Fixes to issues"}),"\n",(0,r.jsx)(n.li,{children:"Configuration file changes"}),"\n",(0,r.jsx)(n.li,{children:"..."}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Once these changes have been made, the current changes need to be documented with the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-change",children:(0,r.jsx)(n.code,{children:"modern change"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Executing the ",(0,r.jsx)(n.code,{children:"modern change"})," command asks the developer several questions and generates a change log based on the developer's answers. The changelog file contains the type of change and its description, and is committed to the git repository."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern change\n\uD83E\uDD8B What kind of change is this for module-example? (current version is 0.1.0) - patch\n\uD83E\uDD8B Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor\n\uD83E\uDD8B Summary - publish test\n\uD83E\uDD8B === Releasing the following packages ===\n\uD83E\uDD8B [Patch]\n\uD83E\uDD8B module\n\uD83E\uDD8B Is this your desired changeset? (Y/n) - true\n\uD83E\uDD8B Changeset added! - you can now commit it\n\uD83E\uDD8B\n\uD83E\uDD8B If you want to modify or expand on the changeset summary, you can find it here\n\uD83E\uDD8B info /xxxxxx/module/.changeset/brave-dryers-agree.md\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When executed successfully, the resulting Markdown file containing the change log is saved in the project's ",(0,r.jsx)(n.code,{children:".changeset"})," directory. The contents will look like the following."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-markdown",meta:'title=".changeset/brave-dryers-agree.md"',children:"---\n\"``module-example'': patch\n---\n\npublish test\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"version-update",children:["Version update",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#version-update",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When the project version needs to be updated, execute the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-bump",children:(0,r.jsx)(n.code,{children:"modern bump"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Executing ",(0,r.jsx)(n.code,{children:"modern bump"})," will modify the version number in ",(0,r.jsx)(n.code,{children:"package.json"})," based on the contents of the Markdown file in the ",(0,r.jsx)(n.code,{children:".changeset/"})," directory where the changes were recorded, and generate the ",(0,r.jsx)(n.code,{children:"CHANGELOG.md"})," file. ",(0,r.jsx)(n.strong,{children:'These Markdown files are also deleted when the version update is complete, so they are "consumed "'}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-markdown",meta:'title="CHANGELOG.md"',children:"# module\n\n## 0.1.1\n\n### Patch Changes\n\n- publish test\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"publish",children:["Publish",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#publish",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"To publish a project, you can execute the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-release",children:(0,r.jsx)(n.code,{children:"modern publish"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"modern release"})," command publishes the project to the npm Registry."]}),"\n",(0,r.jsxs)(n.p,{children:["The release is the ",(0,r.jsx)(n.code,{children:"latest"})," version, which is also the official version. If you want to change the ",(0,r.jsx)(n.code,{children:"dist-tag"}),", you can specify it with the ",(0,r.jsx)(n.code,{children:"modern release --tag"})," command. For example."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"modern release --tag beta\n"})}),"\n",(0,r.jsxs)(n.p,{children:["However, if you want to change the version number of the current project to a pre-release as well, you need to use the ",(0,r.jsx)(n.code,{children:"modern pre"})," command."]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"dist-tag"})," can be understood as: tagging the current release. Generally speaking, the ",(0,r.jsx)(n.code,{children:"dist-tag"})," for the default release is ",(0,r.jsx)(n.code,{children:"latest"}),", so you can consider ",(0,r.jsx)(n.code,{children:"latest"})," as the ",(0,r.jsx)(n.code,{children:"dist-tag"})," for the official release."]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"pre-releases",children:["Pre-releases",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pre-releases",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When a pre-release is needed before the official release, the following command is executed."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-pre",children:(0,r.jsx)(n.code,{children:"modern pre"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["First ",(0,r.jsx)(n.code,{children:"modern pre enter "})," to enter pre-release mode, ",(0,r.jsx)(n.code,{children:""})," can be the same as the ",(0,r.jsx)(n.code,{children:"tag"})," specified with the ",(0,r.jsx)(n.code,{children:"modern release --tag"})," command when releasing the project."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern pre enter next\n\uD83E\uDD8B success Entered pre mode with tag next\n\uD83E\uDD8B info Run `changeset version` to version packages with prerelease versions\n\u2728 Done in 5.30s.\nDone in 5.30s.\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Then you can update the specific version number with the ",(0,r.jsx)(n.code,{children:"modern bump"})," command, ",(0,r.jsx)(n.strong,{children:'which doesn\'t actually "consume" the Markdown file that records the changes'}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern bump\n\uD83E\uDD8B warn ===============================IMPORTANT!===============================\n\uD83E\uDD8B warn You are in prerelease mode\n\uD83E\uDD8B warn If you meant to do a normal release you should revert these changes and run `changeset pre exit`\n\uD83E\uDD8B warn You can then run `changeset version` again to do a normal release\n\uD83E\uDD8B warn ----------------------------------------------------------------------\n\uD83E\uDD8B All files have been updated. review them and commit at your leisure\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Then you can see that the updated version number in ",(0,r.jsx)(n.code,{children:"package.json"})," will look like this: ",(0,r.jsx)(n.code,{children:"0.1.2-next.0"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Finally, ",(0,r.jsxs)(n.strong,{children:["if you don't need to do a pre-release anymore, be sure to run the ",(0,r.jsx)(n.code,{children:"modern pre exit"})," command"]})," to exit the pre-release state and to release the official version when you run the ",(0,r.jsx)(n.code,{children:"modern bump"})," command again."]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,a.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fpublish-your-project.mdx"]={toc:[{text:"Tracking changes",id:"tracking-changes",depth:2},{text:"Version update",id:"version-update",depth:2},{text:"Publish",id:"publish",depth:2},{text:"Pre-releases",id:"pre-releases",depth:2}],title:"Versioning and Publishing",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2259.dd01802f.js b/modern-js/module-tools/static/js/async/2259.dd01802f.js new file mode 100644 index 0000000000..66625b104b --- /dev/null +++ b/modern-js/module-tools/static/js/async/2259.dd01802f.js @@ -0,0 +1,2 @@ +/*! For license information please see 2259.dd01802f.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2259"],{79592:function(e,n,o){"use strict";o.r(n);var r=o("39980"),d=o("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",strong:"strong",h2:"h2",div:"div",pre:"pre"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"using-the-microgenerator",children:["Using the Microgenerator",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-the-microgenerator",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module provides the Microgenerator tool, which allows for the current project to."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"add new directories and files"}),"\n",(0,r.jsxs)(n.li,{children:["Modify the contents of the ",(0,r.jsx)(n.code,{children:"package.json"})," file"]}),"\n",(0,r.jsx)(n.li,{children:"Execute commands"}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Thus with these capabilities, ",(0,r.jsx)(n.strong,{children:"Microgenerator can enable additional feature functionality for the project"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["The microgenerator can be started via ",(0,r.jsx)(n.a,{href:"/guide/basic/command-preview",children:(0,r.jsx)(n.code,{children:"modern new"})}),". The current Microgenerator features supported by the Modern.js Module are:"]}),"\n",(0,r.jsxs)(n.h2,{id:"develop-module-doc",children:["Develop Module Doc",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#develop-module-doc",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["When we want to write documentation for out module project, we can enable the module doc feature. ",(0,r.jsxs)(n.strong,{children:["will create ",(0,r.jsx)(n.code,{children:"docs"})," directory and related files in the project directory, and add ",(0,r.jsx)(n.code,{children:'"@modern-js/plugin-rspress"'})," dependency"]})," in package.json.\nUse ",(0,r.jsx)(n.code,{children:"modern dev"})," and ",(0,r.jsx)(n.code,{children:"modern build --platform"})," to debug and build your doc site."]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsx)(n.p,{children:"After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginDoc()],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"storybook",children:["Storybook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.strong,{children:"Storybook feature"})," can be enabled when we want to debug a component or a common module. When this feature is enabled, ",(0,r.jsxs)(n.strong,{children:["the ",(0,r.jsx)(n.code,{children:"stories"})," directory and ",(0,r.jsx)(n.code,{children:".storybook"})," directory are created in the project directory, and a new ",(0,r.jsx)(n.code,{children:'"@modern-js/storybook"'})," dependency is added to package.json"]}),". Use ",(0,r.jsx)(n.code,{children:"storybook dev"})," and ",(0,r.jsx)(n.code,{children:"storybook build"})," to debug and build."]}),"\n",(0,r.jsxs)(n.h2,{id:"tailwind-css-support",children:["Tailwind CSS Support",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-support",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles."]}),"\n",(0,r.jsxs)(n.p,{children:["If you want to use Tailwind CSS for a project, you can refer to ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/module-tools/guide/best-practices/components.html#tailwind-css",target:"_blank",rel:"noopener noreferrer",children:'"Using Tailwind CSS"'}),"."]}),"\n",(0,r.jsxs)(n.h2,{id:"modernjs-runtime-api",children:["Modern.js Runtime API",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-runtime-api",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Modern.js provides Runtime API capabilities that can only be used in the Modern.js application project environment"}),". If you need to develop a component for use in a Modern.js application environment, then you can turn on this feature and the microgenerator will add the ",(0,r.jsx)(n.code,{children:'"@modern-js/runtime"'})," dependency."]}),"\n",(0,r.jsx)(n.p,{children:"Also, the Storybook debugging tool will determine if the project needs to use the Runtime API by checking the project's dependencies and providing the same Runtime API runtime environment as the Modern.js application project."}),"\n",(0,r.jsx)(n.p,{children:":::tip\nAfter successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport runtime from '@modern-js/runtime/cli';\n\nexport default defineConfig({\n plugins: [moduleTools(), runtime()],\n});\n"})}),"\n"]})]})]})}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fuse-micro-generator.md"]={toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2},{text:"Storybook",id:"storybook",depth:2},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2}],title:"Using the Microgenerator",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2458.bd7972f4.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2259.dd01802f.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2458.bd7972f4.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2259.dd01802f.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2263.7762b818.js b/modern-js/module-tools/static/js/async/2263.7762b818.js new file mode 100644 index 0000000000..8351a34347 --- /dev/null +++ b/modern-js/module-tools/static/js/async/2263.7762b818.js @@ -0,0 +1,2 @@ +/*! For license information please see 2263.7762b818.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2263"],{73855:function(e,n,i){"use strict";i.r(n);var l=i("39980"),s=i("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul"},(0,s.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"quick-start",children:["Quick Start",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"Modern.js Module not only provides a rich set of features, but also supports extending the capabilities of the current project by way of plugins."}),"\n",(0,l.jsx)(n.p,{children:"We can quickly see how to write a Modern.js Module plugin by using the following example."}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsxs)(n.li,{children:["First we create ",(0,l.jsx)(n.code,{children:". /plugins/example.ts"})," file under the initialized project."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-md",meta:'title=". /project"',children:". /project .\n\u251C\u2500\u2500 plugins\n\u2502 \u2514\u2500\u2500 example.ts\n\u251C\u2500\u2500 src/\n\u2514\u2500\u2500 modern.config.ts\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"2",children:["\n",(0,l.jsxs)(n.li,{children:["Next add the code for the plugin to the ",(0,l.jsx)(n.code,{children:"example.ts"})," file."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nexport const ExamplePlugin = (): CliPlugin => {\n return {\n name: 'example',\n setup() {\n console.info('this is example plugin');\n return {\n // use hooks\n afterBuild() {\n console.info('build over');\n },\n };\n },\n };\n};\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"3",children:["\n",(0,l.jsxs)(n.li,{children:["Then we register the plugin we just wrote via the ",(0,l.jsx)(n.a,{href:"/en/api/config/plugins",children:(0,l.jsx)(n.code,{children:"plugins"})})," API."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",meta:'title=". /modern.config.ts"',children:"import { examplePlugin } from '. /plugins/example';\nexport default defineConfig({\n plugins: [examplePlugin()],\n});\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"4",children:["\n",(0,l.jsxs)(n.li,{children:["Finally, run ",(0,l.jsx)(n.code,{children:"modern build"})," and you will see:"]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",meta:'title="terminal"',children:"This is example plugin\nBuild succeed: 510.684ms\nbuild over\n"})}),"\n",(0,l.jsx)(n.p,{children:"With the above example, we learned the following things."}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"The recommended plugin directory structure"}),"\n",(0,l.jsx)(n.li,{children:"The initialization code of the plugin"}),"\n",(0,l.jsx)(n.li,{children:"Plugin registration"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"In addition to the above, we also need to understand."}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.a,{href:"/en/plugins/guide/plugin-object",children:"plugin objects, type definitions and recommended configuration options"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.a,{href:"/en/plugins/guide/setup-function",children:["setup functions, ",(0,l.jsx)(n.code,{children:"api"})," object parameters, lifecycle hooks"]})}),"\n"]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(t,{...e})}):t(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fgetting-started.mdx"]={toc:[],title:"Quick Start",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/2509.0fc92784.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2263.7762b818.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/2509.0fc92784.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2263.7762b818.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2326.b310ad1d.js b/modern-js/module-tools/static/js/async/2326.b310ad1d.js deleted file mode 100644 index 65be95001a..0000000000 --- a/modern-js/module-tools/static/js/async/2326.b310ad1d.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2326.b310ad1d.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2326"],{65560:function(o,t,e){"use strict";e.r(t);var n=e("39980"),s=e("9580");function _(o){return(0,n.jsx)(n.Fragment,{})}function r(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),o.components);return t?(0,n.jsx)(t,{...o,children:(0,n.jsx)(_,{...o})}):_(o)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-storybook.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/240.756b04db.js b/modern-js/module-tools/static/js/async/240.756b04db.js deleted file mode 100644 index a3afeb97fe..0000000000 --- a/modern-js/module-tools/static/js/async/240.756b04db.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 240.756b04db.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["240"],{76107:function(e,n,s){"use strict";s.r(n);var r=s("39980"),t=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",strong:"strong",code:"code",h3:"h3",div:"div",pre:"pre",em:"em",h2:"h2"},(0,t.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"buildpreset",children:["buildPreset",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildpreset",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"A build preset string or preset function. Provides out-of-the-box build configuration"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Type"}),": ",(0,r.jsx)(n.code,{children:"string | Function"})]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"npm-library",children:[(0,r.jsx)(n.code,{children:"npm-library"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Library generic schema used under class ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," package manager, contains ",(0,r.jsx)(n.code,{children:"esm"})," and ",(0,r.jsx)(n.code,{children:"cjs"})," bundle artifacts, and includes a type file."]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive info",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsxs)(n.p,{children:["About the class ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," Package Manager"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.npmjs.com",target:"_blank",rel:"noopener noreferrer",children:"npm"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"yarn"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})}),"\n"]}),"\n"]})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts"\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"The build configuration corresponding to the preset string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"npm-library-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-library-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Used under class ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," package manager, and Library supports a similar pattern to ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"}),". Additional ",(0,r.jsx)(n.code,{children:"umd"})," artifacts are provided on top of the pre-defined ",(0,r.jsx)(n.code,{children:"npm-library"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"The build configuration corresponding to the preset string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"npm-component",children:[(0,r.jsx)(n.code,{children:"npm-component"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["A generic pattern for components (libraries) used under the class ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," package manager. Contains both ",(0,r.jsx)(n.code,{children:"esm"})," and ",(0,r.jsx)(n.code,{children:"cjs"})," Bundleless artifacts (for easy ",(0,r.jsx)(n.em,{children:(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/zh-CN/docs/Glossary/Tree_shaking",target:"_blank",rel:"noopener noreferrer",children:"Tree shaking"})})," optimization), as well as including a copy of the type file."]}),"\n",(0,r.jsx)(n.p,{children:"For style files included in the source code, the artifacts provide the compiled files of the style and the source file of the style."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"The pre-defined strings correspond to the build configuration."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"npm-component-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-component-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Component (library) used under class ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," package manager, with support for class ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"})," schema. Additional ",(0,r.jsx)(n.code,{children:"umd"})," artifacts are provided on top of the pre-defined ",(0,r.jsx)(n.code,{children:"npm-component"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n}\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"npm-library-es5esnext",children:[(0,r.jsx)(n.code,{children:"npm-library-{es5...esnext}"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-es5esnext",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["When you want to use a ",(0,r.jsx)(n.code,{children:"buildPreset"})," preset that supports other ECMAScript versions, you can directly add the supported versions to the ",(0,r.jsx)(n.code,{children:"'npm-library'"}),", ",(0,r.jsx)(n.code,{children:"'npm-library-with-umd'"}),", ",(0,r.jsx)(n.code,{children:"'npm-component'"}),", ",(0,r.jsx)(n.code,{children:"'npm-component-with-umd'"})," presets."]}),"\n",(0,r.jsxs)(n.p,{children:["For example, if you want the ",(0,r.jsx)(n.code,{children:"'npm-library'"})," preset to support ",(0,r.jsx)(n.code,{children:"'es2017'"}),", you can configure it as follows."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset: 'npm-library-es2017',\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"string--function",children:["string / function",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#string--function",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"The buildPreset not only supports basic string forms, but also function forms, which can obtain the default values we provide through the preset or extend Preset parameter and then modify them."}),"\n",(0,r.jsx)(n.p,{children:"Here are two examples using preset and extend Preset:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ preset }) {\n const { NPM_LIBRARY } = preset;\n return NPM_LIBRARY.map(config => {\n config.define = {\n VERSION: '1.0.1',\n };\n return config;\n });\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["In the ",(0,r.jsx)(n.code,{children:"extend Preset"}),", lodash.merge is used for configuration merge."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ extendPreset }) {\n return extendPreset('npm-library', {\n define: {\n VERSION: '1.0.1',\n },\n });\n },\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Fbuild-preset.mdx"]={toc:[{text:"`npm-library`",id:"npm-library",depth:3},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:3},{text:"`npm-component`",id:"npm-component",depth:3},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:3},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:3},{text:"string / function",id:"string--function",depth:2}],title:"buildPreset",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5575.ce4d4add.js b/modern-js/module-tools/static/js/async/2414.362edd76.js similarity index 98% rename from modern-js/module-tools/static/js/async/5575.ce4d4add.js rename to modern-js/module-tools/static/js/async/2414.362edd76.js index 2e3c509d6c..50abec8ab8 100644 --- a/modern-js/module-tools/static/js/async/5575.ce4d4add.js +++ b/modern-js/module-tools/static/js/async/2414.362edd76.js @@ -1,2 +1,2 @@ -/*! For license information please see 5575.ce4d4add.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5575"],{32053:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",strong:"strong",h2:"h2",div:"div",pre:"pre"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",children:["\u4F7F\u7528\u5FAE\u751F\u6210\u5668",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5FAE\u751F\u6210\u5668",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86\u5FAE\u751F\u6210\u5668\u5DE5\u5177\uFF0C\u5B83\u53EF\u4EE5\u4E3A\u5F53\u524D\u9879\u76EE\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u65B0\u589E\u76EE\u5F55\u548C\u6587\u4EF6"}),"\n",(0,s.jsxs)(n.li,{children:["\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"package.json"})]}),"\n",(0,s.jsx)(n.li,{children:"\u6267\u884C\u547D\u4EE4"}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u56E0\u6B64\u901A\u8FC7\u8FD9\u4E9B\u80FD\u529B\uFF0C",(0,s.jsx)(n.strong,{children:"\u5FAE\u751F\u6210\u5668\u53EF\u4EE5\u4E3A\u9879\u76EE\u5F00\u542F\u989D\u5916\u7684\u7279\u6027\u529F\u80FD"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.a,{href:"/guide/basic/command-preview",children:(0,s.jsx)(n.code,{children:"modern new"})})," \u542F\u52A8\u5FAE\u751F\u6210\u5668\u3002\u76EE\u524D Modern.js Module \u652F\u6301\u7684\u5FAE\u751F\u6210\u5668\u529F\u80FD\u6709\uFF1A"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:["\u5F00\u53D1\u6A21\u5757\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u60F3\u8981\u4E3A\u6A21\u5757\u7F16\u5199\u6587\u6863\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u542F\u7528\u6A21\u5757\u6587\u6863\u529F\u80FD\u3002",(0,s.jsxs)(n.strong,{children:["\u4F1A\u5728\u9879\u76EE\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"docs"})," \u76EE\u5F55\u4EE5\u53CA\u76F8\u5173\u6587\u4EF6\uFF0C\u5728 package.json \u4E2D\u65B0\u589E ",(0,s.jsx)(n.code,{children:'"@modern-js/plugin-rspress"'})," \u4F9D\u8D56"]}),"\u3002\n\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern dev"})," \u548C ",(0,s.jsx)(n.code,{children:"modern build --platform"})," \u6765\u8C03\u8BD5\u548C\u6784\u5EFA\u4F60\u7684\u6587\u6863\u7AD9\u70B9\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5728\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F1A\u63D0\u793A\u9700\u8981\u624B\u52A8\u5728\u914D\u7F6E\u4E2D\u589E\u52A0\u5982\u4E0B\u7C7B\u4F3C\u7684\u4EE3\u7801\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginDoc()],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"storybook-\u8C03\u8BD5",children:["Storybook \u8C03\u8BD5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u8C03\u8BD5",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u60F3\u8981\u5BF9\u7EC4\u4EF6\u6216\u8005\u666E\u901A\u6A21\u5757\u8FDB\u884C\u8C03\u8BD5\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u542F\u7528 Storybook \u8C03\u8BD5\u529F\u80FD\u3002\u542F\u52A8\u8BE5\u529F\u80FD\u540E\uFF0C",(0,s.jsxs)(n.strong,{children:["\u4F1A\u5728\u9879\u76EE\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"stories"})," \u76EE\u5F55\u4EE5\u53CA ",(0,s.jsx)(n.code,{children:".storybook"})," \u76EE\u5F55\uFF0C\u5728 package.json \u4E2D\u65B0\u589E ",(0,s.jsx)(n.code,{children:'"@modern-js/storybook"'})," \u4F9D\u8D56"]}),"\u3002\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"storybook dev"})," \u548C ",(0,s.jsx)(n.code,{children:"storybook build"})," \u6765\u8C03\u8BD5\u548C\u6784\u5EFA\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"tailwind-css-\u652F\u6301",children:["Tailwind CSS \u652F\u6301",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-\u652F\u6301",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u662F\u4E00\u4E2A\u4EE5 Utility Class \u4E3A\u57FA\u7840\u7684 CSS \u6846\u67B6\u548C\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u53EF\u4EE5\u5FEB\u901F\u5730\u4E3A\u7EC4\u4EF6\u6DFB\u52A0\u5E38\u7528\u6837\u5F0F\uFF0C\u540C\u65F6\u652F\u6301\u4E3B\u9898\u6837\u5F0F\u7684\u7075\u6D3B\u6269\u5C55\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u60F3\u8981\u5728\u9879\u76EE\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"\uFF0C\u53EF\u4EE5\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://modernjs.dev/module-tools/guide/best-practices/components.html#tailwind-css",target:"_blank",rel:"noopener noreferrer",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"}),"\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"modernjs-runtime-api-\u652F\u6301",children:["Modern.js Runtime API \u652F\u6301",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-runtime-api-\u652F\u6301",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["Modern.js \u63D0\u4F9B\u4E86 ",(0,s.jsx)(n.a,{href:"https://modernjs.dev/configure/app/runtime/intro",target:"_blank",rel:"noopener noreferrer",children:"Runtime API"})," \u80FD\u529B\uFF0C\u8FD9\u4E9B API \u53EA\u80FD\u5728 Modern.js \u7684\u5E94\u7528\u9879\u76EE\u73AF\u5883\u4E2D\u4F7F\u7528"]}),"\u3002\u5982\u679C\u4F60\u9700\u8981\u5F00\u53D1\u4E00\u4E2A Modern.js \u5E94\u7528\u73AF\u5883\u4E2D\u4F7F\u7528\u7684\u7EC4\u4EF6\uFF0C\u90A3\u4E48\u4F60\u53EF\u4EE5\u5F00\u542F\u8BE5\u7279\u6027\uFF0C\u5FAE\u751F\u6210\u5668\u4F1A\u589E\u52A0 ",(0,s.jsx)(n.code,{children:'"@modern-js/runtime"'}),"\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u53E6\u5916\uFF0CStorybook \u8C03\u8BD5\u5DE5\u5177\u4E5F\u4F1A\u901A\u8FC7\u68C0\u6D4B\u9879\u76EE\u7684\u4F9D\u8D56\u786E\u5B9A\u9879\u76EE\u662F\u5426\u9700\u8981\u4F7F\u7528 Runtime API\uFF0C\u5E76\u4E14\u63D0\u4F9B\u4E0E Modern.js \u5E94\u7528\u9879\u76EE\u4E00\u6837\u7684 Runtime API \u8FD0\u884C\u73AF\u5883\u3002"}),"\n",(0,s.jsx)(n.p,{children:":::tip\n\u5728\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F1A\u63D0\u793A\u9700\u8981\u624B\u52A8\u5728\u914D\u7F6E\u4E2D\u589E\u52A0\u5982\u4E0B\u7C7B\u4F3C\u7684\u4EE3\u7801\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport runtime from '@modern-js/runtime/cli';\n\nexport default defineConfig({\n plugins: [moduleTools(), runtime()],\n});\n"})}),"\n"]})]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fuse-micro-generator.md"]={toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2}],title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file +/*! For license information please see 2414.362edd76.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2414"],{44069:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",strong:"strong",h2:"h2",div:"div",pre:"pre"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",children:["\u4F7F\u7528\u5FAE\u751F\u6210\u5668",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5FAE\u751F\u6210\u5668",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86\u5FAE\u751F\u6210\u5668\u5DE5\u5177\uFF0C\u5B83\u53EF\u4EE5\u4E3A\u5F53\u524D\u9879\u76EE\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u65B0\u589E\u76EE\u5F55\u548C\u6587\u4EF6"}),"\n",(0,s.jsxs)(n.li,{children:["\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"package.json"})]}),"\n",(0,s.jsx)(n.li,{children:"\u6267\u884C\u547D\u4EE4"}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u56E0\u6B64\u901A\u8FC7\u8FD9\u4E9B\u80FD\u529B\uFF0C",(0,s.jsx)(n.strong,{children:"\u5FAE\u751F\u6210\u5668\u53EF\u4EE5\u4E3A\u9879\u76EE\u5F00\u542F\u989D\u5916\u7684\u7279\u6027\u529F\u80FD"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.a,{href:"/guide/basic/command-preview",children:(0,s.jsx)(n.code,{children:"modern new"})})," \u542F\u52A8\u5FAE\u751F\u6210\u5668\u3002\u76EE\u524D Modern.js Module \u652F\u6301\u7684\u5FAE\u751F\u6210\u5668\u529F\u80FD\u6709\uFF1A"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:["\u5F00\u53D1\u6A21\u5757\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u60F3\u8981\u4E3A\u6A21\u5757\u7F16\u5199\u6587\u6863\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u542F\u7528\u6A21\u5757\u6587\u6863\u529F\u80FD\u3002",(0,s.jsxs)(n.strong,{children:["\u4F1A\u5728\u9879\u76EE\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"docs"})," \u76EE\u5F55\u4EE5\u53CA\u76F8\u5173\u6587\u4EF6\uFF0C\u5728 package.json \u4E2D\u65B0\u589E ",(0,s.jsx)(n.code,{children:'"@modern-js/plugin-rspress"'})," \u4F9D\u8D56"]}),"\u3002\n\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern dev"})," \u548C ",(0,s.jsx)(n.code,{children:"modern build --platform"})," \u6765\u8C03\u8BD5\u548C\u6784\u5EFA\u4F60\u7684\u6587\u6863\u7AD9\u70B9\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5728\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F1A\u63D0\u793A\u9700\u8981\u624B\u52A8\u5728\u914D\u7F6E\u4E2D\u589E\u52A0\u5982\u4E0B\u7C7B\u4F3C\u7684\u4EE3\u7801\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginDoc()],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"storybook-\u8C03\u8BD5",children:["Storybook \u8C03\u8BD5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u8C03\u8BD5",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u60F3\u8981\u5BF9\u7EC4\u4EF6\u6216\u8005\u666E\u901A\u6A21\u5757\u8FDB\u884C\u8C03\u8BD5\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u542F\u7528 Storybook \u8C03\u8BD5\u529F\u80FD\u3002\u542F\u52A8\u8BE5\u529F\u80FD\u540E\uFF0C",(0,s.jsxs)(n.strong,{children:["\u4F1A\u5728\u9879\u76EE\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"stories"})," \u76EE\u5F55\u4EE5\u53CA ",(0,s.jsx)(n.code,{children:".storybook"})," \u76EE\u5F55\uFF0C\u5728 package.json \u4E2D\u65B0\u589E ",(0,s.jsx)(n.code,{children:'"@modern-js/storybook"'})," \u4F9D\u8D56"]}),"\u3002\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"storybook dev"})," \u548C ",(0,s.jsx)(n.code,{children:"storybook build"})," \u6765\u8C03\u8BD5\u548C\u6784\u5EFA\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"tailwind-css-\u652F\u6301",children:["Tailwind CSS \u652F\u6301",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-\u652F\u6301",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u662F\u4E00\u4E2A\u4EE5 Utility Class \u4E3A\u57FA\u7840\u7684 CSS \u6846\u67B6\u548C\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u53EF\u4EE5\u5FEB\u901F\u5730\u4E3A\u7EC4\u4EF6\u6DFB\u52A0\u5E38\u7528\u6837\u5F0F\uFF0C\u540C\u65F6\u652F\u6301\u4E3B\u9898\u6837\u5F0F\u7684\u7075\u6D3B\u6269\u5C55\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u60F3\u8981\u5728\u9879\u76EE\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"\uFF0C\u53EF\u4EE5\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://modernjs.dev/module-tools/guide/best-practices/components.html#tailwind-css",target:"_blank",rel:"noopener noreferrer",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"}),"\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"modernjs-runtime-api-\u652F\u6301",children:["Modern.js Runtime API \u652F\u6301",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-runtime-api-\u652F\u6301",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["Modern.js \u63D0\u4F9B\u4E86 ",(0,s.jsx)(n.a,{href:"https://modernjs.dev/configure/app/runtime/intro",target:"_blank",rel:"noopener noreferrer",children:"Runtime API"})," \u80FD\u529B\uFF0C\u8FD9\u4E9B API \u53EA\u80FD\u5728 Modern.js \u7684\u5E94\u7528\u9879\u76EE\u73AF\u5883\u4E2D\u4F7F\u7528"]}),"\u3002\u5982\u679C\u4F60\u9700\u8981\u5F00\u53D1\u4E00\u4E2A Modern.js \u5E94\u7528\u73AF\u5883\u4E2D\u4F7F\u7528\u7684\u7EC4\u4EF6\uFF0C\u90A3\u4E48\u4F60\u53EF\u4EE5\u5F00\u542F\u8BE5\u7279\u6027\uFF0C\u5FAE\u751F\u6210\u5668\u4F1A\u589E\u52A0 ",(0,s.jsx)(n.code,{children:'"@modern-js/runtime"'}),"\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u53E6\u5916\uFF0CStorybook \u8C03\u8BD5\u5DE5\u5177\u4E5F\u4F1A\u901A\u8FC7\u68C0\u6D4B\u9879\u76EE\u7684\u4F9D\u8D56\u786E\u5B9A\u9879\u76EE\u662F\u5426\u9700\u8981\u4F7F\u7528 Runtime API\uFF0C\u5E76\u4E14\u63D0\u4F9B\u4E0E Modern.js \u5E94\u7528\u9879\u76EE\u4E00\u6837\u7684 Runtime API \u8FD0\u884C\u73AF\u5883\u3002"}),"\n",(0,s.jsx)(n.p,{children:":::tip\n\u5728\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F1A\u63D0\u793A\u9700\u8981\u624B\u52A8\u5728\u914D\u7F6E\u4E2D\u589E\u52A0\u5982\u4E0B\u7C7B\u4F3C\u7684\u4EE3\u7801\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport runtime from '@modern-js/runtime/cli';\n\nexport default defineConfig({\n plugins: [moduleTools(), runtime()],\n});\n"})}),"\n"]})]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fuse-micro-generator.md"]={toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2}],title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/28.2444362f.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2414.362edd76.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/28.2444362f.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2414.362edd76.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2509.0fc92784.js b/modern-js/module-tools/static/js/async/2509.0fc92784.js deleted file mode 100644 index 2437487ed3..0000000000 --- a/modern-js/module-tools/static/js/async/2509.0fc92784.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2509.0fc92784.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2509"],{81570:function(e,r,n){"use strict";n.r(r);var s=n("39980"),i=n("9580");function o(e){let r=Object.assign({h1:"h1",a:"a"},(0,i.ah)(),e.components);return(0,s.jsxs)(r.h1,{id:"overview",children:["Overview",(0,s.jsx)(r.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:r}=Object.assign({},(0,i.ah)(),e.components);return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}r.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fapi%2Findex.md"]={toc:[],title:"Overview",frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7767.b9556903.js b/modern-js/module-tools/static/js/async/2551.a606f1c1.js similarity index 71% rename from modern-js/module-tools/static/js/async/7767.b9556903.js rename to modern-js/module-tools/static/js/async/2551.a606f1c1.js index 4047fba17d..1dd805b9b5 100644 --- a/modern-js/module-tools/static/js/async/7767.b9556903.js +++ b/modern-js/module-tools/static/js/async/2551.a606f1c1.js @@ -1,2 +1,2 @@ -/*! For license information please see 7767.b9556903.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7767"],{63921:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-other.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 2551.a606f1c1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2551"],{92576:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-product.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3016.83cb912e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2551.a606f1c1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3016.83cb912e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2551.a606f1c1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/270.312ebb2e.js b/modern-js/module-tools/static/js/async/270.312ebb2e.js new file mode 100644 index 0000000000..cb308ca04a --- /dev/null +++ b/modern-js/module-tools/static/js/async/270.312ebb2e.js @@ -0,0 +1,2 @@ +/*! For license information please see 270.312ebb2e.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["270"],{29198:function(e,n,o){"use strict";o.r(n);var r=o("39980"),s=o("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",div:"div",strong:"strong",h3:"h3",ul:"ul",li:"li",code:"code",pre:"pre",img:"img",h4:"h4"},(0,s.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"dev",children:["dev",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"This section describes all configuration of Modern.js Module related to debugging tools."}),"\n",(0,r.jsxs)(n.h2,{id:"storybook",children:["storybook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Deprecated"}),": This configuration is deprecated and only applicable to Storybook V6. Please see ",(0,r.jsx)(n.a,{href:"/guide/basic/using-storybook",children:"\u4F7F\u7528Storybook"})," to get more info.\n"]})})]}),"\n",(0,r.jsxs)(n.h3,{id:"storybookwebpack",children:["storybook.webpack",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpack",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Type"}),": ",(0,r.jsx)(n.code,{children:"object | Function | undefined"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default"}),": ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpack(config) {\n return config;\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["You can modify the webpack configuration of the Storybook Preview-iframe via ",(0,r.jsx)(n.code,{children:"dev.storybook.webpack"}),". The usage can be found in the ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/builder/en/api/config-tools.html#toolswebpack",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"tools.webpack"})})," configuration of Modern.js Builder."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://storybook.js.org/71522ac365feaf3338d7c242e53378f6/manager-preview.png",alt:"Storybook"})}),"\n",(0,r.jsxs)(n.h4,{id:"configure-manager-app",children:["Configure Manager App",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configure-manager-app",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["For the webpack configuration of the Storybook Manager app section, you can configure it by adding the ",(0,r.jsx)(n.code,{children:"./config/storybook/main.js"})," file to configure it."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"// ./config/storybook/main.js\n\nmodule.exports = {\n // it controls the Storybook manager app\n managerWebpack: async (config, options) => {\n // update config here\n return config;\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"storybookwebpackchain",children:["storybook.webpackChain",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpackchain",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Type"}),": ",(0,r.jsx)(n.code,{children:"Function | undefined"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default"}),": ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpackChain(chain) {\n return chain;\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["You can modify the webpack configuration of the Storybook Preview-iframe via ",(0,r.jsx)(n.code,{children:"dev.storybook.webpackChain"}),". You can refer to Modern.js Builder's ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/builder/en/api/config-tools.html#toolswebpackchain",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"tools.webpackChain"})})," configuration for how to use it."]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Fdev.md"]={toc:[{text:"storybook",id:"storybook",depth:2},{text:"storybook.webpack",id:"storybookwebpack",depth:3},{text:"Configure Manager App",id:"configure-manager-app",depth:4},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3}],title:"dev",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/358.5fbfed29.js.LICENSE.txt b/modern-js/module-tools/static/js/async/270.312ebb2e.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/358.5fbfed29.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/270.312ebb2e.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/28.2444362f.js b/modern-js/module-tools/static/js/async/28.2444362f.js deleted file mode 100644 index 9a6888b07a..0000000000 --- a/modern-js/module-tools/static/js/async/28.2444362f.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 28.2444362f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["28"],{73323:function(e,n,a){"use strict";a.r(n);var i=a("39980"),t=a("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",ul:"ul",li:"li",pre:"pre",code:"code",h2:"h2",h3:"h3"},(0,t.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"build-umd-artifacts",children:["Build umd artifacts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-umd-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The full name of umd is ",(0,i.jsx)(n.strong,{children:"Universal Module Definition"}),", and JS files in this format can run in multiple runtime environments: the"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Browser environment: module loading based on AMD specification"}),"\n",(0,i.jsx)(n.li,{children:"Node.js environment: module loading based on CommonJS"}),"\n",(0,i.jsx)(n.li,{children:"Other cases: mount the module on a global object."}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"We can therefore specify the build artifacts of the project as an umd artifact in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"third-party-dependency-handling-for-umd-artifacts",children:["Third-party dependency handling for umd artifacts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#third-party-dependency-handling-for-umd-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In the ",(0,i.jsx)(n.a,{href:"/en/guide/advance/external-dependency",children:'"How to handle third-party dependencies"'})," chapter, we know that we can control whether or not the project packages third-party dependencies via the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"autoExternals"})})," and ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"externals"})})," APIs.\nSo when building umd artifacts, we can also use it like this:"]}),"\n",(0,i.jsxs)(n.h3,{id:"example",children:["Example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If the project depends on ",(0,i.jsx)(n.code,{children:"react"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n autoExternal: false,\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"react"})," code is not bundled into the artifact at this point:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports, require('react'));\n else if (typeof define === 'function' && define.amd)\n define(['exports', 'react'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}), global.react);\n})(this, function (exports, _react) {\n 'use strict';\n Object.defineProperty(exports, '__esModule', {\n value: true,\n });\n _react = /*#__PURE__*/ _interopRequireDefault(_react);\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule\n ? obj\n : {\n default: obj,\n };\n }\n console.info(_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["We know from the above example that when using the ",(0,i.jsx)(n.code,{children:"autoExternal"})," and ",(0,i.jsx)(n.code,{children:"externals"})," APIs."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["In a Node.js environment, you can get the react dependency with ",(0,i.jsx)(n.code,{children:"require('react')"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["In a browser environment, you can get the react dependency via ",(0,i.jsx)(n.code,{children:"global.react"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"global-variable-names-of-third-party-dependencies",children:["Global variable names of third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#global-variable-names-of-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["However, in the browser environment, when getting third-party dependencies, ",(0,i.jsx)(n.strong,{children:"global variable names are not necessarily identical to the dependency names"}),", so you have to use the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#umdglobals",children:(0,i.jsx)(n.code,{children:"buildConfig.umdGlobals"})})," API."]}),"\n",(0,i.jsxs)(n.p,{children:["Again using the previous example, when the ",(0,i.jsx)(n.code,{children:"react"})," dependency exists in the browser environment as a ",(0,i.jsx)(n.code,{children:"windows.React"})," or ",(0,i.jsx)(n.code,{children:"global.React"})," global variable, then:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," config file:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdGlobals: {\n react: 'React',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsx)(n.p,{children:"At this point we will see the output code like this:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory();\n else if (typeof define === 'function' && define.amd) define([], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory();\n})(this, function () {\n // ...\n // libuild:globals:react\n var require_react = __commonJS({\n 'libuild:globals:react'(exports, module1) {\n module1.exports = Function('return this')()['React'];\n },\n });\n // src/index.ts\n var import_react = __toESM(require_react());\n console.info(import_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The project can then run in the browser and use the ",(0,i.jsx)(n.code,{children:"React"})," variables that exist on the global object."]}),"\n",(0,i.jsxs)(n.h2,{id:"changing-the-name-of-a-global-variable-in-a-project",children:["Changing the name of a global variable in a project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#changing-the-name-of-a-global-variable-in-a-project",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When we package the following code into an umd artifact and run it in the browser, we can use the module via ",(0,i.jsx)(n.code,{children:"window.index"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="./src/index.ts"',children:"export default () => {\n console.info('hello world');\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"** By default, the name of the source file is used as the name of the module's global variable in the browser. **For the above example, the artifact would read as follows:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}));\n})(this, function (exports) {\n //...\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you need to modify it, you need to use the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#umdmodulename",children:(0,i.jsx)(n.code,{children:"buildConfig.umdModuleName"})})," API."]}),"\n",(0,i.jsx)(n.p,{children:"When this API is used:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"The build artifact at this point are:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.myLib = {}));\n})(this, function (exports) {\n //...\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fbuild-umd.mdx"]={toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2},{text:"Example",id:"example",depth:3},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2}],title:"Build umd artifacts",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/281.ed5dacc6.js b/modern-js/module-tools/static/js/async/281.ed5dacc6.js deleted file mode 100644 index 5590df7a29..0000000000 --- a/modern-js/module-tools/static/js/async/281.ed5dacc6.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 281.ed5dacc6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["281"],{47778:function(e,n,r){"use strict";r.r(n);var s=r("39980"),o=r("9580"),l=r("23657");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"import-\u63D2\u4EF6",children:["Import \u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#import-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u63D0\u4F9B\u4E0E ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"})," \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E ",(0,s.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," \u5B9E\u73B0\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE ",(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," 2.16.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BE5\u63D2\u4EF6\u529F\u80FD\u5185\u7F6E\u5728 Modern.js Module \u4E2D\uFF0C\u7531 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:(0,s.jsx)(n.code,{children:"transformImport"})}),"\n\u914D\u7F6E\u63D0\u4F9B\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(l.SU,{command:"add @modern-js/plugin-module-import -D"}),"\n",(0,s.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginImport } from '@modern-js/plugin-module-import';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'antd',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u8FD9\u6837\u6211\u4EEC\u5C31\u53EF\u4EE5\u5728 Modern.js Module \u4E2D\u4F7F\u7528\u81EA\u52A8\u5BFC\u5165\u7684\u80FD\u529B\u4E86\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Options = {\n pluginImport?: ImportItem[];\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"pluginimport",children:["pluginImport",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pluginimport",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"object[]"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5176\u4E2D\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," (Speedy Web Compiler) \u662F\u57FA\u4E8E Rust \u8BED\u8A00\u7F16\u5199\u7684\uFF0C\u800C\u8BE5\u63D2\u4EF6\u662F\u57FA\u4E8E SWC\uFF0C\u79FB\u690D\u81EA ",(0,s.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"}),"\uFF0C\u914D\u7F6E\u9009\u9879\u4FDD\u6301\u4E86\u4E00\u81F4\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E00\u4E9B\u914D\u7F6E\u53EF\u4EE5\u4F20\u5165\u51FD\u6570\uFF0C\u4F8B\u5982 ",(0,s.jsx)(n.code,{children:"customName"}),"\uFF0C",(0,s.jsx)(n.code,{children:"customStyleName"})," \u7B49\uFF0C \u4F46\u5728 Modern.js Module \u91CC\uFF0C\u6211\u4EEC\u4E0D\u5EFA\u8BAE\u5728\u6B64\u914D\u7F6E\u9879\u91CC\u4F7F\u7528\u51FD\u6570\u3002\n\u56E0\u4E3A\u6211\u4EEC\u4F1A\u5728 esbuild \u7684\u63D2\u4EF6\u91CC\u8C03\u7528 SWC\uFF0C\u7136\u540E\u518D\u5F53 Rust \u901A\u8FC7 Node-API \u8C03\u7528\u8FD9\u4E9B\u914D\u7F6E\u51FD\u6570\u65F6\uFF0C\u4F1A\u51FA\u73B0\u6B7B\u9501\u73B0\u8C61\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u7B80\u5355\u7684\u51FD\u6570\u903B\u8F91\u5176\u5B9E\u53EF\u4EE5\u901A\u8FC7\u6A21\u7248\u8BED\u8A00\u6765\u4EE3\u66FF\uFF0C\u4E0B\u9762\u662F\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"customName"})," \u4F7F\u7528\u6A21\u677F\u7684\u793A\u4F8B\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { MyButton as Btn } from 'foo';\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ member }}',\n },\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5176\u4E2D\u7684 ",(0,s.jsx)(n.code,{children:"{{ member }}"})," \u4F1A\u88AB\u66FF\u6362\u4E3A\u76F8\u5E94\u7684\u5F15\u5165\u6210\u5458\uFF0C\u8F6C\u6362\u540E:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/MyButton';\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u53EF\u4EE5\u770B\u51FA\u914D\u7F6E ",(0,s.jsx)(n.code,{children:'customName: "foo/es/{{ member }}"'})," \u7684\u6548\u679C\u7B49\u540C\u4E8E\u914D\u7F6E ",(0,s.jsx)(n.code,{children:" customName: (member) => `foo/es/${member}` "})," \u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u91CC\u4F7F\u7528\u5230\u7684\u6A21\u7248\u662F ",(0,s.jsx)(n.a,{href:"https://handlebarsjs.com",target:"_blank",rel:"noopener noreferrer",children:"handlebars"}),"\uFF0C\u6A21\u7248\u914D\u7F6E\u4E2D\u8FD8\u5185\u7F6E\u4E86\u4E00\u4E9B\u6709\u7528\u7684\u8F85\u52A9\u5DE5\u5177\uFF0C\u8FD8\u662F\u4EE5\u4E0A\u9762\u7684\u5BFC\u5165\u8BED\u53E5\u4E3A\u4F8B\uFF0C\u914D\u7F6E\u6210\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ kebabCase member }}',\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u4F1A\u8F6C\u6362\u6210\u4E0B\u9762\u7684\u7ED3\u679C\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/my-button';\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 ",(0,s.jsx)(n.code,{children:"kebabCase"})," \u4EE5\u5916\u8FD8\u6709 ",(0,s.jsx)(n.code,{children:"camelCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"snakeCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"upperCase"}),"\uFF0C",(0,s.jsx)(n.code,{children:"lowerCase"})," \u53EF\u4EE5\u4F7F\u7528\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-import.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"pluginImport",id:"pluginimport",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2}],title:"Import \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8175.9fda3d57.js b/modern-js/module-tools/static/js/async/2814.23f25c63.js similarity index 79% rename from modern-js/module-tools/static/js/async/8175.9fda3d57.js rename to modern-js/module-tools/static/js/async/2814.23f25c63.js index e9559f443d..2086cffd11 100644 --- a/modern-js/module-tools/static/js/async/8175.9fda3d57.js +++ b/modern-js/module-tools/static/js/async/2814.23f25c63.js @@ -1,2 +1,2 @@ -/*! For license information please see 8175.9fda3d57.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8175"],{80838:function(e,n,t){"use strict";t.r(n);var o=t("39980"),s=t("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-exception.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 2814.23f25c63.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2814"],{35783:function(e,n,t){"use strict";t.r(n);var o=t("39980"),s=t("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-exception.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3351.9d189162.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2814.23f25c63.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3351.9d189162.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2814.23f25c63.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4248.63967d39.js b/modern-js/module-tools/static/js/async/2913.2b145c76.js similarity index 99% rename from modern-js/module-tools/static/js/async/4248.63967d39.js rename to modern-js/module-tools/static/js/async/2913.2b145c76.js index b1d226069f..727f234b42 100644 --- a/modern-js/module-tools/static/js/async/4248.63967d39.js +++ b/modern-js/module-tools/static/js/async/2913.2b145c76.js @@ -1,2 +1,2 @@ -/*! For license information please see 4248.63967d39.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4248"],{56401:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",div:"div",h3:"h3",ul:"ul",strong:"strong",h4:"h4"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"using-tailwind-css",children:["Using Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles."]}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module supports developing component styles using Tailwind CSS."}),"\n",(0,i.jsxs)(n.h2,{id:"enabling-tailwind-css",children:["Enabling Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#enabling-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["To use ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," in Modern.js Module, you can follow the steps below:"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Run ",(0,i.jsx)(n.code,{children:"pnpm run new"})," in the root directory of your project and make the following selections:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? Please select the operation you want: Enable features\n? Please select the feature name: Enable Tailwind CSS\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After successful initialization, you will see that the ",(0,i.jsx)(n.code,{children:"package.json"})," has added dependencies for ",(0,i.jsx)(n.code,{children:"tailwindcss"})," and ",(0,i.jsx)(n.code,{children:"@modern-js/plugin-tailwindcss"}),"."]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["Register the Tailwind plugin in ",(0,i.jsx)(n.code,{children:"modern.config.ts"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';\n\nexport default defineConfig({\n plugins: [..., tailwindcssPlugin()],\n});\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsxs)(n.li,{children:["Create a ",(0,i.jsx)(n.code,{children:"index.css"})," file and add the following code:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="index.css"',children:"/* base and components are optional, please add as appropriate */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Depending on your needs, you can selectively import the CSS styles provided by Tailwind CSS. Please refer to the ",(0,i.jsxs)(n.a,{href:"https://tailwindcss.com/docs/functions-and-directives#tailwind",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)(n.code,{children:"@tailwind"})," documentation"]})," for detailed usage of the ",(0,i.jsx)(n.code,{children:"@tailwind"})," directive.\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"4",children:["\n",(0,i.jsxs)(n.li,{children:["Import the ",(0,i.jsx)(n.code,{children:"index.css"})," file, for example, add the following code in the root component ",(0,i.jsx)(n.code,{children:"src/index.jsx"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import './index.css';\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"5",children:["\n",(0,i.jsx)(n.li,{children:"Now you can use the Utility Classes provided by Tailwind CSS in your components:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",children:'const Hello = () => (\n
                  \n

                  hello world

                  \n
                  \n);\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"configuring-tailwind-css",children:["Configuring Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configuring-tailwind-css",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you have two ways to configure Tailwind CSS:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Using the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file, which follows the official usage of Tailwind CSS. Please refer to ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:'"Tailwind CSS - Configuration"'})," for more details."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="tailwind.config.ts"',children:"import type { Config } from 'tailwindcss';\n\nexport default {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n} as Config;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Please upgrade Modern.js to version >= 2.33.0 to support automatic reading of ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," files.\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["Using the ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styletailwindcss",children:"style.tailwindcss"})," configuration option. This is the old way of configuring Tailwind CSS, and we recommend using the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file for configuration."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n tools: {\n tailwindcss: {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you are using both the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file and ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," option, the configuration defined in ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," will take precedence and override the content defined in ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"tailwind-css-autocomplete",children:["Tailwind CSS Autocomplete",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-autocomplete",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS provides an official extension called ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code."]}),"\n",(0,i.jsx)(n.p,{children:"You can follow the steps below to enable the autocomplete feature:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Install the ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," extension in VS Code."]}),"\n",(0,i.jsxs)(n.li,{children:["If the root directory of your project does not have a ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file, you need to create one and write the Tailwind CSS configuration for your current project. Otherwise, the IDE plugin will not work correctly."]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"build-modes",children:["Build Modes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-modes",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When using Tailwind CSS, please note that there are significant differences between the bundle and bundleless modes in terms of the build artifacts."}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["For definitions of bundle and bundleless, please refer to the ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:'"In-depth understanding of build"'}),".\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"bundle-mode",children:["Bundle Mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-mode",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Bundle mode, a separate CSS file is generated, and the JS output does not automatically reference the CSS output file."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Source code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"// src/index.tsx\nimport { jsx } from 'react/jsx-runtime';\nvar src_default = () => {\n return /* @__PURE__ */ jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n};\nexport { src_default as default };\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you need to inject styles into the JS artifact, you can enable the ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styleinject",children:"style.inject"})," option."]}),"\n",(0,i.jsxs)(n.p,{children:["If you haven't enabled ",(0,i.jsx)(n.code,{children:"style.inject"}),", you can also let users manually import the CSS file:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'your-package/dist/es/index.css';\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"bundleless-mode",children:["Bundleless Mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-mode",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In bundleless mode, the CSS file is automatically imported in the artifact code without the need for additional processing."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"import { jsx as _jsx } from 'react/jsx-runtime';\nimport './index.css';\nexport default () =>\n /* @__PURE__ */ _jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"class-name-prefix",children:["Class Name Prefix",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#class-name-prefix",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["You can add a class name prefix using the ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration#prefix",target:"_blank",rel:"noopener noreferrer",children:"prefix"})," option provided by Tailwind CSS. This helps avoid potential class name conflicts, such as when different versions of Tailwind CSS are used in different parts of an application or module."]}),"\n",(0,i.jsxs)(n.p,{children:["For example, you can add the ",(0,i.jsx)(n.code,{children:"foo-"})," prefix using the ",(0,i.jsx)(n.code,{children:"prefix"})," option in ",(0,i.jsx)(n.code,{children:"tailwind.config.js"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="tailwind.config.js"',children:"module.exports = {\n prefix: 'foo-',\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output Code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".foo-bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"usage-guide",children:["Usage Guide",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#usage-guide",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Here are some usage examples of Tailwind CSS."}),"\n",(0,i.jsxs)(n.h3,{id:"html-class-names",children:["HTML Class Names",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#html-class-names",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS supports adding styles to HTML tags through class names. ",(0,i.jsx)(n.strong,{children:"When using HTML class names, please note that the corresponding CSS styles of Tailwind CSS must be imported in advance."})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"Generated styles (after bundling):"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgba(0, 0, 0, var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apply",children:[(0,i.jsx)(n.code,{children:"@apply"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apply",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS provides the ",(0,i.jsx)(n.a,{href:"https://v2.tailwindcss.com/docs/functions-and-directives#apply",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"@apply"})})," directive, which allows us to inline the styles provided by Tailwind CSS into our own styles."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@apply"})," can be used in CSS, Less, and Sass."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".btn {\n @apply font-bold py-2 px-4 rounded;\n}\n"})}),"\n",(0,i.jsx)(n.p,{children:"However, there are some considerations when using it with Less and Sass:"}),"\n",(0,i.jsxs)(n.h4,{id:"sass",children:["Sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When using Tailwind with Sass and there is an ",(0,i.jsx)(n.code,{children:"!important"})," after ",(0,i.jsx)(n.code,{children:"@apply"}),", interpolation should be used to ensure Sass compiles correctly."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Won't work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 !important;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Will work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 #{!important};\n}\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"less",children:["Less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When using Tailwind with Less, you cannot nest Tailwind's ",(0,i.jsx)(n.code,{children:"@screen"})," directive."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Won't work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",children:".card {\n @apply rounded-none;\n\n @screen sm {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Instead, use regular media queries and the ",(0,i.jsx)(n.code,{children:"theme()"})," function to reference your screen sizes or simply avoid nesting your ",(0,i.jsx)(n.code,{children:"@screen"})," directive."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="Method 1"',children:"// Use a regular media query and theme()\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="Method 2"',children:"// Use the @screen directive at the top-level\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"about-designsystem-config",children:["About ",(0,i.jsx)(n.code,{children:"designSystem"})," config",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#about-designsystem-config",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"designSystem"})," is a deprecated configuration option in Modern.js Module."]}),"\n",(0,i.jsxs)(n.p,{children:["Starting from Modern.js Module version 2.33.0, you can use the ",(0,i.jsx)(n.code,{children:"theme"})," configuration option of Tailwind CSS as a replacement for ",(0,i.jsx)(n.code,{children:"designSystem"}),". It is no longer necessary to split the ",(0,i.jsx)(n.code,{children:"theme"})," configuration and set it on ",(0,i.jsx)(n.code,{children:"designSystem"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Previous usage:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"const { theme, ...rest } = tailwindConfig;\n\nexport default {\n style: {\n tailwindcss: rest,\n },\n designSystem: theme,\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Current usage:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: tailwindConfig,\n },\n};\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fguide%2Fbest-practices%2Fuse-tailwindcss.mdx"]={toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3},{text:"Build Modes",id:"build-modes",depth:2},{text:"Bundle Mode",id:"bundle-mode",depth:3},{text:"Bundleless Mode",id:"bundleless-mode",depth:3},{text:"Class Name Prefix",id:"class-name-prefix",depth:2},{text:"Usage Guide",id:"usage-guide",depth:2},{text:"HTML Class Names",id:"html-class-names",depth:3},{text:"`@apply`",id:"apply",depth:3},{text:"Sass",id:"sass",depth:4},{text:"Less",id:"less",depth:4},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2}],title:"Using Tailwind CSS",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 2913.2b145c76.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2913"],{33566:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",div:"div",h3:"h3",ul:"ul",strong:"strong",h4:"h4"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"using-tailwind-css",children:["Using Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles."]}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module supports developing component styles using Tailwind CSS."}),"\n",(0,i.jsxs)(n.h2,{id:"enabling-tailwind-css",children:["Enabling Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#enabling-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["To use ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," in Modern.js Module, you can follow the steps below:"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Run ",(0,i.jsx)(n.code,{children:"pnpm run new"})," in the root directory of your project and make the following selections:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? Please select the operation you want: Enable features\n? Please select the feature name: Enable Tailwind CSS\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After successful initialization, you will see that the ",(0,i.jsx)(n.code,{children:"package.json"})," has added dependencies for ",(0,i.jsx)(n.code,{children:"tailwindcss"})," and ",(0,i.jsx)(n.code,{children:"@modern-js/plugin-tailwindcss"}),"."]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["Register the Tailwind plugin in ",(0,i.jsx)(n.code,{children:"modern.config.ts"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';\n\nexport default defineConfig({\n plugins: [..., tailwindcssPlugin()],\n});\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsxs)(n.li,{children:["Create a ",(0,i.jsx)(n.code,{children:"index.css"})," file and add the following code:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="index.css"',children:"/* base and components are optional, please add as appropriate */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Depending on your needs, you can selectively import the CSS styles provided by Tailwind CSS. Please refer to the ",(0,i.jsxs)(n.a,{href:"https://tailwindcss.com/docs/functions-and-directives#tailwind",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)(n.code,{children:"@tailwind"})," documentation"]})," for detailed usage of the ",(0,i.jsx)(n.code,{children:"@tailwind"})," directive.\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"4",children:["\n",(0,i.jsxs)(n.li,{children:["Import the ",(0,i.jsx)(n.code,{children:"index.css"})," file, for example, add the following code in the root component ",(0,i.jsx)(n.code,{children:"src/index.jsx"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import './index.css';\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"5",children:["\n",(0,i.jsx)(n.li,{children:"Now you can use the Utility Classes provided by Tailwind CSS in your components:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",children:'const Hello = () => (\n
                  \n

                  hello world

                  \n
                  \n);\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"configuring-tailwind-css",children:["Configuring Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configuring-tailwind-css",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you have two ways to configure Tailwind CSS:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Using the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file, which follows the official usage of Tailwind CSS. Please refer to ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:'"Tailwind CSS - Configuration"'})," for more details."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="tailwind.config.ts"',children:"import type { Config } from 'tailwindcss';\n\nexport default {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n} as Config;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Please upgrade Modern.js to version >= 2.33.0 to support automatic reading of ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," files.\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["Using the ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styletailwindcss",children:"style.tailwindcss"})," configuration option. This is the old way of configuring Tailwind CSS, and we recommend using the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file for configuration."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n tools: {\n tailwindcss: {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you are using both the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file and ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," option, the configuration defined in ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," will take precedence and override the content defined in ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"tailwind-css-autocomplete",children:["Tailwind CSS Autocomplete",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-autocomplete",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS provides an official extension called ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code."]}),"\n",(0,i.jsx)(n.p,{children:"You can follow the steps below to enable the autocomplete feature:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Install the ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," extension in VS Code."]}),"\n",(0,i.jsxs)(n.li,{children:["If the root directory of your project does not have a ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file, you need to create one and write the Tailwind CSS configuration for your current project. Otherwise, the IDE plugin will not work correctly."]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"build-modes",children:["Build Modes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-modes",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When using Tailwind CSS, please note that there are significant differences between the bundle and bundleless modes in terms of the build artifacts."}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["For definitions of bundle and bundleless, please refer to the ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:'"In-depth understanding of build"'}),".\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"bundle-mode",children:["Bundle Mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-mode",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Bundle mode, a separate CSS file is generated, and the JS output does not automatically reference the CSS output file."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Source code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"// src/index.tsx\nimport { jsx } from 'react/jsx-runtime';\nvar src_default = () => {\n return /* @__PURE__ */ jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n};\nexport { src_default as default };\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you need to inject styles into the JS artifact, you can enable the ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styleinject",children:"style.inject"})," option."]}),"\n",(0,i.jsxs)(n.p,{children:["If you haven't enabled ",(0,i.jsx)(n.code,{children:"style.inject"}),", you can also let users manually import the CSS file:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'your-package/dist/es/index.css';\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"bundleless-mode",children:["Bundleless Mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-mode",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In bundleless mode, the CSS file is automatically imported in the artifact code without the need for additional processing."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"import { jsx as _jsx } from 'react/jsx-runtime';\nimport './index.css';\nexport default () =>\n /* @__PURE__ */ _jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"class-name-prefix",children:["Class Name Prefix",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#class-name-prefix",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["You can add a class name prefix using the ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration#prefix",target:"_blank",rel:"noopener noreferrer",children:"prefix"})," option provided by Tailwind CSS. This helps avoid potential class name conflicts, such as when different versions of Tailwind CSS are used in different parts of an application or module."]}),"\n",(0,i.jsxs)(n.p,{children:["For example, you can add the ",(0,i.jsx)(n.code,{children:"foo-"})," prefix using the ",(0,i.jsx)(n.code,{children:"prefix"})," option in ",(0,i.jsx)(n.code,{children:"tailwind.config.js"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="tailwind.config.js"',children:"module.exports = {\n prefix: 'foo-',\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Output Code:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".foo-bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"usage-guide",children:["Usage Guide",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#usage-guide",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Here are some usage examples of Tailwind CSS."}),"\n",(0,i.jsxs)(n.h3,{id:"html-class-names",children:["HTML Class Names",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#html-class-names",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS supports adding styles to HTML tags through class names. ",(0,i.jsx)(n.strong,{children:"When using HTML class names, please note that the corresponding CSS styles of Tailwind CSS must be imported in advance."})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"Generated styles (after bundling):"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgba(0, 0, 0, var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apply",children:[(0,i.jsx)(n.code,{children:"@apply"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apply",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS provides the ",(0,i.jsx)(n.a,{href:"https://v2.tailwindcss.com/docs/functions-and-directives#apply",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"@apply"})})," directive, which allows us to inline the styles provided by Tailwind CSS into our own styles."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@apply"})," can be used in CSS, Less, and Sass."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".btn {\n @apply font-bold py-2 px-4 rounded;\n}\n"})}),"\n",(0,i.jsx)(n.p,{children:"However, there are some considerations when using it with Less and Sass:"}),"\n",(0,i.jsxs)(n.h4,{id:"sass",children:["Sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When using Tailwind with Sass and there is an ",(0,i.jsx)(n.code,{children:"!important"})," after ",(0,i.jsx)(n.code,{children:"@apply"}),", interpolation should be used to ensure Sass compiles correctly."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Won't work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 !important;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Will work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 #{!important};\n}\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"less",children:["Less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When using Tailwind with Less, you cannot nest Tailwind's ",(0,i.jsx)(n.code,{children:"@screen"})," directive."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Won't work as expected:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",children:".card {\n @apply rounded-none;\n\n @screen sm {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Instead, use regular media queries and the ",(0,i.jsx)(n.code,{children:"theme()"})," function to reference your screen sizes or simply avoid nesting your ",(0,i.jsx)(n.code,{children:"@screen"})," directive."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="Method 1"',children:"// Use a regular media query and theme()\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="Method 2"',children:"// Use the @screen directive at the top-level\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"about-designsystem-config",children:["About ",(0,i.jsx)(n.code,{children:"designSystem"})," config",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#about-designsystem-config",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"designSystem"})," is a deprecated configuration option in Modern.js Module."]}),"\n",(0,i.jsxs)(n.p,{children:["Starting from Modern.js Module version 2.33.0, you can use the ",(0,i.jsx)(n.code,{children:"theme"})," configuration option of Tailwind CSS as a replacement for ",(0,i.jsx)(n.code,{children:"designSystem"}),". It is no longer necessary to split the ",(0,i.jsx)(n.code,{children:"theme"})," configuration and set it on ",(0,i.jsx)(n.code,{children:"designSystem"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Previous usage:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"const { theme, ...rest } = tailwindConfig;\n\nexport default {\n style: {\n tailwindcss: rest,\n },\n designSystem: theme,\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Current usage:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: tailwindConfig,\n },\n};\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fguide%2Fbest-practices%2Fuse-tailwindcss.mdx"]={toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3},{text:"Build Modes",id:"build-modes",depth:2},{text:"Bundle Mode",id:"bundle-mode",depth:3},{text:"Bundleless Mode",id:"bundleless-mode",depth:3},{text:"Class Name Prefix",id:"class-name-prefix",depth:2},{text:"Usage Guide",id:"usage-guide",depth:2},{text:"HTML Class Names",id:"html-class-names",depth:3},{text:"`@apply`",id:"apply",depth:3},{text:"Sass",id:"sass",depth:4},{text:"Less",id:"less",depth:4},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2}],title:"Using Tailwind CSS",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3718.73adc53d.js.LICENSE.txt b/modern-js/module-tools/static/js/async/2913.2b145c76.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3718.73adc53d.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/2913.2b145c76.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2974.159183a5.js b/modern-js/module-tools/static/js/async/2974.159183a5.js deleted file mode 100644 index 9cc894fe69..0000000000 --- a/modern-js/module-tools/static/js/async/2974.159183a5.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2974.159183a5.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2974"],{3561:function(n,e,i){"use strict";i.r(e);var o=i("39980"),t=i("9580");function l(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",pre:"pre",h2:"h2",strong:"strong"},(0,t.ah)(),n.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.h1,{id:"plugin-object",children:["Plugin Object",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-object",children:"#"})]}),"\n",(0,o.jsx)(e.p,{children:"The Modern.js Module plugin is an object, and the object contains the following properties."}),"\n",(0,o.jsxs)(e.ul,{children:["\n",(0,o.jsxs)(e.li,{children:[(0,o.jsx)(e.code,{children:"name"}),": The name of the plugin, a unique identifier."]}),"\n",(0,o.jsxs)(e.li,{children:[(0,o.jsx)(e.code,{children:"setup"}),": plugin initialization function, which will be executed only once. setup function can return a Hooks object, and Modern.js Module will execute the function corresponding to the Hook defined on the Hooks object at a specific time."]}),"\n"]}),"\n",(0,o.jsxs)(e.p,{children:["For example, in the following plugin code example, the ",(0,o.jsx)(e.code,{children:"beforeBuild"})," function is triggered before the project starts the build task and the ",(0,o.jsx)(e.code,{children:"build start"})," log is printed."]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",meta:'title=". /plugins/demo.tsx"',children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n return {\n // this is hook\n beforeBuild: () => {\n console.info('build start');\n },\n };\n },\n};\n"})}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { myPlugin } from '. /plugins/demo';\nexport default {\n plugins: [myPlugin()],\n};\n"})}),"\n",(0,o.jsxs)(e.h2,{id:"plugin-type-definitions",children:["Plugin type definitions",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-type-definitions",children:"#"})]}),"\n",(0,o.jsxs)(e.p,{children:["When using TypeScript, you can introduce the built-in ",(0,o.jsx)(e.code,{children:"CliPlugin"})," and ",(0,o.jsx)(e.code,{children:"ModuleTools"})," types to provide the correct type derivation for plugins: ``"]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n const foo = '1';\n\n return {\n // this is hook\n afterBuild: () => {\n //...\n },\n };\n },\n};\n"})}),"\n",(0,o.jsxs)(e.h2,{id:"plugin-configuration-options",children:["Plugin configuration options",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-configuration-options",children:"#"})]}),"\n",(0,o.jsxs)(e.p,{children:[(0,o.jsx)(e.strong,{children:"It is recommended to write the plugin as a function"}),", so that the plugin can receive configuration options via function entry."]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\ntype MyPluginOptions = {\n foo: string;\n};\n\nconst myPlugin = (options: MyPluginOptions): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n console.log(options.foo);\n },\n});\n"})})]})}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,t.ah)(),n.components);return e?(0,o.jsx)(e,{...n,children:(0,o.jsx)(l,{...n})}):l(n)}e.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fplugin-object.mdx"]={toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2}],title:"Plugin Object",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/310.4253327a.js b/modern-js/module-tools/static/js/async/310.4253327a.js new file mode 100644 index 0000000000..f6d9fd0c3a --- /dev/null +++ b/modern-js/module-tools/static/js/async/310.4253327a.js @@ -0,0 +1,2 @@ +/*! For license information please see 310.4253327a.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["310"],{31003:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",code:"code",pre:"pre",ul:"ul",li:"li",blockquote:"blockquote",div:"div",h3:"h3",h4:"h4"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5F00\u59CB\u4E4B\u524D",children:["\u5F00\u59CB\u4E4B\u524D",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u59CB\u4E4B\u524D",children:"#"})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u73AF\u5883\u51C6\u5907",children:["\u73AF\u5883\u51C6\u5907",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u73AF\u5883\u51C6\u5907",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E3A\u4E86\u4F7F\u7528 Modern.js Module\uFF0C\u9996\u5148\u9700\u8981 ",(0,s.jsx)(n.a,{href:"https://nodejs.org/zh/",target:"_blank",rel:"noopener noreferrer",children:"NodeJS"}),"\uFF0C\u6211\u4EEC\u63A8\u8350\u6700\u65B0\u7684",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"\u957F\u671F\u7EF4\u62A4\u7248\u672C"}),"\uFF0C\u5E76\u786E\u4FDD Node \u7248\u672C\u5927\u4E8E\u7B49\u4E8E ",(0,s.jsx)(n.strong,{children:"16.0.0"}),"\u3002\u56E0\u4E3A\u975E\u7A33\u5B9A\u7684 NodeJS \u65F6\u5E38\u6709\u4E00\u4E9B Bug\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://github.com/coreybutler/nvm-windows",target:"_blank",rel:"noopener noreferrer",children:"nvm-windows"})," \u548C ",(0,s.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",target:"_blank",rel:"noopener noreferrer",children:"nvm"}),"\uFF08Mac / Linux\uFF09\u5B89\u88C5\uFF0C\u8FD9\u6837\u4F60\u5C31\u53EF\u4EE5\u65B9\u4FBF\u5730\u5207\u6362\u5230\u4E0D\u540C\u7684 NodeJS \u7248\u672C\uFF0C\u8FD9\u4E9B\u7248\u672C\u53EF\u80FD\u4F1A\u7528\u4E8E\u4E0D\u540C\u7684\u9879\u76EE\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u521D\u8BC6-npm",children:["\u521D\u8BC6 npm",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521D\u8BC6-npm",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53 NodeJS \u88AB\u5B89\u88C5\u540E\uFF0C\u4F60\u4E0D\u4EC5\u53EF\u4EE5\u5728\u547D\u4EE4\u884C\u4E2D\u8BBF\u95EE ",(0,s.jsx)(n.code,{children:"node"})," \u53EF\u6267\u884C\u7A0B\u5E8F\uFF0C\u540C\u65F6\u4F60\u4E5F\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm"})," \u547D\u4EE4\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"npm \u662F NodeJS \u7684\u6807\u51C6\u8F6F\u4EF6\u5305\u7BA1\u7406\u5668\u3002\u5B83\u4E00\u5F00\u59CB\u7684\u7528\u9014\u662F\u7528\u4E8E\u4E0B\u8F7D\u548C\u7BA1\u7406 NodeJS \u5305\u7684\u4F9D\u8D56\u5173\u7CFB\uFF0C\u4F46\u540E\u6765\u5B83\u9010\u6E10\u53D8\u6210\u4E3A\u4E00\u4E2A\u7528\u4E8E\u524D\u7AEF JavaScript \u7684\u5DE5\u5177\u3002"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["\u5982\u679C\u4F60\u5DF2\u7ECF\u5BF9 npm \u548C npm \u5305\u7684\u4F7F\u7528\u65B9\u5F0F\u6709\u6240\u4E86\u89E3\uFF0C\u90A3\u4E48\u53EF\u4EE5\u76F4\u63A5\u8DF3\u5230",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started#npm-%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8",children:"\u300Cnpm \u5305\u7BA1\u7406\u5668\u300D"}),"\u90E8\u5206\u3002"]})}),"\n",(0,s.jsxs)(n.h2,{id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",children:["npm \u5305\u7C7B\u578B\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7C7B\u578B\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u90A3\u4E48\u4EC0\u4E48\u662F npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\u5462\uFF1F\u5F53\u6211\u4EEC\u5728\u4E00\u4E2A\u7A7A\u7684\u9879\u76EE\u76EE\u5F55\u4E0B\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm init"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5B83\u4F1A\u5728\u5F53\u524D\u76EE\u5F55\u4E0B\u9762\u521B\u5EFA\u4E00\u4E2A\u6587\u4EF6\u540D\u4E3A ",(0,s.jsx)(n.code,{children:"package.json"})," \u7684 JSON \u6587\u4EF6\u3002\u5728\u521B\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u9700\u8981\u586B\u5199\u5305\u62EC\u4F46\u4E0D\u9650\u4E8E npm \u5305\u7684\u540D\u79F0\u3001\u7248\u672C\u53F7\u3001\u63CF\u8FF0\u7B49\u7B49\u5185\u5BB9\uFF0C\u8FD9\u4E9B\u586B\u5199\u7684\u5185\u5BB9\u90FD\u4F1A\u5728\u751F\u6210\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u627E\u5230\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "npm-demo",\n "version": "1.0.0",\n "description": "",\n "main": "index.js",\n "scripts": {\n "test": "echo \\"Error: no test specified\\" && exit 1"\n },\n "author": "",\n "license": "ISC"\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u8FD9\u4E2A\u5305\u542B\u4E86\u521D\u59CB\u5316\u540E\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u7684\u9879\u76EE\u5C31\u662F\u4E00\u4E2A npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u4F60\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm publish"})," \u547D\u4EE4\u5C06\u8FD9\u4E2A\u9879\u76EE\u53D1\u5E03\u5230 ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["npm Registry \u662F\u4E00\u4E2A ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-the-public-npm-registry",target:"_blank",rel:"noopener noreferrer",children:"npm \u5305\u5B58\u50A8\u7684\u5730\u65B9"}),"\uFF0C\u5F00\u53D1\u8005\u4EEC\u4E0D\u4EC5\u53EF\u4EE5\u5C06\u4ED6\u4EEC\u81EA\u5DF1\u7684 npm \u5305\u53D1\u5E03\u5230 npm Registry\uFF0C\u8FD8\u53EF\u4EE5\u901A\u8FC7 npm Registry \u4F7F\u7528\u5176\u4ED6\u5F00\u53D1\u8005\u53D1\u5E03\u7684 npm \u5305\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F18\u8D28\u7684 npm \u5305\u4F1A\u6709\u66F4\u591A\u7684\u4EBA\u53BB\u4F7F\u7528\uFF0C\u56E0\u4E3A\u5B83\u4E0D\u4EC5\u8282\u7701\u4E86\u5F88\u591A\u4EE3\u7801\u5B9E\u73B0\u7684\u5DE5\u4F5C\uFF0C\u540C\u65F6\u4E5F\u4E0D\u5BB9\u6613\u8BA9\u9879\u76EE\u51FA\u73B0\u95EE\u9898\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",children:["\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u8981\u4E3A\u521D\u59CB\u5316\u7684\u9879\u76EE\u589E\u52A0\u7B2C\u4E09\u65B9\u7684 npm \u5305\u7684\u65F6\u5019\uFF0C\u6211\u4EEC\u53EF\u4EE5\u628A\u8FD9\u4E00\u8FC7\u7A0B\u53EB\u505A\u201C\u4E3A\u9879\u76EE\u5B89\u88C5\u4F9D\u8D56\u201D\u6216\u662F\u201C\u4E3A\u9879\u76EE\u589E\u52A0\u4F9D\u8D56\u201D\u3002\u5728\u589E\u52A0\u4F9D\u8D56\u4E4B\u524D\uFF0C\u9996\u5148\u6211\u4EEC\u8981\u7279\u522B\u4E86\u89E3\u4E00\u4EF6\u4E8B\u60C5 \u2014\u2014 ",(0,s.jsx)(n.strong,{children:"npm \u4F9D\u8D56\u7684\u8F6F\u4EF6\u5305\u7C7B\u578B"}),"\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"dependencies"'}),"\uFF1A\u4E00\u79CD\u662F\u4F60\u7684\u5E94\u7528\u7A0B\u5E8F\u5728\u751F\u4EA7\u73AF\u5883\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"devDependencies"'}),"\uFF1A\u53E6\u4E00\u79CD\u662F\u4EC5\u5728\u672C\u5730\u5F00\u53D1\u548C\u6D4B\u8BD5\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305\u3002","\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"\u8F6F\u4EF6\u5305\u53EF\u4EE5\u7406\u89E3\u4E3A\u662F\u7B2C\u4E09\u65B9\u7684 npm \u5305\u3002"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install npm-package-name"})," \u6216\u8005 ",(0,s.jsx)(n.code,{children:"npm add npm-package-name"})," \u7684\u65B9\u5F0F\u6765\u5B89\u88C5\u5728",(0,s.jsx)(n.strong,{children:"\u751F\u4EA7\u73AF\u5883\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305"}),"\uFF0C\u6216\u8005\u4E5F\u53EF\u4EE5\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u624B\u52A8\u7684\u5C06\u9700\u8981\u5B89\u88C5\u7684\u5305\u548C\u5BF9\u5E94\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"\u8BED\u4E49\u5316\u7248\u672C"}),"\u5199\u5728 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u91CC\uFF0C\u5E76\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install"})," \u547D\u4EE4\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "dependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u540C\u7406\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install npm-package-name --save-dev"})," \u6216 ",(0,s.jsx)(n.code,{children:"npm add npm-package-name --save-dev"})," \u7684\u65B9\u5F0F\u6765\u5B89\u88C5",(0,s.jsx)(n.strong,{children:"\u4EC5\u5728\u672C\u5730\u5F00\u53D1\u548C\u6D4B\u8BD5\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305"}),"\uFF0C\u6216\u8005\u4E5F\u53EF\u4EE5\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u624B\u52A8\u7684\u5C06\u9700\u8981\u5B89\u88C5\u7684\u5305\u548C\u5BF9\u5E94\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"\u8BED\u4E49\u5316\u7248\u672C"}),"\u5199\u5728 ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u91CC\uFF0C\u5E76\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install"})," \u547D\u4EE4\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "devDependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["\u5728\u5B89\u88C5\u6216\u8005\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305\u7684\u65F6\u5019\u4E00\u5B9A\u8981\u786E\u5B9A\u5B83\u4EEC\u7684\u7528\u9014\uFF0C\u4EE5\u53CA\u901A\u8FC7\u533A\u5206\u5B83\u4EEC\u7684\u7C7B\u578B\u786E\u5B9A\u597D\u5B83\u4EEC\u5E94\u8BE5\u653E\u5728 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u8FD8\u662F ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u4E2D\u3002"]})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4E00\u822C\u6765\u8BF4\uFF0C\u9700\u8981\u5728\u6E90\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u5305\u90FD\u5C5E\u4E8E ",(0,s.jsx)(n.code,{children:"dependencies"})," \u4F9D\u8D56\u3002\u9664\u975E\u4F60\u901A\u8FC7\u6253\u5305\u7684\u65B9\u5F0F\u5C06\u4F9D\u8D56\u7684\u4EE3\u7801\u8F93\u51FA\u5230\u672C\u5730\uFF0C\u90A3\u4E48\u8FD9\u79CD\u60C5\u51B5\u53EF\u4EE5\u5C06\u5B83\u4F5C\u4E3A ",(0,s.jsx)(n.code,{children:"devDependencies"})," \u4F9D\u8D56\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",children:["\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",children:["npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u5B58\u5728\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\uFF0C\u5B83\u5BF9\u5E94\u7684\u503C\u662F\u4E00\u4E2A\u6A21\u5757 ID\uFF0C\u6216\u8005\u66F4\u76F4\u89C2\u7684\u8BF4\u662F\u4E00\u4E2A NodeJS \u6587\u4EF6\u8DEF\u5F84\uFF0C\u5B83\u662F\u4F60\u7A0B\u5E8F\u7684\u4E3B\u8981\u5165\u53E3\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4F8B\u5982\u4F60\u7684\u5305\u540D\u4E3A ",(0,s.jsx)(n.code,{children:"foo"}),"\uFF0C\u5E76\u4E14\u7528\u6237\u5B89\u88C5\u4E86\u5B83\uFF0C\u7136\u540E\u6267\u884C ",(0,s.jsx)(n.code,{children:'require("foo")'})," \u4EE3\u7801\uFF0C\u90A3\u4E48 ",(0,s.jsx)(n.code,{children:"foo"})," \u8FD9\u4E2A npm \u5305\u7684 ",(0,s.jsx)(n.code,{children:'"main"'})," \u5B57\u6BB5\u5BF9\u5E94\u7684\u6587\u4EF6\u5C06\u4F1A\u88AB\u5BFC\u51FA\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["\u63A8\u8350\u5728\u4F60\u7684 npm \u5305\u91CC\u4E00\u5B9A\u8981\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5B57\u6BB5"]}),"\u3002\u5982\u679C\u6CA1\u6709\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'}),"\uFF0C\u5219\u9ED8\u8BA4\u5165\u53E3\u4E3A\u5305\u7684\u6839\u76EE\u5F55\u4E0B\u7684 ",(0,s.jsx)(n.code,{children:"index.js"})," \u6587\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86\u9700\u8981\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\u4EE5\u5916\uFF0C\u4E00\u822C\u8FD8\u4F1A\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"module"'})," \u5C5E\u6027\u3002\u5B83\u4E0E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\u7684\u7528\u9014\u7C7B\u4F3C\uFF0C\u5B83\u4E3B\u8981\u662F\u7528\u4E8E\u5728 webpack \u573A\u666F\u4E0B\u4F7F\u7528\u3002webpack \u5728\u5927\u591A\u6570\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u4EE5 ",(0,s.jsx)(n.strong,{children:'"module" -> "main"'})," \u8FD9\u4E2A\u987A\u5E8F\u8BFB\u53D6 npm \u5305\u7684\u5165\u53E3\uFF08\u6587\u4EF6\uFF09\u3002"]}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u60F3\u8981\u4E86\u89E3\u5173\u4E8E webpack \u5982\u4F55\u505A\u8FD9\u4EF6\u4E8B\uFF0C\u53EF\u4EE5\u67E5\u770B\u8FD9\u4E2A",(0,s.jsx)(n.a,{href:"https://webpack.js.org/configuration/resolve/#resolvemainfields",target:"_blank",rel:"noopener noreferrer",children:"\u94FE\u63A5"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"scripts",children:['"scripts"',(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u7684 ",(0,s.jsx)(n.code,{children:'"scripts"'})," \u5C5E\u6027\u652F\u6301\u4E00\u4E9B\u5185\u7F6E\u7684\u811A\u672C\u548C npm \u9884\u8BBE\u7684\u751F\u547D\u5468\u671F\u4E8B\u4EF6\uFF0C\u4EE5\u53CA\u4EFB\u610F\u7684\u811A\u672C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u4E9B\u90FD\u53EF\u4EE5\u901A\u8FC7\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm run-script "})," \u6216\u7B80\u79F0 ",(0,s.jsx)(n.code,{children:"npm run "})," \u6765\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u540D\u79F0\u5339\u914D\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts",target:"_blank",rel:"noopener noreferrer",children:"\u524D\u7F6E\u547D\u4EE4\u548C\u540E\u7F6E\u547D\u4EE4"}),"\u4E5F\u4F1A\u88AB\u8FD0\u884C\uFF08\u4F8B\u5982 ",(0,s.jsx)(n.code,{children:"premyscript"}),"\u3001",(0,s.jsx)(n.code,{children:"myscript"}),"\u3001",(0,s.jsx)(n.code,{children:"postmyscript"}),"\uFF09\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "premyscript": "",\n "myscript": "",\n "postmyscript": ""\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm run myscripts"})," \u7684\u65F6\u5019\uFF0C",(0,s.jsx)(n.code,{children:"premyscripts"})," \u5BF9\u5E94\u7684\u811A\u672C\u4F1A\u5728\u5B83\u4E4B\u524D\u6267\u884C\uFF0C",(0,s.jsx)(n.code,{children:"postmyscripts"})," \u5BF9\u5E94\u7684\u811A\u672C\u4F1A\u5728\u5B83\u4E4B\u540E\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6765\u81EA\u4F9D\u8D56\u7684\u811A\u672C\u547D\u4EE4\u53EF\u4EE5\u7528 ",(0,s.jsx)(n.code,{children:"npm explore -- npm run "})," \u8FD0\u884C\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u8FD8\u6709\u4E00\u4E9B\u7279\u6B8A\u7684\u751F\u547D\u5468\u671F\u811A\u672C\uFF08Life Scripts\uFF09\uFF0C\u53EA\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\u53D1\u751F\u3002\u8FD9\u91CC\u4ECB\u7ECD\u51E0\u4E2A\u901A\u5E38\u9700\u8981\u4E86\u89E3\u7684\u60C5\u51B5\u3002"}),"\n",(0,s.jsxs)(n.h4,{id:"npm-install",children:[(0,s.jsx)(n.code,{children:"npm install"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-install",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u4F60\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm install -g "})," \u65F6\uFF0C\u4EE5\u4E0B\u811A\u672C\u4F1A\u8FD0\u884C\u3002"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"preinstall"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"install"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postinstall"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepublish"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"preprepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postprepare"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u7684\u8F6F\u4EF6\u5305\u6839\u76EE\u5F55\u6709\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"binding.gyp"})," \u6587\u4EF6\uFF0C\u800C\u4F60\u6CA1\u6709\u5B9A\u4E49 ",(0,s.jsx)(n.code,{children:"install"})," \u6216 ",(0,s.jsx)(n.code,{children:"preinstall"})," \u811A\u672C\uFF0C\u90A3\u4E48 npm \u5C06\u4EE5 ",(0,s.jsx)(n.code,{children:"node-gyp rebuild"})," \u4F5C\u4E3A\u9ED8\u8BA4\u7684 install \u547D\u4EE4\uFF0C\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/node-gyp",target:"_blank",rel:"noopener noreferrer",children:"node-gyp"})," \u8FDB\u884C\u7F16\u8BD1\u3002"]}),"\n",(0,s.jsxs)(n.h4,{id:"npm-publish",children:[(0,s.jsx)(n.code,{children:"npm publish"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-publish",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\uFF0C\u6267\u884C\u8BE5\u547D\u4EE4\u4F1A\u89E6\u53D1\u4EE5\u4E0B\u811A\u672C\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepublishOnly"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepack"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postpack"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"publish"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postpublish"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u4EE5 ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(n.code,{children:"--dry-run"})})," \u6A21\u5F0F\u8FD0\u884C\u7684\u65F6\u5019\uFF0C",(0,s.jsx)(n.code,{children:"prepare"})," \u5BF9\u5E94\u7684\u811A\u672C\u5C06\u4E0D\u4F1A\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"peerdependencies",children:["peerDependencies",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#peerdependencies",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4F60\u7684 npm \u9879\u76EE\u4E0E\u5B83\u7684\u5BBF\u4E3B\u5DE5\u5177\u6216\u8005\u5E93\u4E4B\u95F4\u5B58\u5728\u67D0\u79CD\u517C\u5BB9\u5173\u7CFB\uFF08\u4F8B\u5982\u4E00\u4E2A webpack \u63D2\u4EF6\u9879\u76EE\u548C webpack\uFF09\uFF0C\u540C\u65F6\u4F60\u7684 npm \u9879\u76EE\u4E0D\u60F3\u5C06\u5BBF\u4E3B\u4F5C\u4E3A\u5FC5\u8981\u7684\u4F9D\u8D56\uFF0C\u8FD9\u4E2A\u65F6\u5019\u901A\u5E38\u8BF4\u660E\u4F60\u7684\u9879\u76EE\u53EF\u80FD\u662F\u8FD9\u4E2A\u5BBF\u4E3B\u5DE5\u5177\u6216\u8005\u5E93\u7684\u63D2\u4EF6\u3002\u4F60\u7684 npm \u9879\u76EE\u4F1A\u5BF9\u5BBF\u4E3B\u5305\u7684\u7248\u672C\u6709\u4E00\u5B9A\u7684\u8981\u6C42\uFF0C\u56E0\u4E3A\u53EA\u6709\u5728\u7279\u5B9A\u7684\u7248\u672C\u4E0B\u624D\u4F1A\u66B4\u9732\u51FA npm \u9879\u76EE\u6240\u9700\u8981\u7684 API\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u5173\u4E8E\u66F4\u591A ",(0,s.jsx)(n.code,{children:"peerDependencies"})," \u7684\u89E3\u91CA\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u94FE\u63A5\u4E86\u89E3 npm\u3001pnpm\u3001Yarn \u5BF9\u4E8E\u5B83\u7684\u4E0D\u540C\u5904\u7406\u65B9\u5F0F\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies",target:"_blank",rel:"noopener noreferrer",children:"npm \u5BF9 peerDependencies \u7684\u89E3\u91CA"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://pnpm.io/feature-comparison",target:"_blank",rel:"noopener noreferrer",children:"pnpm vs npm VS Yarn"})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"npm-\u5305\u7BA1\u7406\u5668",children:["npm \u5305\u7BA1\u7406\u5668",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7BA1\u7406\u5668",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 npm \u8FD9\u79CD\u6807\u51C6\u7684\u5305\u7BA1\u7406\u5668\u4EE5\u5916\uFF0C\u76EE\u524D\u4E3B\u6D41\u7684\u8FD8\u6709 ",(0,s.jsx)(n.strong,{children:"pnpm"})," \u548C ",(0,s.jsx)(n.strong,{children:"Yarn"}),"\uFF0C\u5B83\u4EEC\u90FD\u662F\u4E0D\u9519\u7684 npm cli \u66FF\u4EE3\u54C1\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://pnpm.io/installation",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})," \u6765\u7BA1\u7406\u9879\u76EE\u4F9D\u8D56\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u65B9\u5F0F\u5B89\u88C5\u5B83\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"npm install -g pnpm\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",children:["Modern.js Module \u914D\u7F6E\u6587\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u914D\u7F6E\u6587\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"@modern-js/create"})," \u521B\u5EFA\u7684\u9879\u76EE\u76EE\u5F55\u4E0B\u63D0\u4F9B\u4E86 Modern.js Module \u7684\u914D\u7F6E\u6587\u4EF6 \u2014\u2014 ",(0,s.jsx)(n.code,{children:"modern.config.(j|t)s"}),"\u3002\u4F46 ",(0,s.jsx)(n.code,{children:"modern.config"})," \u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5FC5\u987B\u5B58\u5728\u7684\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u751F\u6210\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["\u6211\u4EEC\u63A8\u8350\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"defineConfig"})," \u51FD\u6570"]}),"\uFF0C\u4E0D\u8FC7\u5E76\u4E0D\u5F3A\u5236\u4F7F\u7528\u5B83\u3002\u56E0\u6B64\u4F60\u4E5F\u53EF\u4EE5\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u76F4\u63A5\u8FD4\u56DE\u4E00\u4E2A\u5BF9\u8C61\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools } from '@modern-js/module-tools';\n\nexport default {\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n};\n"})})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fbefore-getting-started.md"]={toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3},{text:'"scripts"',id:"scripts",depth:3},{text:"`npm install`",id:"npm-install",depth:4},{text:"`npm publish`",id:"npm-publish",depth:4},{text:"peerDependencies",id:"peerdependencies",depth:3},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2}],title:"\u5F00\u59CB\u4E4B\u524D",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3747.04231f3b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/310.4253327a.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3747.04231f3b.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/310.4253327a.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6760.5df82a32.js b/modern-js/module-tools/static/js/async/3104.877feaa0.js similarity index 98% rename from modern-js/module-tools/static/js/async/6760.5df82a32.js rename to modern-js/module-tools/static/js/async/3104.877feaa0.js index b2b9147460..07480ca8b2 100644 --- a/modern-js/module-tools/static/js/async/6760.5df82a32.js +++ b/modern-js/module-tools/static/js/async/3104.877feaa0.js @@ -1,2 +1,2 @@ -/*! For license information please see 6760.5df82a32.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6760"],{45077:function(e,n,d){"use strict";d.r(n);var i=d("39980"),s=d("9580");function c(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",pre:"pre",h2:"h2",strong:"strong",h3:"h3",ul:"ul",li:"li",blockquote:"blockquote"},(0,s.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"handle-third-party-dependencies",children:["Handle third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#handle-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Generally, third-party dependencies required by a project can be installed via the ",(0,i.jsx)(n.code,{children:"install"})," command in the package manager. After the third-party dependencies are successfully installed, they will generally appear under ",(0,i.jsx)(n.code,{children:"dependencies"})," and ",(0,i.jsx)(n.code,{children:"devDependencies"})," in the project ",(0,i.jsx)(n.code,{children:"package.json"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="pacakge.json"',children:'{\n "dependencies": {},\n "devDependencies": {}\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," are generally related to project code and builds, and if these third-party dependencies are declared under ",(0,i.jsx)(n.code,{children:'"devDependencies"'}),", then there will be missing dependencies in production environments."]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to ",(0,i.jsx)(n.code,{children:'"dependencies"'}),", ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started#peerdependencies",children:(0,i.jsx)(n.code,{children:'"peerDependencies"'})})," can also declare dependencies that are needed in the production environment, but it puts more emphasis on the existence of these dependencies declared by ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," in the project's runtime environment, similar to the plugin mechanism."]}),"\n",(0,i.jsxs)(n.h2,{id:"default-handling-of-third-party-dependencies",children:["Default handling of third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#default-handling-of-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["By default, ",(0,i.jsxs)(n.strong,{children:["third-party dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," and ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," are not bundled by Modern.js Module"]}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["This is because when the npm package is installed, its ",(0,i.jsx)(n.code,{children:'"dependencies"'})," will also be installed. By not packaging ",(0,i.jsx)(n.code,{children:'"dependencies"'}),", you can reduce the size of the package product."]}),"\n",(0,i.jsxs)(n.p,{children:["If you need to package some dependencies, it is recommended to move them from ",(0,i.jsx)(n.code,{children:'"dependencies"'})," to ",(0,i.jsx)(n.code,{children:'"devDependencies"'}),", which is equivalent to ",(0,i.jsx)(n.strong,{children:"prebundle"})," the dependencies and reduces the size of the dependency installation."]}),"\n",(0,i.jsxs)(n.h3,{id:"example",children:["Example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["If the project has a dependency on ",(0,i.jsx)(n.code,{children:"react"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n },\n // or\n "peerDependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"react"})," code is not bundled into the artifact:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsx)(n.p,{children:"If you want to modify the default processing, you can use the following API."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})})}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"exclude-specified-third-party-dependencies",children:["Exclude specified third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude-specified-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["We mentioned above the use of the ",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," API, and ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"buildConfig.externals"})})," can control which third-party dependencies to handle\nthe project's dependencies in a more granular way."]}),"\n",(0,i.jsx)(n.p,{children:"For example, when we need to leave only certain dependencies unpacked, we can configure it as follows."}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsx)(n.p,{children:"In this case, it is likely that some dependencies are not suitable for packaging. If this is the case, then you can handle it as follows."}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"epxort default defineConfig({\n buildConfig: {\n autoExternal: false,\n externals: ['pkg-1', /pkg-2/],\n }\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fexternal-dependency.mdx"]={toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2},{text:"Example",id:"example",depth:3},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2}],title:"Handle third-party dependencies",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file +/*! For license information please see 3104.877feaa0.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3104"],{72397:function(e,n,d){"use strict";d.r(n);var i=d("39980"),s=d("9580");function c(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",pre:"pre",h2:"h2",strong:"strong",h3:"h3",ul:"ul",li:"li",blockquote:"blockquote"},(0,s.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"handle-third-party-dependencies",children:["Handle third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#handle-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Generally, third-party dependencies required by a project can be installed via the ",(0,i.jsx)(n.code,{children:"install"})," command in the package manager. After the third-party dependencies are successfully installed, they will generally appear under ",(0,i.jsx)(n.code,{children:"dependencies"})," and ",(0,i.jsx)(n.code,{children:"devDependencies"})," in the project ",(0,i.jsx)(n.code,{children:"package.json"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="pacakge.json"',children:'{\n "dependencies": {},\n "devDependencies": {}\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," are generally related to project code and builds, and if these third-party dependencies are declared under ",(0,i.jsx)(n.code,{children:'"devDependencies"'}),", then there will be missing dependencies in production environments."]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to ",(0,i.jsx)(n.code,{children:'"dependencies"'}),", ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started#peerdependencies",children:(0,i.jsx)(n.code,{children:'"peerDependencies"'})})," can also declare dependencies that are needed in the production environment, but it puts more emphasis on the existence of these dependencies declared by ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," in the project's runtime environment, similar to the plugin mechanism."]}),"\n",(0,i.jsxs)(n.h2,{id:"default-handling-of-third-party-dependencies",children:["Default handling of third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#default-handling-of-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["By default, ",(0,i.jsxs)(n.strong,{children:["third-party dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," and ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," are not bundled by Modern.js Module"]}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["This is because when the npm package is installed, its ",(0,i.jsx)(n.code,{children:'"dependencies"'})," will also be installed. By not packaging ",(0,i.jsx)(n.code,{children:'"dependencies"'}),", you can reduce the size of the package product."]}),"\n",(0,i.jsxs)(n.p,{children:["If you need to package some dependencies, it is recommended to move them from ",(0,i.jsx)(n.code,{children:'"dependencies"'})," to ",(0,i.jsx)(n.code,{children:'"devDependencies"'}),", which is equivalent to ",(0,i.jsx)(n.strong,{children:"prebundle"})," the dependencies and reduces the size of the dependency installation."]}),"\n",(0,i.jsxs)(n.h3,{id:"example",children:["Example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["If the project has a dependency on ",(0,i.jsx)(n.code,{children:"react"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n },\n // or\n "peerDependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"react"})," code is not bundled into the artifact:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsx)(n.p,{children:"If you want to modify the default processing, you can use the following API."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})})}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"exclude-specified-third-party-dependencies",children:["Exclude specified third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude-specified-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["We mentioned above the use of the ",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," API, and ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"buildConfig.externals"})})," can control which third-party dependencies to handle\nthe project's dependencies in a more granular way."]}),"\n",(0,i.jsx)(n.p,{children:"For example, when we need to leave only certain dependencies unpacked, we can configure it as follows."}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsx)(n.p,{children:"In this case, it is likely that some dependencies are not suitable for packaging. If this is the case, then you can handle it as follows."}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"epxort default defineConfig({\n buildConfig: {\n autoExternal: false,\n externals: ['pkg-1', /pkg-2/],\n }\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fexternal-dependency.mdx"]={toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2},{text:"Example",id:"example",depth:3},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2}],title:"Handle third-party dependencies",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3497.4327456e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3104.877feaa0.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3497.4327456e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3104.877feaa0.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/330.0937e30f.js b/modern-js/module-tools/static/js/async/330.0937e30f.js new file mode 100644 index 0000000000..5691596e00 --- /dev/null +++ b/modern-js/module-tools/static/js/async/330.0937e30f.js @@ -0,0 +1,2 @@ +/*! For license information please see 330.0937e30f.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["330"],{89324:function(e,r,n){"use strict";n.r(r);var s=n("39980"),i=n("9580");function o(e){let r=Object.assign({h1:"h1",a:"a"},(0,i.ah)(),e.components);return(0,s.jsxs)(r.h1,{id:"overview",children:["Overview",(0,s.jsx)(r.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:r}=Object.assign({},(0,i.ah)(),e.components);return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}r.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fapi%2Findex.md"]={toc:[],title:"Overview",frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3760.a3abbc2c.js.LICENSE.txt b/modern-js/module-tools/static/js/async/330.0937e30f.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3760.a3abbc2c.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/330.0937e30f.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3351.9d189162.js b/modern-js/module-tools/static/js/async/3351.9d189162.js deleted file mode 100644 index 0655a4ca01..0000000000 --- a/modern-js/module-tools/static/js/async/3351.9d189162.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 3351.9d189162.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3351"],{77419:function(e,o,r){"use strict";r.r(o);var n=r("39980"),s=r("9580");function t(e){let o=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",ul:"ul",li:"li",pre:"pre",ol:"ol",img:"img"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"storybook-faq",children:["Storybook FAQ",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-faq",children:"#"})]}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-v7-support",children:["Storybook v7 Support",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-v7-support",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook v7 is now fully supported and has become our recommended version."}),"\n",(0,n.jsxs)(o.h2,{id:"using-storybook-addon-or-other-configurations-does-not-work",children:["Using Storybook Addon or other configurations does not work",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#using-storybook-addon-or-other-configurations-does-not-work",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Modern.js Module is currently using Storybook version v6, if you are using Addon version v7 you may not be able to get the addon to work."}),"\n",(0,n.jsxs)(o.p,{children:["In addition to the Addon, other configurations may also have differences. For example, if you modify the ",(0,n.jsx)(o.code,{children:"preview.js"})," configuration file, Storybook v6 is written differently than v7:"]}),"\n",(0,n.jsxs)(o.ul,{children:["\n",(0,n.jsxs)(o.li,{children:["v6\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/6.5/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"Document"})]}),"\n",(0,n.jsxs)(o.li,{children:["v7\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"Document"})]}),"\n"]}),"\n",(0,n.jsxs)(o.h2,{id:"cannot-find-module-react-dompackagejson",children:["Cannot find module 'react-dom/package.json",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-react-dompackagejson",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"When debug Storybook, the following problem occurs:"}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-bash",children:"ERR! Error: Cannot find module 'react-dom/package.json'\n"})}),"\n",(0,n.jsx)(o.p,{children:"You can install the react-dom dependency in the project."}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-json",children:'{\n "devDependencies": {\n "react-dom": "^17"\n }\n}\n'})}),"\n",(0,n.jsxs)(o.h2,{id:"unable-to-locate-the-specific-error-message",children:["Unable to locate the specific error message",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#unable-to-locate-the-specific-error-message",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Solutions:"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["Find ",(0,n.jsx)(o.code,{children:"@storybook/core-server/dist/cjs/dev-server.js"})]}),"\n",(0,n.jsxs)(o.li,{children:["Find this code: ",(0,n.jsx)(o.code,{children:"var _await$Promise$all = await Promise.all([preview, manager,"}),"."]}),"\n",(0,n.jsx)(o.li,{children:"Modify it\uFF1A"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"var _await$Promise$all = await Promise.all([\n preview.catch(e => console.info(e)),\n manager // TODO #13083 Restore this when compiling the preview is fast enough\n // .then((result) => {\n // if (!options.ci && !options.smokeTest) openInBrowser(address);\n // return result;\n // })\n .catch(previewBuilder.bail)]),\n _await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),\n previewResult = _await$Promise$all2[0],\n managerResult = _await$Promise$all2[1]; // TODO #13083 Remove this when compiling the preview is fast enough\n"})}),"\n",(0,n.jsxs)(o.h2,{id:"cant-find-any-stories-is-your-storybook",children:["Can`t find any stories is your Storybook",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cant-find-any-stories-is-your-storybook",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/01719a11-1939-4009-9317-5e2b491ae52f.png",alt:"storybook-error"})}),"\n",(0,n.jsx)(o.p,{children:"When you get a problem like this, you can first open the browser console and there should be some error messages. You can use the error messages to deduce if there is a problem in the code you are writing that is causing Storybook to not work properly."}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-adds-proxy-functionality",children:["Storybook Adds Proxy Functionality",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-adds-proxy-functionality",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook does not provide a solution for this, but there is one in the Storybook Issue. In the Modern.js Module, you can:"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["Add the ",(0,n.jsx)(o.code,{children:"config/storybook/middleware.js"})," file and initialize the following:"]}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"/* eslint-disable filenames/match-exported */\nmodule.exports = function expressMiddleware(router) {\n // router is express router\n // import { Router } from 'express'\n // router = new Router();\n};\n"})}),"\n",(0,n.jsxs)(o.ol,{start:"2",children:["\n",(0,n.jsxs)(o.li,{children:["add ",(0,n.jsx)(o.code,{children:"http-proxy-middleware"})," dependency"]}),"\n",(0,n.jsx)(o.li,{children:"Add proxy routing-related configuration"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:'/* eslint-disable filenames/match-exported */\nconst { createProxyMiddleware } = require("http-proxy-middleware");\n\nmodule.exports = function expressMiddleware (router) {\n router.use(\'/api\', createProxyMiddleware({\n target: "http://localhost:8000",\n changeOrigin: true\n }))\n}\n'})}),"\n",(0,n.jsxs)(o.p,{children:["Link\uFF1A",(0,n.jsx)(o.a,{href:"https://github.com/storybookjs/storybook/issues/11551",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/storybookjs/storybook/issues/11551"})]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(t,{...e})}):t(e)}o.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Fstorybook.mdx"]={toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2},{text:"Cannot find module 'react-dom/package.json",id:"cannot-find-module-react-dompackagejson",depth:2},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2}],title:"Storybook FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/347.49ac8f09.js b/modern-js/module-tools/static/js/async/347.49ac8f09.js new file mode 100644 index 0000000000..d41cfa2286 --- /dev/null +++ b/modern-js/module-tools/static/js/async/347.49ac8f09.js @@ -0,0 +1,2 @@ +/*! For license information please see 347.49ac8f09.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["347"],{29602:function(e,n,r){"use strict";r.r(n);var s=r("39980"),i=r("9580"),d=r("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"banner-\u63D2\u4EF6",children:["Banner \u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS \u548C CSS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE ",(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," 2.36.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BE5\u63D2\u4EF6\u529F\u80FD\u5185\u7F6E\u5728 Modern.js Module \u4E2D\uFF0C\u7531 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#banner",children:(0,s.jsx)(n.code,{children:"banner"})})," \u548C ",(0,s.jsx)(n.a,{href:"/api/config/build-config#footer",children:(0,s.jsx)(n.code,{children:"footer"})}),"\n\u914D\u7F6E\u63D0\u4F9B\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(d.SU,{command:"add @modern-js/plugin-module-banner -D"}),"\n",(0,s.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBanner } from '@modern-js/plugin-module-banner';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: '//comment',\n css: '/*comment*/',\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u6CE8\u610F\uFF1ACSS \u7684\u6CE8\u91CA\u4E0D\u652F\u6301 ",(0,s.jsx)(n.code,{children:"//comment"})," \u8FD9\u6837\u7684\u5199\u6CD5\u3002\u8BE6\u89C1",(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/zh-CN/docs/Web/CSS/Comments",target:"_blank",rel:"noopener noreferrer",children:"\u300CCSS \u6CE8\u91CA\u300D"}),"\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",children:["\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginBanner } from '@modern-js/plugin-module-banner';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: copyRight,\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type BannerOptions = {\n banner: {\n js?: string;\n css?: string;\n };\n footer?: {\n js?: string;\n css?: string;\n };\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"banner",children:["banner",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"banner.js"}),"\uFF1A\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"banner.css"}),"\uFF1A\u5728 CSS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"footer",children:["footer",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"footer.js"}),"\uFF1A\u5728 JS \u6587\u4EF6\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"footer.css"}),"\uFF1A\u5728 CSS \u6587\u4EF6\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-banner.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"banner",id:"banner",depth:3},{text:"footer",id:"footer",depth:3}],title:"Banner \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/281.ed5dacc6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/347.49ac8f09.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/281.ed5dacc6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/347.49ac8f09.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5102.71057cf8.js b/modern-js/module-tools/static/js/async/3535.ebab774e.js similarity index 97% rename from modern-js/module-tools/static/js/async/5102.71057cf8.js rename to modern-js/module-tools/static/js/async/3535.ebab774e.js index 8162830523..e9970a30c9 100644 --- a/modern-js/module-tools/static/js/async/5102.71057cf8.js +++ b/modern-js/module-tools/static/js/async/3535.ebab774e.js @@ -1,2 +1,2 @@ -/*! For license information please see 5102.71057cf8.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5102"],{68687:function(e,n,i){"use strict";i.r(n);var r=i("39980"),d=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",h4:"h4"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"plugins",children:["plugins",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugins",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u6CE8\u518C Modern.js Module \u63D2\u4EF6\u7684\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(n.code,{children:"ModuleToolsPlugin[]"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",children:["\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F1A\u6309\u7167 ",(0,r.jsx)(n.code,{children:"plugins"})," \u6570\u7EC4\u7684\u987A\u5E8F\u4F9D\u6B21\u6267\u884C\uFF0CModern.js Module \u5185\u7F6E\u63D2\u4EF6\u7684\u6267\u884C\u65F6\u673A\u65E9\u4E8E\u81EA\u5B9A\u4E49\u63D2\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u63D2\u4EF6\u5185\u90E8\u4F7F\u7528\u4E86\u63A7\u5236\u987A\u5E8F\u7684\u76F8\u5173\u5B57\u6BB5\uFF0C\u6BD4\u5982 ",(0,r.jsx)(n.code,{children:"pre"}),"\u3001",(0,r.jsx)(n.code,{children:"post"})," \u65F6\uFF0C\u4F1A\u57FA\u4E8E\u58F0\u660E\u7684\u5B57\u6BB5\u5BF9\u6267\u884C\u987A\u5E8F\u8FDB\u884C\u8C03\u6574\uFF0C\u8BE6\u89C1 ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/relationship",target:"_blank",rel:"noopener noreferrer",children:"\u63D2\u4EF6\u4E4B\u95F4\u7684\u5173\u7CFB"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5F00\u53D1\u63D2\u4EF6",children:["\u5F00\u53D1\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5173\u4E8E\u5982\u4F55\u7F16\u5199\u63D2\u4EF6\uFF0C\u53EF\u4EE5\u67E5\u770B",(0,r.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"\u300C\u63D2\u4EF6\u7F16\u5199\u6307\u5357\u300D"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",children:["\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6\uFF0C\u9700\u8981\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u5B89\u88C5\u63D2\u4EF6\uFF0C\u5E76\u901A\u8FC7 import \u5F15\u5165\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from 'my-plugin';\n\nexport default defineConfig({\n plugins: [myPlugin()],\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",children:["\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4F7F\u7528\u672C\u5730\u4EE3\u7801\u4ED3\u5E93\u4E2D\u7684\u63D2\u4EF6\uFF0C\u76F4\u63A5\u901A\u8FC7\u76F8\u5BF9\u8DEF\u5F84 import \u5F15\u5165\u5373\u53EF\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from './plugins/myPlugin';\n\nexport default defineConfig({\n plugins: [myPlugin()],\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"\u63D2\u4EF6\u914D\u7F6E\u9879",children:["\u63D2\u4EF6\u914D\u7F6E\u9879",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E\u9879",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u63D2\u4EF6\u63D0\u4F9B\u4E86\u4E00\u4E9B\u81EA\u5B9A\u4E49\u7684\u914D\u7F6E\u9879\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u63D2\u4EF6\u51FD\u6570\u7684\u53C2\u6570\u4F20\u5165\u914D\u7F6E\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from 'my-plugin';\n\nexport default defineConfig({\n plugins: [\n myPlugin({\n foo: 1,\n bar: 2,\n }),\n ],\n});\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fplugins.md"]={toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3}],title:"plugins",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file +/*! For license information please see 3535.ebab774e.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3535"],{11485:function(e,n,i){"use strict";i.r(n);var r=i("39980"),d=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",h4:"h4"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"plugins",children:["plugins",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugins",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u6CE8\u518C Modern.js Module \u63D2\u4EF6\u7684\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(n.code,{children:"ModuleToolsPlugin[]"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",children:["\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F1A\u6309\u7167 ",(0,r.jsx)(n.code,{children:"plugins"})," \u6570\u7EC4\u7684\u987A\u5E8F\u4F9D\u6B21\u6267\u884C\uFF0CModern.js Module \u5185\u7F6E\u63D2\u4EF6\u7684\u6267\u884C\u65F6\u673A\u65E9\u4E8E\u81EA\u5B9A\u4E49\u63D2\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u63D2\u4EF6\u5185\u90E8\u4F7F\u7528\u4E86\u63A7\u5236\u987A\u5E8F\u7684\u76F8\u5173\u5B57\u6BB5\uFF0C\u6BD4\u5982 ",(0,r.jsx)(n.code,{children:"pre"}),"\u3001",(0,r.jsx)(n.code,{children:"post"})," \u65F6\uFF0C\u4F1A\u57FA\u4E8E\u58F0\u660E\u7684\u5B57\u6BB5\u5BF9\u6267\u884C\u987A\u5E8F\u8FDB\u884C\u8C03\u6574\uFF0C\u8BE6\u89C1 ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/relationship",target:"_blank",rel:"noopener noreferrer",children:"\u63D2\u4EF6\u4E4B\u95F4\u7684\u5173\u7CFB"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5F00\u53D1\u63D2\u4EF6",children:["\u5F00\u53D1\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5173\u4E8E\u5982\u4F55\u7F16\u5199\u63D2\u4EF6\uFF0C\u53EF\u4EE5\u67E5\u770B",(0,r.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"\u300C\u63D2\u4EF6\u7F16\u5199\u6307\u5357\u300D"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",children:["\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6\uFF0C\u9700\u8981\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u5B89\u88C5\u63D2\u4EF6\uFF0C\u5E76\u901A\u8FC7 import \u5F15\u5165\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from 'my-plugin';\n\nexport default defineConfig({\n plugins: [myPlugin()],\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",children:["\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4F7F\u7528\u672C\u5730\u4EE3\u7801\u4ED3\u5E93\u4E2D\u7684\u63D2\u4EF6\uFF0C\u76F4\u63A5\u901A\u8FC7\u76F8\u5BF9\u8DEF\u5F84 import \u5F15\u5165\u5373\u53EF\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from './plugins/myPlugin';\n\nexport default defineConfig({\n plugins: [myPlugin()],\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"\u63D2\u4EF6\u914D\u7F6E\u9879",children:["\u63D2\u4EF6\u914D\u7F6E\u9879",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E\u9879",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u63D2\u4EF6\u63D0\u4F9B\u4E86\u4E00\u4E9B\u81EA\u5B9A\u4E49\u7684\u914D\u7F6E\u9879\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u63D2\u4EF6\u51FD\u6570\u7684\u53C2\u6570\u4F20\u5165\u914D\u7F6E\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myPlugin } from 'my-plugin';\n\nexport default defineConfig({\n plugins: [\n myPlugin({\n foo: 1,\n bar: 2,\n }),\n ],\n});\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fplugins.md"]={toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3}],title:"plugins",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3637.128b81a4.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3535.ebab774e.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3637.128b81a4.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3535.ebab774e.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/358.5fbfed29.js b/modern-js/module-tools/static/js/async/358.5fbfed29.js deleted file mode 100644 index 2bc5081416..0000000000 --- a/modern-js/module-tools/static/js/async/358.5fbfed29.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 358.5fbfed29.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["358"],{81705:function(e,n,s){"use strict";s.r(n);var r=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",h2:"h2",h3:"h3",code:"code",pre:"pre",ul:"ul",li:"li",ol:"ol",h4:"h4",img:"img"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",children:["\u6784\u5EFA\u76F8\u5173\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u8FD9\u91CC\u53EA\u8BB0\u5F55\u4E86\u4E00\u4E9B\u5E38\u89C1\u95EE\u9898\u548C bad case\u3002"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["\u5982\u679C\u662F\u6784\u5EFA\u4EA7\u7269\u4E0D\u7B26\u5408\u9884\u671F\u7684\u573A\u666F\uFF0C\u5C24\u5176\u662F\u914D\u7F6E\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-preset",children:"buildPreset"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\n\u8BF7\u5148\u4E86\u89E3 buildPreset \u4EE3\u8868\u4E86\u54EA\u4E9B\u914D\u7F6E\u9879\uFF0C\u518D\u6839\u636E\u6240\u6709\u7684\u914D\u7F6E\u9879\u9010\u4E2A\u68C0\u67E5"]})}),"\n",(0,r.jsxs)(n.h2,{id:"\u4EA7\u7269\u95EE\u9898",children:["\u4EA7\u7269\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4EA7\u7269\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",children:["Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["TypeSript \u63D0\u4F9B\u4E86 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\u7528\u4E8E\u63A7\u5236\u5BF9\u4E8E ",(0,r.jsx)(n.code,{children:"public class fields"})," \u7684\u8F6C\u6362\u5904\u7406\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u6709\u4E00\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n foo = 100;\n bar: string;\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u4E3A ",(0,r.jsx)(n.code,{children:"false"})," \u7684\u65F6\u5019\uFF0C\u5219\u7F16\u8BD1\u540E\u7684\u4EE3\u7801\u4F1A\u53D8\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n this.foo = 100;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u4E3A ",(0,r.jsx)(n.code,{children:"true"})," \u7684\u65F6\u5019\uFF0C\u5219\u7F16\u8BD1\u540E\u7684\u4EE3\u7801\u4F1A\u53D8\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n Object.defineProperty(this, 'foo', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 100,\n });\n Object.defineProperty(this, 'bar', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0,\n });\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u540C\u65F6\u8BE5\u914D\u7F6E\u7684\u9ED8\u8BA4\u503C\u4F1A\u6839\u636E tsconfig.json \u7684 ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#target",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"target"})})," \u914D\u7F6E\u800C\u53D8\u5316\uFF1A",(0,r.jsxs)(n.strong,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"target"})," \u662F ES2022 \u6216\u8005\u66F4\u9AD8\u7684\u65F6\u5019\uFF0C\u5219 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u9ED8\u8BA4\u914D\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"true"}),"\uFF0C\u5426\u5219\u5C31\u662F\u9ED8\u8BA4\u4E3A ",(0,r.jsx)(n.code,{children:"false"})]}),"\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5173\u4E8E TypeScript \u8FD9\u4E2A\u914D\u7F6E\u7684\u66F4\u591A\u4FE1\u606F\uFF0C\u53EF\u4EE5\u53C2\u8003\u4E0B\u9762\u7684\u94FE\u63A5\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier",target:"_blank",rel:"noopener noreferrer",children:"The useDefineForClassFields Flag and The declare Property Modifier"})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module \u76EE\u524D\u4F1A\u6839\u636E\u4E0B\u9762\u7684\u903B\u8F91\u8FDB\u884C\u5904\u7406\uFF1A"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\u9996\u5148\u6839\u636E\u5F53\u524D\u9879\u76EE\u7684 tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\u786E\u5B9A\u5728 Modern.js Module \u5185\u90E8\u5982\u4F55\u5904\u7406\u3002\u76EE\u524D\u53EA\u4F1A\u8BFB\u53D6\u5F53\u524D\u9879\u76EE\u8DEF\u5F84\u4E0B\u7684 tsconfig.json \u6587\u4EF6\u7684\u5185\u5BB9\uFF0C\u6682\u65F6\u4E0D\u652F\u6301\u6839\u636E ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#extends",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"extends"})})," \u914D\u7F6E\u6765\u83B7\u53D6\u6700\u7EC8\u7684 tsconfig \u914D\u7F6E\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u6CA1\u6709\u68C0\u6D4B tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," \u914D\u7F6E\uFF0C\u5219\u4F1A\u6839\u636E tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"target"})," \u914D\u7F6E\u6765\u786E\u5B9A\u9ED8\u8BA4\u503C\u3002\u5982\u679C ",(0,r.jsx)(n.code,{children:"target"})," \u5927\u4E8E ",(0,r.jsx)(n.code,{children:"ES2022"}),"\uFF08\u5305\u542B ",(0,r.jsx)(n.code,{children:"EsNext"}),"\uFF09\uFF0C\u5219",(0,r.jsx)(n.code,{children:"useDefineForClassFields"}),"\u9ED8\u8BA4\u4E3A ",(0,r.jsx)(n.code,{children:"true"}),"\uFF0C\u5426\u5219\u4E3A ",(0,r.jsx)(n.code,{children:"false"}),"\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u6CA1\u6709\u68C0\u6D4B\u5230 tsconfig.json \u7684 ",(0,r.jsx)(n.code,{children:"target"}),"\uFF0C\u5219\u6309\u7167 ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"}),"\u7684\u503C \u4E3A ",(0,r.jsx)(n.code,{children:"true"})," \u8FDB\u884C\u5904\u7406\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",children:["babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 ",(0,r.jsx)(n.code,{children:"undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u4F7F\u7528\u7C7B\u4F3C\u4E0B\u9762\u7684\u65B9\u5F0F\u7684\u65F6\u5019\uFF0C\u4F1A\u51FA\u73B0\u8FD9\u4E2A\u95EE\u9898\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Lodash from 'lodash';\n\nexport const libs = {\n _: Lodash,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u76EE\u524D\u5728 ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"})," Github \u4E0A\u7684\u76F8\u5173 Issue\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/lodash/babel-plugin-lodash/issues/235",target:"_blank",rel:"noopener noreferrer",children:"#235"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u8FD9\u4E2A\u95EE\u9898\u7684\u89E3\u51B3\u529E\u6CD5\u662F\u79FB\u9664 ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"}),"\uFF0C\u56E0\u4E3A\u6B64\u65F6\u4E0D\u9700\u8981\u8BE5\u63D2\u4EF6\u8FDB\u884C\u6309\u9700\u5F15\u7528\uFF0C\u4F7F\u7528\u8BE5\u63D2\u4EF6\u4F1A\u4EA7\u751F\u526F\u4F5C\u7528\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u7C7B\u4F3C\u7684\u60C5\u51B5\u5728 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," \u4E0A\u4E5F\u53EF\u80FD\u4F1A\u51FA\u73B0\u3002\u6BD4\u5982\u6709\u7C7B\u4F3C\u5982\u4E0B\u7684\u4EE3\u7801\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Comps from 'components';\n\nexport const libs = {\n comps: Comps,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u6B64\u65F6 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," \u4E5F\u53EF\u80FD\u4F1A\u5BFC\u81F4 ",(0,r.jsx)(n.code,{children:"Comps"})," \u53D8\u4E3A ",(0,r.jsx)(n.code,{children:"undefined"}),"\u3002\u56E0\u6B64\u4E5F\u9700\u8981\u79FB\u9664\u5BF9\u5E94\u7684 ",(0,r.jsx)(n.code,{children:"babel-plugin-import"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-module-http",children:["Cannot find module http",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-http",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u4EA7\u7269\u5728\u6D4F\u89C8\u5668\u8FD0\u884C\u65F6\u62A5\u4E86\u7C7B\u4F3C ",(0,r.jsx)(n.code,{children:"Cannot find module 'http'"})," \u7684\u9519\u8BEF\uFF0C\u8BF4\u660E\u4F60\u7684\u4EA7\u7269\u6253\u5305\u8FDB\u4E86 node \u6A21\u5757\u3002\n\u8FD9\u53EF\u80FD\u4F1A\u53D1\u751F\u4E8E\u4F60\u7684\u4F9D\u8D56\u91CC\u6709\u4E00\u4E9B\u540C\u65F6\u652F\u6301 browser \u548C node \u7684\u4E09\u65B9\u5305\uFF0C\u4F8B\u5982 ",(0,r.jsx)(n.code,{children:"axios"}),"\uFF0C\u6B64\u65F6\u53EA\u9700\u8981\u5C06 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#platform",children:"platform"})," \u8BBE\u7F6E\u4E3A ",(0,r.jsx)(n.code,{children:"browser"})," \u5373\u53EF\u3002\n\u5982\u679C\u4E00\u4E9B\u4E09\u65B9\u5305\u4E0D\u652F\u6301 browser, \u4F60\u53EF\u80FD\u9700\u8981\u624B\u52A8\u6CE8\u5165 ",(0,r.jsx)(n.a,{href:"/plugins/official-list/plugin-node-polyfill",children:"node polyfill"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u5F02\u5E38\u7C7B\u95EE\u9898",children:["\u5F02\u5E38\u7C7B\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F02\u5E38\u7C7B\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"dynamic-require-of-react-is-not-supported",children:['Dynamic require of "react" is not supported',(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dynamic-require-of-react-is-not-supported",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"\u95EE\u9898\u63CF\u8FF0",children:["\u95EE\u9898\u63CF\u8FF0",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u95EE\u9898\u63CF\u8FF0",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u6784\u5EFA\u7684\u4EA7\u7269\u914D\u7F6E\u4E2D\u4EA7\u7269\u683C\u5F0F\u4E3A ES modules \u7684\u65F6\u5019\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u5BFC\u5165\u4E86\u7684\u7B2C\u4E09\u65B9 npm \u5305\u7684 cjs \u4EA7\u7269\uFF0C\u90A3\u4E48\u751F\u6210\u7684\u4EA7\u7269\u53EF\u80FD\u4F1A\u5728 webpack \u4E0B\u6709\u53EF\u80FD\u65E0\u6CD5\u6B63\u5E38\u8FD0\u884C\u3002"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/1280X1280.png",alt:""})}),"\n",(0,r.jsxs)(n.h4,{id:"\u89E3\u51B3\u529E\u6CD5",children:["\u89E3\u51B3\u529E\u6CD5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u89E3\u51B3\u529E\u6CD5",children:"#"})]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"\u9996\u5148\u9700\u8981\u627E\u5230\u662F\u54EA\u4E2A\u7B2C\u4E09\u65B9\u5305\u5F15\u8D77\u7684\u95EE\u9898"}),"\u3002\u4F8B\u5982\u62A5\u9519\u4FE1\u606F\u4E2D\u6307\u5411\u4E86 ",(0,r.jsx)(n.code,{children:"react"})," \u8FD9\u4E2A\u5305\uFF0C\u90A3\u4E48\u5C31\u8981\u5BFB\u627E\u5728\u54EA\u4E2A\u7B2C\u4E09\u65B9\u5305\u91CC\u5B58\u5728 ",(0,r.jsx)(n.code,{children:"require('react')"})," \u8FD9\u6837\u7684\u4EE3\u7801\u3002\u6BD4\u5982 ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/react-draggable",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"react-draggable"})})," \uFF0C\u8FD9\u4E2A\u5305\u4EC5\u5305\u542B ",(0,r.jsx)(n.code,{children:"cjs"})," \u4EA7\u7269\uFF0C\u90A3\u4E48\u95EE\u9898\u5B9A\u4F4D\u5230 ",(0,r.jsx)(n.code,{children:"react-draggable"})," \u8FD9\u4E2A\u5305\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u7136\u540E\u6211\u4EEC\u9700\u8981\u5C06\u8FD9\u4E2A\u5305\u901A\u8FC7\u4E0B\u9762\u7684\u914D\u7F6E\u8FDB\u884C\u6392\u9664\uFF0C\u5373",(0,r.jsx)(n.strong,{children:"\u4E0D\u6253\u5305\u5B58\u5728\u95EE\u9898\u7684\u7B2C\u4E09\u65B9\u5305"}),"\u3002"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n externals: ['react-draggable'],\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"\u53C2\u8003\u94FE\u63A5",children:["\u53C2\u8003\u94FE\u63A5",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53C2\u8003\u94FE\u63A5",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/68423950/when-using-esbuild-with-external-react-i-get-dynamic-require-of-react-is-not-s",target:"_blank",rel:"noopener noreferrer",children:'When using esbuild with external react I get Dynamic require of "react" is not supported'})}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",children:["\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A",(0,r.jsx)(n.code,{children:"'Operation on an invalid type'"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u53EF\u80FD\u662F\u56E0\u4E3A\u8BE5\u7EC4\u4EF6\u5E93\u4F9D\u8D56\u7684 Less \u7248\u672C\u662F v3\uFF0C\u800C Modern.js Module \u9ED8\u8BA4\u662F v4\u3002v3 \u4E0E v4 \u5728 ",(0,r.jsx)(n.code,{children:"math"})," \u914D\u7F6E\u4E0A\u5B58\u5728\u6709 Break Change\uFF0C\u53EF\u4EE5\u67E5\u770B\u8FD9\u4E2A",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/73298187/less-error-operation-on-an-invalid-type-in-antd-dependency",target:"_blank",rel:"noopener noreferrer",children:"\u94FE\u63A5"})," \u4E86\u89E3\u8BE6\u60C5\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u56E0\u6B64\uFF0C\u5982\u679C\u662F\u5728\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86\u7C7B\u4F3C\u8FD9\u6837\u7684\u7EC4\u4EF6\u5E93\uFF1A"}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u6784\u5EFA\u914D\u7F6E\u4E2D\u4F7F\u7528\u4E86 ",(0,r.jsx)(n.code,{children:"buildPreset"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\u6309\u7167\u4E0B\u9762\u8FDB\u884C\u4FEE\u6539\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildPreset({ extendPreset }) {\n return extendPreset('your-build-preset', {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n });\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u6216\u8005\u4F7F\u7528\u4E86\u81EA\u5B9A\u4E49\u7684 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u7684\u60C5\u51B5\u4E0B\uFF0C\u6309\u7167\u4E0B\u9762\u8FDB\u884C\u4FEE\u6539\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildConfig: {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u679C\u662F\u5728 Storybook \u4E2D\u4F7F\u7528\u4E86\u7C7B\u4F3C\u8FD9\u6837\u7684\u7EC4\u4EF6\uFF0C\u5219\u9700\u8981\u4FEE\u6539 Storybook \u7684\u8C03\u8BD5\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:"filename='.storybook/main.ts'",children:"module.exports = {\n framework: {\n options: {\n builderConfig: {\n tools: {\n webpackChain(chain, { CHAIN_ID }) {\n chain.module\n .rule(CHAIN_ID.RULE.LESS)\n .use(CHAIN_ID.USE.LESS)\n .tap(options => {\n options.lessOptions = {\n ...options.lessOptions,\n math: 'always',\n };\n return options;\n });\n },\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-dts-failed",children:["Bundleless DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u4E0D\u6253\u5305\u7684\u573A\u666F\u4E0B\uFF0C\u662F\u76F4\u63A5 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7C7B\u578B\u58F0\u660E\u6587\u4EF6\u3002\u901A\u8FC7\u7EC8\u7AEF\u6253\u5370\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u4F60\u53EF\u4EE5\u627E\u5230\u95EE\u9898\u6587\u4EF6\u3002\u5BF9\u4E8E\u6E90\u7801\u6587\u4EF6\uFF0C\u63A8\u8350\u5C06\u7C7B\u578B\u95EE\u9898\u8FDB\u884C\u4FEE\u590D\uFF0C\u8FD9\u80FD\u591F\u66F4\u597D\u5730\u4F7F\u4F60\u7684\u5305\u5F97\u5230\u590D\u7528\u3002\u4F46\u5982\u679C\u9047\u5230\u4E09\u65B9\u5305\u7684\u7C7B\u578B\u68C0\u67E5\u95EE\u9898\uFF1A"]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\u5F00\u542F ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#skipLibCheck",target:"_blank",rel:"noopener noreferrer",children:"skipLibCheck"})," \u6765\u8DF3\u8FC7\u4E09\u65B9\u5305\u7684 d.ts \u68C0\u67E5\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5982\u679C\u4E09\u65B9\u5305\u76F4\u63A5\u5BFC\u51FA ts \u6587\u4EF6\uFF0C skipLibCheck \u5C06\u4F1A\u5931\u6548\uFF0C\u56E0\u4E3A\u5176\u53EA\u80FD\u8DF3\u8FC7 d.ts \u68C0\u67E5\uFF0C\u56E0\u6B64\u4F60\u53EA\u80FD\u5173\u95ED ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsabortonerror",children:"dts.abortOnError"})," \u6765\u5FFD\u7565\u8FD9\u4E9B\u9519\u8BEF\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"bundle-dts-failed",children:["Bundle DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u76F4\u63A5\u4F7F\u7528 ",(0,r.jsx)(n.a,{href:"https://github.com/Swatinem/rollup-plugin-dts",target:"_blank",rel:"noopener noreferrer",children:"rollup-plugin-dts"})," \u6765\u6253\u5305\u4F60\u7684\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u3002\n",(0,r.jsx)(n.strong,{children:"\u5B83\u53EF\u80FD\u65E0\u6CD5\u5904\u7406\u67D0\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u9047\u5230 Modern.js Module \u6784\u5EFA\u8FC7\u7A0B\u4E2D\u51FA\u73B0 ",(0,r.jsx)(n.code,{children:"Bundle DTS failed"})," \u7684\u9519\u8BEF\u4FE1\u606F\u6807\u9898\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u89C2\u5BDF\u62A5\u9519\u4FE1\u606F\u662F\u6765\u81EA\u67D0\u4E2A\u7B2C\u4E09\u65B9\u4F9D\u8D56\u3002\u5C1D\u8BD5\u8BBE\u7F6E ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:(0,r.jsx)(n.code,{children:"dts.respectExternal"})})," \u4E3A ",(0,r.jsx)(n.code,{children:"false"})," \u6765\u5173\u95ED\u6253\u5305\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6\u7684\u884C\u4E3A\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",children:[(0,r.jsx)(n.code,{children:"defineConfig"})," \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A",(0,r.jsx)(n.code,{children:'\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B'}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u68C0\u67E5\u9879\u76EE\u7684 tsconfig.json \u6587\u4EF6\u4E2D\u662F\u5426\u5B58\u5728 ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#include",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"include"})})," \u914D\u7F6E\uFF0C\u5982\u679C\u6CA1\u6709\uFF0C\u5219\u5C1D\u8BD5\u589E\u52A0\u4E0B\u9762\u7684\u5185\u5BB9\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "include": ["src"]\n}\n'})}),"\n",(0,r.jsxs)(n.h2,{id:"\u5176\u4ED6",children:["\u5176\u4ED6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5176\u4ED6",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",children:["bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["bundleless \u662F\u5355\u6587\u4EF6\u7F16\u8BD1\u7684\u65B9\u5F0F\uFF0C\u53EA\u9700\u8981\u5C06\u4F60\u7684 less / scss \u6587\u4EF6\u4ECE\u5165\u53E3\u91CC\u79FB\u9664\u5E76\u4E14\u5C06\u5176\u62F7\u8D1D\u5230\u4EA7\u7269\u91CC\u5373\u53EF\u3002\n\u6CE8\u610F\u6211\u4EEC\u8FD8\u4F1A\u628A js \u5F15\u7528 less / scss \u7684 moduleId \u8FDB\u884C\u6539\u5199\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#redirect",children:"redirect"})," \u914D\u7F6E\u5173\u95ED\u5B83\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u8DF3\u8FC7 less \u6587\u4EF6\u5904\u7406\u7684\u4F8B\u5B50\uFF0C\u4F60\u4F1A\u53D1\u73B0 src \u91CC\u9762\u6240\u6709\u7684 less \u6587\u4EF6\u90FD\u88AB\u62F7\u8D1D\u5230 dist \u91CC\u5E76\u4E14\u4FDD\u7559\u4E86\u4E00\u81F4\u7684\u76F8\u5BF9\u8DEF\u5F84\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildType: 'bundleless',\n buildConfig: {\n input: ['src', '!src/**/*.less'],\n redirect: {\n style: false,\n },\n copy: {\n patterns: [\n {\n from: './**/*.less',\n to: './',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",children:["\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module \u57FA\u4E8E esbuild \u5B9E\u73B0\uFF0C\u56E0\u6B64\u5982\u679C\u6709\u7279\u6B8A\u9700\u6C42\u6216\u8005\u60F3\u8981\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B\uFF0C\u53EF\u4EE5\u901A\u8FC7\u5B9E\u73B0 esbuild \u63D2\u4EF6\u6765\u89E3\u51B3\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,r.jsx)(n.code,{children:"esbuildOptions"})})," \u914D\u7F6E\u5141\u8BB8\u4FEE\u6539 Modern.js Module \u5185\u90E8\u7684 esbuild \u914D\u7F6E\uFF0C\u56E0\u6B64\u53EF\u4EE5\u901A\u8FC7\u8BE5\u914D\u7F6E\u6765\u589E\u52A0\u81EA\u5B9A\u4E49\u7684 esbuild \u63D2\u4EF6\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,r.jsxs)(n.h3,{id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",children:["\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u65B9\u6848\u4E00\uFF1A",(0,r.jsx)(n.a,{href:"https://github.com/Quramy/typed-css-modules",target:"_blank",rel:"noopener noreferrer",children:"typed-css-modules"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u65B9\u6848\u4E8C\uFF1A",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/@guanghechen/postcss-modules-dts",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules-dts"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig(async () => {\n const { dts } = await import('@guanghechen/postcss-modules-dts');\n return {\n buildConfig: {\n style: {\n modules: { ...dts },\n },\n },\n // \u4F60\u7684\u81EA\u5B9A\u4E49\u914D\u7F6E\n };\n});\n"})})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fbuild.mdx"]={toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3},{text:"Cannot find module http",id:"cannot-find-module-http",depth:3},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3}],title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3635.7f1cd7bc.js b/modern-js/module-tools/static/js/async/3635.7f1cd7bc.js new file mode 100644 index 0000000000..94e6f56fea --- /dev/null +++ b/modern-js/module-tools/static/js/async/3635.7f1cd7bc.js @@ -0,0 +1,2 @@ +/*! For license information please see 3635.7f1cd7bc.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3635"],{2076:function(e,n,l){"use strict";l.r(n);var i=l("39980"),d=l("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",ul:"ul",li:"li",pre:"pre",code:"code",h2:"h2",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"\u6784\u5EFA-umd-\u4EA7\u7269",children:["\u6784\u5EFA umd \u4EA7\u7269",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA-umd-\u4EA7\u7269",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["umd \u5168\u79F0\u4E3A ",(0,i.jsx)(n.strong,{children:"Universal Module Definition"}),"\uFF0C\u8FD9\u79CD\u683C\u5F0F\u7684 JS \u6587\u4EF6\u53EF\u4EE5\u8FD0\u884C\u5728\u591A\u4E2A\u8FD0\u884C\u73AF\u5883\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6D4F\u89C8\u5668\u73AF\u5883\uFF1A\u57FA\u4E8E AMD \u89C4\u8303\u8FDB\u884C\u6A21\u5757\u52A0\u8F7D"}),"\n",(0,i.jsx)(n.li,{children:"Node.js \u73AF\u5883\uFF1A\u57FA\u4E8E CommonJS \u8FDB\u884C\u6A21\u5757\u52A0\u8F7D"}),"\n",(0,i.jsx)(n.li,{children:"\u5176\u4ED6\u60C5\u51B5\uFF1A\u5C06\u6A21\u5757\u6302\u8F7D\u5728\u5168\u5C40\u5BF9\u8C61\u4E0A\u3002"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u65B9\u5F0F\uFF0C\u5C06\u9879\u76EE\u7684\u6784\u5EFA\u4EA7\u7269\u6307\u5B9A\u4E3A umd \u4EA7\u7269\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",children:["umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.a,{href:"/guide/advance/external-dependency",children:"\u300C\u5982\u4F55\u5904\u7406\u7B2C\u4E09\u65B9\u4F9D\u8D56\u300D"})," \u7AE0\u8282\u4E2D\uFF0C\u6211\u4EEC\u77E5\u9053\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"autoExternals"})})," \u548C ",(0,i.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"externals"})})," API \u6765\u63A7\u5236\u9879\u76EE\u662F\u5426\u5BF9\u7B2C\u4E09\u65B9\u4F9D\u8D56\u6253\u5305\u3002\n\u56E0\u6B64\u5728\u6784\u5EFA umd \u4EA7\u7269\u7684\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FD9\u6837\u4F7F\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u9879\u76EE\u4F9D\u8D56\u4E86 ",(0,i.jsx)(n.code,{children:"react"}),"\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u914D\u7F6E\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n autoExternal: false,\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6B64\u65F6\u4EA7\u7269\u4E2D\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"react"})," \u4EE3\u7801\u6253\u5305\u5230\u4EA7\u7269\u4E2D\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports, require('react'));\n else if (typeof define === 'function' && define.amd)\n define(['exports', 'react'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}), global.react);\n})(this, function (exports, _react) {\n 'use strict';\n Object.defineProperty(exports, '__esModule', {\n value: true,\n });\n _react = /*#__PURE__*/ _interopRequireDefault(_react);\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule\n ? obj\n : {\n default: obj,\n };\n }\n console.info(_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u8FC7\u4E0A\u9762\u7684\u4F8B\u5B50\u6211\u4EEC\u77E5\u9053\uFF0C\u5F53\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"autoExternal"})," \u548C ",(0,i.jsx)(n.code,{children:"externals"})," API \u540E\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 Node.js \u73AF\u5883\u4E0B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"require('react')"})," \u83B7\u53D6 react \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5728 \u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.react"})," \u83B7\u53D6 react \u4F9D\u8D56\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:["\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7136\u800C\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u83B7\u53D6\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u65F6\u5019\uFF0C",(0,i.jsx)(n.strong,{children:"\u5168\u5C40\u53D8\u91CF\u540D\u79F0\u4E0D\u4E00\u5B9A\u4E0E\u4F9D\u8D56\u540D\u79F0\u5B8C\u5168\u76F8\u540C"}),"\uFF0C\u6B64\u65F6\u5C31\u8981\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#umdglobals",children:(0,i.jsx)(n.code,{children:"buildConfig.umdGlobals"})})," API\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD8\u662F\u4F7F\u7528\u4E4B\u524D\u7684\u4F8B\u5B50\uFF0C\u5F53 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\u4EE5 ",(0,i.jsx)(n.code,{children:"windows.React"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:"global.React"})," \u5168\u5C40\u53D8\u91CF\u7684\u5F62\u5F0F\u5B58\u5728\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u90A3\u4E48\u6B64\u65F6\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u914D\u7F6E\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdGlobals: {\n react: 'React',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6B64\u65F6\u6211\u4EEC\u4F1A\u770B\u5230\u8FD9\u6837\u7684\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory();\n else if (typeof define === 'function' && define.amd) define([], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory();\n})(this, function () {\n // ...\n // libuild:globals:react\n var require_react = __commonJS({\n 'libuild:globals:react'(exports, module1) {\n module1.exports = Function('return this')()['React'];\n },\n });\n // src/index.ts\n var import_react = __toESM(require_react());\n console.info(import_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u9879\u76EE\u5C31\u53EF\u4EE5\u8FD0\u884C\u5728\u6D4F\u89C8\u5668\u4E2D\uFF0C\u5E76\u4F7F\u7528\u5B58\u5728\u4E8E\u5168\u5C40\u5BF9\u8C61\u4E0A\u7684 ",(0,i.jsx)(n.code,{children:"React"})," \u53D8\u91CF\u4E86\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:["\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u5C06\u4E0B\u9762\u7684\u4EE3\u7801\u6253\u5305\u6210 umd \u4EA7\u7269\u5E76\u8FD0\u884C\u5728\u6D4F\u89C8\u5668\u7684\u65F6\u5019\uFF0C\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"window.index"})," \u6765\u4F7F\u7528\u8BE5\u6A21\u5757\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="./src/index.ts"',children:"export default () => {\n console.info('hello world');\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4EE5\u6E90\u7801\u6587\u4EF6\u540D\u79F0\u4F5C\u4E3A\u8BE5\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u91CC\u5168\u5C40\u53D8\u91CF\u7684\u540D\u79F0"}),"\u3002\u5BF9\u4E8E\u4E0A\u9762\u7684\u4F8B\u5B50\uFF0C\u5176\u4EA7\u7269\u5185\u5BB9\u5982\u4E0B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}));\n})(this, function (exports) {\n //...\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u4FEE\u6539\u5B83\uFF0C\u5219\u9700\u8981\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#umdmodulename",children:(0,i.jsx)(n.code,{children:"buildConfig.umdModuleName"})})," API\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u4F7F\u7528\u8BE5 API \u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u65F6\u6784\u5EFA\u4EA7\u7269\u7684\u5185\u5BB9\u4E3A\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.myLib = {}));\n})(this, function (exports) {\n //...\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fbuild-umd.mdx"]={toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2}],title:"\u6784\u5EFA umd \u4EA7\u7269",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4248.63967d39.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3635.7f1cd7bc.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4248.63967d39.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3635.7f1cd7bc.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5608.806e6a1b.js b/modern-js/module-tools/static/js/async/3691.8143e3bf.js similarity index 97% rename from modern-js/module-tools/static/js/async/5608.806e6a1b.js rename to modern-js/module-tools/static/js/async/3691.8143e3bf.js index 96e12ac9d3..4786fad8df 100644 --- a/modern-js/module-tools/static/js/async/5608.806e6a1b.js +++ b/modern-js/module-tools/static/js/async/3691.8143e3bf.js @@ -1,2 +1,2 @@ -/*! For license information please see 5608.806e6a1b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5608"],{84194:function(e,s,n){"use strict";n.r(s);var r=n("39980"),t=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",ul:"ul",li:"li",pre:"pre"},(0,t.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.h1,{id:"testing",children:["testing",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#testing",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u672C\u7AE0\u63CF\u8FF0\u4E86\u6D4B\u8BD5\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(s.div,{className:"rspress-directive tip",children:[(0,r.jsx)(s.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(s.div,{className:"rspress-directive-content",children:(0,r.jsxs)(s.p,{children:["\u9700\u8981\u5148\u901A\u8FC7 ",(0,r.jsx)(s.code,{children:"pnpm run new"})," \u542F\u7528 \u5355\u5143\u6D4B\u8BD5 \u529F\u80FD\u3002\n"]})})]}),"\n",(0,r.jsxs)(s.h2,{id:"jest",children:["jest",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#jest",children:"#"})]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["\u7C7B\u578B\uFF1A ",(0,r.jsx)(s.code,{children:"object | Function"})]}),"\n",(0,r.jsxs)(s.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(s.code,{children:"{}"})]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u5BF9\u5E94 ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"})," \u7684\u914D\u7F6E\uFF0C\u5F53\u4E3A ",(0,r.jsx)(s.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u914D\u7F6E Jest \u6240\u652F\u6301\u7684\u6240\u6709\u5E95\u5C42\u914D\u7F6E \u3002"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: {\n testTimeout: 10000,\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(s.p,{children:["\u503C\u4E3A ",(0,r.jsx)(s.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u9ED8\u8BA4\u914D\u7F6E\u4F5C\u4E3A\u7B2C\u4E00\u4E2A\u53C2\u6570\u4F20\u5165\uFF0C\u9700\u8981\u8FD4\u56DE\u65B0\u7684 Jest \u914D\u7F6E\u5BF9\u8C61\u3002"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: options => {\n return {\n ...options,\n testTimeout: 10000,\n };\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"transformer",children:["transformer",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#transformer",children:"#"})]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(s.code,{children:"'babel-jest' | 'ts-jest'"})]}),"\n",(0,r.jsxs)(s.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(s.code,{children:"'babel-jest'"})]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u914D\u7F6E\u6267\u884C\u6D4B\u8BD5\u7684\u65F6\u5019\u5BF9\u4E8E\u6E90\u7801\u7684\u7F16\u8BD1\u5DE5\u5177\uFF1A ",(0,r.jsx)(s.a,{href:"https://www.npmjs.com/package/babel-jest",target:"_blank",rel:"noopener noreferrer",children:"babel-jest"})," \u6216 ",(0,r.jsx)(s.a,{href:"https://github.com/kulshekhar/ts-jest",target:"_blank",rel:"noopener noreferrer",children:"ts-jest"}),"\u3002\u9ED8\u8BA4\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"babel-jest"}),"\u3002"]}),"\n",(0,r.jsxs)(s.div,{className:"rspress-directive info",children:[(0,r.jsx)(s.div,{className:"rspress-directive-title",children:"INFO"}),(0,r.jsx)(s.div,{className:"rspress-directive-content",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"babel-jest"})," \u4E5F\u53EF\u4EE5\u7F16\u8BD1 TS \u6587\u4EF6\uFF0C\u4F46\u4E0D\u4F1A\u7C7B\u578B\u62A5\u9519\uFF0C\u5982\u679C\u4F60\u9700\u8981\u8DD1\u6D4B\u8BD5\u7684\u65F6\u5019\u5BF9 TS \u7C7B\u578B\u8FDB\u884C\u6821\u9A8C\uFF0C\u90A3\u4E48\u8BF7\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"ts-jest"}),"\u3002\n"]})})]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,t.ah)(),e.components);return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}s.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Ftesting.md"]={toc:[{text:"jest",id:"jest",depth:2},{text:"transformer",id:"transformer",depth:2}],title:"testing",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file +/*! For license information please see 3691.8143e3bf.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3691"],{54515:function(e,s,n){"use strict";n.r(s);var r=n("39980"),t=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",ul:"ul",li:"li",pre:"pre"},(0,t.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.h1,{id:"testing",children:["testing",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#testing",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u672C\u7AE0\u63CF\u8FF0\u4E86\u6D4B\u8BD5\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(s.div,{className:"rspress-directive tip",children:[(0,r.jsx)(s.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(s.div,{className:"rspress-directive-content",children:(0,r.jsxs)(s.p,{children:["\u9700\u8981\u5148\u901A\u8FC7 ",(0,r.jsx)(s.code,{children:"pnpm run new"})," \u542F\u7528 \u5355\u5143\u6D4B\u8BD5 \u529F\u80FD\u3002\n"]})})]}),"\n",(0,r.jsxs)(s.h2,{id:"jest",children:["jest",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#jest",children:"#"})]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["\u7C7B\u578B\uFF1A ",(0,r.jsx)(s.code,{children:"object | Function"})]}),"\n",(0,r.jsxs)(s.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(s.code,{children:"{}"})]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u5BF9\u5E94 ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"})," \u7684\u914D\u7F6E\uFF0C\u5F53\u4E3A ",(0,r.jsx)(s.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u914D\u7F6E Jest \u6240\u652F\u6301\u7684\u6240\u6709\u5E95\u5C42\u914D\u7F6E \u3002"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: {\n testTimeout: 10000,\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(s.p,{children:["\u503C\u4E3A ",(0,r.jsx)(s.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u9ED8\u8BA4\u914D\u7F6E\u4F5C\u4E3A\u7B2C\u4E00\u4E2A\u53C2\u6570\u4F20\u5165\uFF0C\u9700\u8981\u8FD4\u56DE\u65B0\u7684 Jest \u914D\u7F6E\u5BF9\u8C61\u3002"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n testing: {\n jest: options => {\n return {\n ...options,\n testTimeout: 10000,\n };\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"transformer",children:["transformer",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#transformer",children:"#"})]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(s.code,{children:"'babel-jest' | 'ts-jest'"})]}),"\n",(0,r.jsxs)(s.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,r.jsx)(s.code,{children:"'babel-jest'"})]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u914D\u7F6E\u6267\u884C\u6D4B\u8BD5\u7684\u65F6\u5019\u5BF9\u4E8E\u6E90\u7801\u7684\u7F16\u8BD1\u5DE5\u5177\uFF1A ",(0,r.jsx)(s.a,{href:"https://www.npmjs.com/package/babel-jest",target:"_blank",rel:"noopener noreferrer",children:"babel-jest"})," \u6216 ",(0,r.jsx)(s.a,{href:"https://github.com/kulshekhar/ts-jest",target:"_blank",rel:"noopener noreferrer",children:"ts-jest"}),"\u3002\u9ED8\u8BA4\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"babel-jest"}),"\u3002"]}),"\n",(0,r.jsxs)(s.div,{className:"rspress-directive info",children:[(0,r.jsx)(s.div,{className:"rspress-directive-title",children:"INFO"}),(0,r.jsx)(s.div,{className:"rspress-directive-content",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"babel-jest"})," \u4E5F\u53EF\u4EE5\u7F16\u8BD1 TS \u6587\u4EF6\uFF0C\u4F46\u4E0D\u4F1A\u7C7B\u578B\u62A5\u9519\uFF0C\u5982\u679C\u4F60\u9700\u8981\u8DD1\u6D4B\u8BD5\u7684\u65F6\u5019\u5BF9 TS \u7C7B\u578B\u8FDB\u884C\u6821\u9A8C\uFF0C\u90A3\u4E48\u8BF7\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"ts-jest"}),"\u3002\n"]})})]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,t.ah)(),e.components);return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}s.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Ftesting.md"]={toc:[{text:"jest",id:"jest",depth:2},{text:"transformer",id:"transformer",depth:2}],title:"testing",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3777.44838359.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3691.8143e3bf.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3777.44838359.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3691.8143e3bf.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3718.73adc53d.js b/modern-js/module-tools/static/js/async/3718.73adc53d.js deleted file mode 100644 index e00e0799e5..0000000000 --- a/modern-js/module-tools/static/js/async/3718.73adc53d.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 3718.73adc53d.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3718"],{44914:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",strong:"strong",ul:"ul",li:"li",pre:"pre",h3:"h3",h4:"h4"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",children:["\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:['\u5728 "\u57FA\u7840\u4F7F\u7528" \u7684\u90E8\u5206\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u77E5\u9053\u53EF\u4EE5\u901A\u8FC7 ',(0,r.jsx)(n.code,{children:"buildConfig"})," \u914D\u7F6E\u5BF9\u9879\u76EE\u7684\u8F93\u51FA\u4EA7\u7269\u8FDB\u884C\u4FEE\u6539\u3002",(0,r.jsx)(n.code,{children:"buildConfig"})," \u4E0D\u4EC5\u63CF\u8FF0\u4E86\u4EA7\u7269\u7684\u4E00\u4E9B\u7279\u6027\uFF0C\u540C\u65F6\u8FD8\u4E3A\u6784\u5EFA\u4EA7\u7269\u63D0\u4F9B\u4E86\u4E00\u4E9B\u529F\u80FD\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u8FD8\u4E0D\u4E86\u89E3 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u7684\u4F5C\u7528\uFF0C\u8BF7\u5148\u9605\u8BFB ",(0,r.jsx)(n.a,{href:"/guide/basic/modify-output-product",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"}),"\u3002\n"]})})]}),"\n",(0,r.jsxs)(n.p,{children:["\u800C\u5728\u672C\u7AE0\u91CC\u6211\u4EEC\u5C06\u8981\u6DF1\u5165\u7406\u89E3\u67D0\u4E9B\u6784\u5EFA\u914D\u7F6E\u7684\u4F5C\u7528\u4EE5\u53CA\u4E86\u89E3\u6267\u884C ",(0,r.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\u53D1\u751F\u4E86\u4EC0\u4E48\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"bundle--bundleless",children:[(0,r.jsx)(n.code,{children:"bundle"})," / ",(0,r.jsx)(n.code,{children:"bundleless"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle--bundleless",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u90A3\u4E48\u9996\u5148\u6211\u4EEC\u6765\u4E86\u89E3\u4E00\u4E0B bundle \u548C bundleless\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["\u6240\u8C13 bundle \u662F\u6307\u5BF9\u6784\u5EFA\u4EA7\u7269\u8FDB\u884C\u6253\u5305\uFF0C\u6784\u5EFA\u4EA7\u7269\u53EF\u80FD\u662F\u4E00\u4E2A\u6587\u4EF6\uFF0C\u4E5F\u6709\u53EF\u80FD\u662F\u57FA\u4E8E\u4E00\u5B9A\u7684",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"\u4EE3\u7801\u62C6\u5206\u7B56\u7565"}),"\u5F97\u5230\u7684\u591A\u4E2A\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u800C bundleless \u5219\u662F\u6307\u5BF9\u6BCF\u4E2A\u6E90\u6587\u4EF6\u5355\u72EC\u8FDB\u884C\u7F16\u8BD1\u6784\u5EFA\uFF0C\u4F46\u662F\u5E76\u4E0D\u5C06\u5B83\u4EEC\u6253\u5305\u5728\u4E00\u8D77\u3002\u6BCF\u4E00\u4E2A\u4EA7\u7269\u6587\u4EF6\u90FD\u53EF\u4EE5\u627E\u5230\u4E0E\u4E4B\u76F8\u5BF9\u5E94\u7684\u6E90\u7801\u6587\u4EF6\u3002",(0,r.jsx)(n.strong,{children:"bundleless \u6784\u5EFA\u7684\u8FC7\u7A0B\uFF0C\u4E5F\u53EF\u4EE5\u7406\u89E3\u4E3A\u4EC5\u5BF9\u6E90\u6587\u4EF6\u8FDB\u884C\u4EE3\u7801\u8F6C\u6362\u7684\u8FC7\u7A0B"}),"\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5B83\u4EEC\u6709\u5404\u81EA\u7684\u597D\u5904\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"bundle \u53EF\u4EE5\u51CF\u5C11\u6784\u5EFA\u4EA7\u7269\u7684\u4F53\u79EF\uFF0C\u4E5F\u53EF\u4EE5\u5BF9\u4F9D\u8D56\u9884\u6253\u5305\uFF0C\u51CF\u5C0F\u5B89\u88C5\u4F9D\u8D56\u7684\u4F53\u79EF\u3002\u63D0\u524D\u5BF9\u5E93\u8FDB\u884C\u6253\u5305\uFF0C\u53EF\u4EE5\u52A0\u5FEB\u5E94\u7528\u9879\u76EE\u6784\u5EFA\u7684\u901F\u5EA6\u3002"}),"\n",(0,r.jsx)(n.li,{children:"bundleless \u5219\u662F\u53EF\u4EE5\u4FDD\u6301\u539F\u6709\u7684\u6587\u4EF6\u7ED3\u6784\uFF0C\u66F4\u6709\u5229\u4E8E\u8C03\u8BD5\u548C tree shaking\u3002"}),"\n"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["bundleless \u662F\u5355\u6587\u4EF6\u7F16\u8BD1\u6A21\u5F0F\uFF0C\u56E0\u6B64\u5BF9\u4E8E\u7C7B\u578B\u7684\u5F15\u7528\u548C\u5BFC\u51FA\u4F60\u9700\u8981\u52A0\u4E0A ",(0,r.jsx)(n.code,{children:"type"})," \u5B57\u6BB5\uFF0C \u4F8B\u5982 ",(0,r.jsx)(n.code,{children:"import type { A } from './types"}),"\uFF0C\u80CC\u666F\u53C2\u8003 ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/content-types/#isolated-modules",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u6587\u6863"}),"\u3002\n"]})})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"buildConfig"})," \u4E2D\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#buildtype",children:(0,r.jsx)(n.code,{children:"buildConfig.buildType"})})," \u6765\u6307\u5B9A\u5F53\u524D\u6784\u5EFA\u4EFB\u52A1\u662F bundle \u8FD8\u662F bundleless\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"input--sourcedir",children:[(0,r.jsx)(n.code,{children:"input"})," / ",(0,r.jsx)(n.code,{children:"sourceDir"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input--sourcedir",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,r.jsx)(n.code,{children:"buildConfig.input"})})," \u7528\u4E8E\u6307\u5B9A\u8BFB\u53D6\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u6216\u8005\u76EE\u5F55\u8DEF\u5F84\uFF0C\u5176\u9ED8\u8BA4\u503C\u5728 bundle \u548C bundleless \u6784\u5EFA\u8FC7\u7A0B\u4E2D\u6709\u6240\u4E0D\u540C\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"buildType: 'bundle'"})," \u7684\u65F6\u5019\uFF0C",(0,r.jsx)(n.code,{children:"input"})," \u9ED8\u8BA4\u503C\u4E3A ",(0,r.jsx)(n.code,{children:"src/index.(j|t)sx?"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u5F53 ",(0,r.jsx)(n.code,{children:"buildType: 'bundleless'"})," \u7684\u65F6\u5019\uFF0C",(0,r.jsx)(n.code,{children:"input"})," \u9ED8\u8BA4\u503C\u4E3A ",(0,r.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE\u9ED8\u8BA4\u503C\u4E0A\u6211\u4EEC\u53EF\u4EE5\u77E5\u9053\uFF1A",(0,r.jsx)(n.strong,{children:"\u4F7F\u7528 bundle \u6A21\u5F0F\u6784\u5EFA\u65F6\u4E00\u822C\u6307\u5B9A\u4E00\u4E2A\u6216\u591A\u4E2A\u6587\u4EF6\u4F5C\u4E3A\u6784\u5EFA\u7684\u5165\u53E3\uFF0C\u800C\u4F7F\u7528 bundleless \u6784\u5EFA\u5219\u662F\u6307\u5B9A\u4E00\u4E2A\u76EE\u5F55\uFF0C\u5C06\u76EE\u5F55\u4E0B\u6240\u6709\u6587\u4EF6\u4F5C\u4E3A\u5165\u53E3"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,r.jsx)(n.code,{children:"sourceDir"})})," \u7528\u4E8E\u6307\u5B9A\u6E90\u7801\u76EE\u5F55\uFF0C\u5B83",(0,r.jsx)(n.strong,{children:"\u53EA\u4E0E"}),"\u4EE5\u4E0B\u4E24\u4E2A\u5185\u5BB9\u6709\u5173\u7CFB\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210"}),"\n",(0,r.jsxs)(n.li,{children:["\u6307\u5B9A\u6784\u5EFA\u8FC7\u7A0B\u4E2D\u7684 ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"outbase"})})]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5F97\u5230\u5176\u6700\u4F73\u5B9E\u8DF5\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u5728 bundle \u6784\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u53EA\u80FD\u6307\u5B9A ",(0,r.jsx)(n.code,{children:"input"})," \u3002"]})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u4E00\u822C\u60C5\u51B5\u4E0B\uFF0Cbundleless \u53EA\u9700\u8981\u6307\u5B9A ",(0,r.jsx)(n.code,{children:"sourceDir"}),"\uFF08\u6B64\u65F6 ",(0,r.jsx)(n.code,{children:"input"})," \u4F1A\u4E0E ",(0,r.jsx)(n.code,{children:"sourceDir"})," \u4FDD\u6301\u4E00\u81F4\uFF09\u3002"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u679C\u6211\u4EEC\u60F3\u8981\u5728 bundleless \u91CC\u53EA\u5BF9\u4E00\u90E8\u5206\u6587\u4EF6\u8FDB\u884C\u8F6C\u6362\uFF0C\u4F8B\u5982\u53EA\u9700\u8981\u8F6C\u6362 ",(0,r.jsx)(n.code,{children:"src/runtime"})," \u76EE\u5F55\u7684\u6587\u4EF6\uFF0C\u6B64\u65F6\u9700\u8981\u914D\u7F6E ",(0,r.jsx)(n.code,{children:"input"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n input: ['src/runtime'],\n sourceDir: 'src',\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u4F7F\u7528-swc",children:["\u4F7F\u7528 swc",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-swc",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728\u90E8\u5206\u573A\u666F\u4E0B\uFF0Cesbuild \u4E0D\u8DB3\u4EE5\u6EE1\u8DB3\u6211\u4EEC\u7684\u9700\u6C42\uFF0C\u6B64\u65F6\u6211\u4EEC\u4F1A\u4F7F\u7528 swc \u6765\u505A\u4EE3\u7801\u8F6C\u6362\u3002"}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE ",(0,r.jsx)(n.strong,{children:"2.36.0"})," \u7248\u672C\u5F00\u59CB\uFF0C\u6D89\u53CA\u5230\u4EE5\u4E0B\u529F\u80FD\u65F6\uFF0CModern.js Module \u9ED8\u8BA4\u4F1A\u4F7F\u7528 swc \uFF0C\u4F46\u4E0D\u8FD9\u610F\u5473\u7740\u4E0D\u4F7F\u7528 esbuild \u4E86\uFF0C\u5176\u4F59\u529F\u80FD\u8FD8\u662F\u4F7F\u7528 esbuild:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:"transformImport"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#transformlodash",children:"transformLodash"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#externalhelpers",children:"externalHelpers"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#format-umd",children:"format: umd"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/api/config/build-config#target",children:"target: es5"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata",target:"_blank",rel:"noopener noreferrer",children:"emitDecoratorMetadata: true"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 ",(0,r.jsx)(n.strong,{children:"2.16.0"})," \u7248\u672C\u5F00\u59CB\u5168\u91CF\u4F7F\u7528 swc \u8FDB\u884C\u4EE3\u7801\u8F6C\u6362\u3002\u4E0D\u8FC7 swc \u540C\u6837\u4E5F\u5B58\u5728\u4E00\u4E9B\u9650\u5236\uFF0C\u4E3A\u6B64\u6211\u4EEC\u6DFB\u52A0\u4E86 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#sourcetype",children:"sourceType"})," \u914D\u7F6E\uFF0C\u5F53\u6E90\u7801\u683C\u5F0F\u4E3A 'commonjs' \u65F6\u5173\u95ED swc\uFF0C \u4F46\u8FD9\u79CD\u65B9\u5F0F\u5E76\u4E0D\u7B26\u5408\u7528\u6237\u76F4\u89C9\uFF0C\u53E6\u5916\uFF0Cswc \u683C\u5F0F\u5316\u8F93\u51FA\u7684 cjs \u6A21\u5F0F\u6CA1\u6709\u7ED9\u6BCF\u4E2A\u5BFC\u51FA\u540D\u79F0\u6DFB\u52A0\u6CE8\u91CA\uFF0C\u8FD9\u5728 node \u4E2D\u4F7F\u7528\u53EF\u80FD\u4F1A\u5E26\u6765\u4E00\u4E9B\u95EE\u9898\u3002\n\u56E0\u4E3A\u6211\u4EEC\u5E9F\u5F03\u4E86\u6B64\u884C\u4E3A\uFF0C\u56DE\u5230\u4E86\u6700\u521D\u7684\u8BBE\u8BA1 - ",(0,r.jsx)(n.strong,{children:"\u53EA\u5728\u9700\u8981\u7684\u573A\u666F\u4E0B\u4F7F\u7528 swc \u4F5C\u4E3A\u8865\u5145"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",children:["\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86 Hook \u673A\u5236\uFF0C\u5141\u8BB8\u6211\u4EEC\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u4E0D\u540C\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002\nModern.js Module Hook \u4F7F\u7528\u4E86 ",(0,r.jsx)(n.a,{href:"https://github.com/webpack/tapable",target:"_blank",rel:"noopener noreferrer",children:"tapable"})," \u5B9E\u73B0\uFF0C\u6269\u5C55\u4E86 esbuild \u7684\u63D2\u4EF6\u673A\u5236\uFF0C\u82E5 esbuild plugins \u5DF2\u7ECF\u6EE1\u8DB3\u4E86\u4F60\u7684\u9700\u6C42,\u5EFA\u8BAE\u76F4\u63A5\u4F7F\u7528\u5B83\u3002\n\u4E0B\u9762\u5C55\u5F00\u8BF4\u660E\u5176\u7528\u6CD5:"]}),"\n",(0,r.jsxs)(n.h3,{id:"hook-\u7C7B\u578B",children:["Hook \u7C7B\u578B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-\u7C7B\u578B",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"asyncseriesbailhook",children:["AsyncSeriesBailHook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncseriesbailhook",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4E32\u884C\u6267\u884C\u7684 hooks\uFF0C\u5982\u679C\u67D0\u4E2A tapped function \u8FD4\u56DE\u975E undefined \u7ED3\u679C\uFF0C\u5219\u540E\u7EED\u5176\u4ED6\u7684 tapped function \u505C\u6B62\u6267\u884C\u3002"}),"\n",(0,r.jsxs)(n.h4,{id:"asyncserieswaterfallhooks",children:["AsyncSeriesWaterFallHooks",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncserieswaterfallhooks",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u4E32\u884C\u6267\u884C\u7684 hooks\uFF0C\u5176\u7ED3\u679C\u4F1A\u4F20\u9012\u7ED9\u4E0B\u4E00\u4E2A tapped function"}),"\n",(0,r.jsxs)(n.h3,{id:"hook-api",children:["Hook API",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-api",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"load",children:["load",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#load",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesBailHook"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," \u89E6\u53D1\uFF0C\u6839\u636E\u6A21\u5757\u8DEF\u5F84\u6765\u83B7\u53D6\u6A21\u5757\u5185\u5BB9"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"interface LoadArgs {\n path: string;\n namespace: string;\n suffix: string;\n}\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u8FD4\u56DE\u53C2\u6570"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type LoadResult =\n | {\n contents: string; // \u6A21\u5757\u5185\u5BB9\n map?: SourceMap; // https://esbuild.github.io/api/#sourcemap\n loader?: Loader; // https://esbuild.github.io/api/#loader\n resolveDir?: string;\n }\n | undefined;\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.load.tapPromise('load content from memfs', async args => {\n const contents = memfs.readFileSync(args.path);\n return {\n contents: contents,\n loader: 'js',\n };\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"transform",children:["transform",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transform",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," \u89E6\u53D1\uFF0C\n\u5C06 load \u9636\u6BB5\u83B7\u53D6\u7684\u6A21\u5757\u5185\u5BB9\u8FDB\u884C\u8F6C\u6362"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570(\u8FD4\u56DE\u53C2\u6570)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export type Source = {\n code: string;\n map?: SourceMap;\n path: string;\n loader?: string;\n};\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.transform.tapPromise('6to5', async args => {\n const result = babelTransform(args.code, { presets: ['@babel/preset-env'] });\n return {\n code: result.code,\n map: result.map,\n };\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"renderchunk",children:["renderChunk",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#renderchunk",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,r.jsxs)(n.li,{children:["\u5728 esbuild ",(0,r.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-end",target:"_blank",rel:"noopener noreferrer",children:"onEnd callbacks"})," \u89E6\u53D1\uFF0C\n\u7C7B\u4F3C\u4E8E transform hook\uFF0C\u4F46\u662F\u4F5C\u7528\u5728 esbuild \u751F\u6210\u7684\u4EA7\u7269"]}),"\n",(0,r.jsx)(n.li,{children:"\u8F93\u5165\u53C2\u6570(\u8FD4\u56DE\u53C2\u6570)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export type AssetChunk = {\n type: 'asset';\n contents: string | Buffer;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n originalFileName?: string;\n};\n\nexport type JsChunk = {\n type: 'chunk';\n contents: string;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n map?: SourceMap;\n modules?: Record;\n originalFileName?: string;\n};\n\nexport type Chunk = AssetChunk | JsChunk;\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4F8B\u5B50"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.renderChunk.tapPromise('minify', async chunk => {\n if (chunk.type === 'chunk') {\n const code = chunk.contents.toString();\n const result = await minify.call(compiler, code);\n return {\n ...chunk,\n contents: result.code,\n map: result.map,\n };\n }\n return chunk;\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",children:["\u7C7B\u578B\u6587\u4EF6\u751F\u6210",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B\u6587\u4EF6\u751F\u6210",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/api/config/build-config#dts",children:(0,r.jsx)(n.code,{children:"buildConfig.dts"})})," \u914D\u7F6E\u4E3B\u8981\u7528\u4E8E\u7C7B\u578B\u6587\u4EF6\u7684\u751F\u6210\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",children:["\u5173\u95ED\u7C7B\u578B\u751F\u6210",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5173\u95ED\u7C7B\u578B\u751F\u6210",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u7C7B\u578B\u751F\u6210\u529F\u80FD\u662F\u5F00\u542F\u7684\uFF0C\u5982\u679C\u9700\u8981\u5173\u95ED\u7684\u8BDD\uFF0C\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n dts: false,\n },\n});\n"})}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsx)(n.p,{children:"\u5173\u95ED\u7C7B\u578B\u6587\u4EF6\u540E\uFF0C\u4E00\u822C\u6765\u8BF4\u6784\u5EFA\u901F\u5EA6\u4F1A\u6709\u6240\u63D0\u5347\u3002"})})]}),"\n",(0,r.jsxs)(n.h3,{id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",children:["\u6253\u5305\u7C7B\u578B\u6587\u4EF6",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6253\u5305\u7C7B\u578B\u6587\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"buildType: 'bundleless'"})," \u7684\u65F6\u5019\uFF0C\u7C7B\u578B\u6587\u4EF6\u7684\u751F\u6210\u662F\u4F7F\u7528\u9879\u76EE\u7684 ",(0,r.jsx)(n.code,{children:"tsc"})," \u547D\u4EE4\u6765\u5B8C\u6210\u751F\u4EA7\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Modern.js Module \u540C\u65F6\u8FD8\u652F\u6301\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305"}),"\uFF0C\u4E0D\u8FC7\u4F7F\u7528\u8BE5\u529F\u80FD\u7684\u65F6\u5019\u9700\u8981\u6CE8\u610F\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u4E0D\u4F1A\u5F00\u542F\u7C7B\u578B\u68C0\u67E5\u3002"}),"\n",(0,r.jsxs)(n.li,{children:["\u4E00\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5B58\u5728\u9519\u8BEF\u7684\u8BED\u6CD5\u4F1A\u5BFC\u81F4\u6253\u5305\u8FC7\u7A0B\u5931\u8D25\u3002\u56E0\u6B64\u5BF9\u4E8E\u8FD9\u79CD\u60C5\u51B5\uFF0C\u9700\u8981\u624B\u52A8\u901A\u8FC7 ",(0,r.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,r.jsx)(n.code,{children:"buildConfig.externals"})})," \u5C06\u8FD9\u7C7B\u7B2C\u4E09\u65B9\u5305\u6392\u9664\uFF0C\u6216\u8005\u76F4\u63A5\u5173\u95ED",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:"dts.respectExternal"}),"\u4ECE\u800C\u4E0D\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u7C7B\u578B\u6587\u4EF6\u6307\u5411\u7684\u662F\u4E00\u4E2A ",(0,r.jsx)(n.code,{children:".ts"})," \u6587\u4EF6\u7684\u60C5\u51B5\uFF0C\u76EE\u524D\u65E0\u6CD5\u5904\u7406\u3002\u6BD4\u5982\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684 ",(0,r.jsx)(n.code,{children:"package.json"})," \u4E2D\u5B58\u5728\u8FD9\u6837\u7684\u5185\u5BB9\uFF1A ",(0,r.jsx)(n.code,{children:'{"types": "./src/index.ts"'}),"\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5BF9\u4E8E\u4E0A\u8FF0\u95EE\u9898\uFF0C\u6211\u4EEC\u63A8\u8350\u7684\u5904\u7406\u65B9\u5F0F\u662F\u9996\u5148\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210 d.ts \u6587\u4EF6\uFF0C\u7136\u540E\u5C06 index.d.ts \u4F5C\u4E3A\u5165\u53E3\u8FDB\u884C\u6253\u5305\u5904\u7406\uFF0C\u5E76\u4E14\u5173\u95ED ",(0,r.jsx)(n.code,{children:"dts.respectExternal"}),"\u3002\u5728\u4E4B\u540E\u7684\u6F14\u8FDB\u6211\u4EEC\u4E5F\u4F1A\u9010\u6E10\u5411\u8FD9\u79CD\u5904\u7406\u65B9\u5F0F\u9760\u62E2\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u522B\u540D\u8F6C\u6362",children:["\u522B\u540D\u8F6C\u6362",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u522B\u540D\u8F6C\u6362",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5728 bundleless \u6784\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u5982\u679C\u6E90\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u522B\u540D\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="./src/index.ts"',children:"import utils from '@common/utils';\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7684\u4EA7\u7269\u7C7B\u578B\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u8FD9\u4E9B\u522B\u540D\u3002\u4E0D\u8FC7 Modern.js Module \u4F1A\u5BF9 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210\u7684\u7C7B\u578B\u6587\u4EF6\u91CC\u7684\u522B\u540D\u8FDB\u884C\u8F6C\u6362\u5904\u7406\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"\u4E00\u4E9B\u793A\u4F8B",children:["\u4E00\u4E9B\u793A\u4F8B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E00\u4E9B\u793A\u4F8B",children:"#"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6B64\u65F6\u6253\u5305\u7684\u7C7B\u578B\u6587\u4EF6\u8F93\u51FA\u8DEF\u5F84\u4E3A `./dist/types`\uFF0C\u5E76\u4E14\u5C06\u4F1A\u8BFB\u53D6\u9879\u76EE\u4E0B\u7684 other-tsconfig.json \u6587\u4EF6\n buildConfig: {\n buildType: 'bundle',\n dts: {\n tsconfigPath: './other-tsconfig.json',\n distPath: './types',\n },\n outDir: './dist',\n },\n});\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6B64\u65F6\u7C7B\u578B\u6587\u4EF6\u6CA1\u6709\u8FDB\u884C\u6253\u5305\uFF0C\u8F93\u51FA\u8DEF\u5F84\u4E3A `./dist/types`\n buildConfig: [\n {\n buildType: 'bundle',\n dts: false,\n outDir: './dist',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"\u6784\u5EFA\u8FC7\u7A0B",children:["\u6784\u5EFA\u8FC7\u7A0B",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u8FC7\u7A0B",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,r.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u53D1\u751F"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u6839\u636E ",(0,r.jsx)(n.code,{children:"buildConfig.outDir"})," \u6E05\u7406\u4EA7\u7269\u76EE\u5F55\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u7F16\u8BD1 ",(0,r.jsx)(n.code,{children:"js/ts"})," \u6E90\u4EE3\u7801\u751F\u6210 bundle / bundleless \u7684 JS \u6784\u5EFA\u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"tsc"})," \u751F\u6210 bundle / bundleless \u7684\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5904\u7406 ",(0,r.jsx)(n.code,{children:"copy"})," \u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u6784\u5EFA\u62A5\u9519",children:["\u6784\u5EFA\u62A5\u9519",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u62A5\u9519",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u5F53\u53D1\u751F\u6784\u5EFA\u62A5\u9519\u7684\u65F6\u5019\uFF0C\u57FA\u4E8E\u4EE5\u4E0A\u4E86\u89E3\u5230\u7684\u4FE1\u606F\uFF0C\u53EF\u4EE5\u5F88\u5BB9\u6613\u7684\u660E\u767D\u5728\u7EC8\u7AEF\u51FA\u73B0\u7684\u62A5\u9519\u5185\u5BB9\uFF1A"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"js \u6216\u8005 ts \u6784\u5EFA\u7684\u62A5\u9519\uFF1A"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'error ModuleBuildError:\n\n\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 bundle failed: \u2502\n\u2502 - format is "cjs" \u2502\n\u2502 - target is "esnext" \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n\nDetailed Information:\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u8FC7\u7A0B\u7684\u62A5\u9519\uFF1A"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"error ModuleBuildError:\n\nbundle DTS failed:\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u5BF9\u4E8E ",(0,r.jsx)(n.code,{children:"js/ts"})," \u6784\u5EFA\u9519\u8BEF\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4ECE\u62A5\u9519\u4FE1\u606F\u4E2D\u77E5\u9053\uFF1A"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"buildType"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"format"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u62A5\u9519\u7684 ",(0,r.jsx)(n.code,{children:"target"})]}),"\n",(0,r.jsx)(n.li,{children:"\u5176\u4ED6\u5177\u4F53\u62A5\u9519\u4FE1\u606F"}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"\u8C03\u8BD5\u6A21\u5F0F",children:["\u8C03\u8BD5\u6A21\u5F0F",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8C03\u8BD5\u6A21\u5F0F",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u4ECE ",(0,r.jsx)(n.strong,{children:"2.36.0"})," \u7248\u672C\u5F00\u59CB\uFF0C\u4E3A\u4E86\u4FBF\u4E8E\u6392\u67E5\u95EE\u9898\uFF0CModern.js Module \u63D0\u4F9B\u4E86\u8C03\u8BD5\u6A21\u5F0F\uFF0C\u4F60\u53EF\u4EE5\u5728\u6267\u884C\u6784\u5EFA\u65F6\u6DFB\u52A0 DEBUG=module \u73AF\u5883\u53D8\u91CF\u6765\u5F00\u542F\u8C03\u8BD5\u6A21\u5F0F\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"DEBUG=module modern build\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u8C03\u8BD5\u6A21\u5F0F\u4E0B\uFF0C\u4F60\u4F1A\u770B\u5230 Shell \u4E2D\u8F93\u51FA\u66F4\u8BE6\u7EC6\u7684\u6784\u5EFA\u65E5\u5FD7\uFF0C\u8FD9\u4E3B\u8981\u4EE5\u6D41\u7A0B\u65E5\u5FD7\u4E3A\u4E3B\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"module run beforeBuildTask hooks +6ms\nmodule run beforeBuildTask hooks done +0ms\nmodule [DTS] Build Start +139ms\nmodule [CJS] Build Start +1ms\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u53E6\u5916\uFF0CModule \u8FD8\u63D0\u4F9B\u4E86\u8C03\u8BD5\u5185\u90E8\u5DE5\u4F5C\u6D41\u7A0B\u7684\u80FD\u529B\u3002\u4F60\u53EF\u4EE5\u901A\u8FC7\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF ",(0,r.jsx)(n.code,{children:"DEBUG=module:*"})," \u6765\u5F00\u542F\u66F4\u8BE6\u7EC6\u7684\u8C03\u8BD5\u65E5\u5FD7:"]}),"\n",(0,r.jsxs)(n.p,{children:["\u76EE\u524D\u53EA\u652F\u6301\u4E86 ",(0,r.jsx)(n.code,{children:"DEBUG=module:resolve"}),"\uFF0C\u53EF\u4EE5\u67E5\u770B Module \u5185\u90E8\u6A21\u5757\u89E3\u6790\u7684\u8BE6\u7EC6\u65E5\u5FD7:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:" module:resolve onResolve args: {\n path: './src/hooks/misc.ts',\n importer: '',\n namespace: 'file',\n resolveDir: '/Users/bytedance/modern.js/packages/solutions/module-tools',\n kind: 'entry-point',\n pluginData: undefined\n} +0ms\n module:resolve onResolve result: {\n path: '/Users/bytedance/modern.js/packages/solutions/module-tools/src/hooks/misc.ts',\n external: false,\n namespace: 'file',\n sideEffects: undefined,\n suffix: ''\n} +0ms\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fin-depth-about-build.md"]={toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4},{text:"Hook API",id:"hook-api",depth:3},{text:"load",id:"load",depth:4},{text:"transform",id:"transform",depth:4},{text:"renderChunk",id:"renderchunk",depth:4},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2}],title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3747.04231f3b.js b/modern-js/module-tools/static/js/async/3747.04231f3b.js deleted file mode 100644 index 7a58414afd..0000000000 --- a/modern-js/module-tools/static/js/async/3747.04231f3b.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 3747.04231f3b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3747"],{1445:function(n,e,s){"use strict";s.r(e);var o=s("39980"),i=s("9580");function t(n){let e=Object.assign({pre:"pre",code:"code",p:"p"},(0,i.ah)(),n.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,o.jsx)(e.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"})]})}function l(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,i.ah)(),n.components);return e?(0,o.jsx)(e,{...n,children:(0,o.jsx)(t,{...n})}):t(n)}e.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fcomponents%2Fregister-esbuild-plugin.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3760.a3abbc2c.js b/modern-js/module-tools/static/js/async/3760.a3abbc2c.js deleted file mode 100644 index c628825866..0000000000 --- a/modern-js/module-tools/static/js/async/3760.a3abbc2c.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 3760.a3abbc2c.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3760"],{6470:function(e,n,i){"use strict";i.r(n);var r=i("39980"),s=i("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",h2:"h2",h3:"h3",code:"code",pre:"pre",ul:"ul",li:"li",ol:"ol",h4:"h4",img:"img"},(0,s.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"build-faq",children:["Build FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-faq",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Here only some common problems and bad cases are recorded."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["If the build products do not meet expectations, especially when ",(0,r.jsx)(n.a,{href:"/api/config/build-preset",children:"buildPreset"})," is configured,\nplease first understand what configuration items buildPreset represents, and then check each configuration item based on all configuration items."]})}),"\n",(0,r.jsxs)(n.h2,{id:"product-faq",children:["Product FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#product-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"initialization-of-class-fields",children:["Initialization of Class Fields",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#initialization-of-class-fields",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["TypeSript provides the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration to control the conversion handling for ",(0,r.jsx)(n.code,{children:"public class fields"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"If we have a piece of code:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n foo = 100;\n bar: string;\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is ",(0,r.jsx)(n.code,{children:"false"}),", then the compiled code will look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n this.foo = 100;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is ",(0,r.jsx)(n.code,{children:"true"}),", then the compiled code will look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"class C {\n constructor() {\n Object.defineProperty(this, 'foo', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 100,\n });\n Object.defineProperty(this, 'bar', {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0,\n });\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Also the default value of this configuration will change depending on the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#target",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"target"})})," configuration of tsconfig.json: When ",(0,r.jsx)(n.code,{children:"target"})," is ES2022 or higher, then ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," is configured to ",(0,r.jsx)(n.code,{children:"true"})," by default, otherwise it defaults to ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"For more information on this configuration of TypeScript, you can refer to the following link:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier",target:"_blank",rel:"noopener noreferrer",children:"The useDefineForClassFields Flag and The declare Property Modifier"})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"The Modern.js Module will currently process according to the following logic:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["The first decision to enable this feature inside Modern.js Module is based on the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration in tsconfig.json of the current project. Currently, only the contents of the tsconfig.json file under the current project path will be read, and the final tsconfig configuration based on the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#extends",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"extends"})})," configuration is not supported at this time."]}),"\n",(0,r.jsxs)(n.li,{children:["If the ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," configuration of tsconfig.json is not detected, the default value is determined based on the ",(0,r.jsx)(n.code,{children:"target"})," configuration of tsconfig.json. If ",(0,r.jsx)(n.code,{children:"target"})," is greater than ",(0,r.jsx)(n.code,{children:"ES2022"})," (including ",(0,r.jsx)(n.code,{children:"EsNext"}),"), then ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," defaults to ",(0,r.jsx)(n.code,{children:"true"}),", otherwise it is ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["If the ",(0,r.jsx)(n.code,{children:"target"})," of tsconfig.json is not detected, it is processed according to the value of ",(0,r.jsx)(n.code,{children:"useDefineForClassFields"})," as ",(0,r.jsx)(n.code,{children:"true"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",children:["babel-plugin-lodash treats the introduced lodash as ",(0,r.jsx)(n.code,{children:"undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"This problem occurs when using something like the following:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Lodash from 'lodash';\n\nexport const libs = {\n _: Lodash,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Current related issues on the ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"})," Github:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/lodash/babel-plugin-lodash/issues/235",target:"_blank",rel:"noopener noreferrer",children:"#235"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["The solution to this problem is to remove ",(0,r.jsx)(n.code,{children:"babel-plugin-lodash"}),", since the plugin is not needed for on-demand referencing at this point and using it would have side effects."]}),"\n",(0,r.jsxs)(n.p,{children:["A similar situation occurs with ",(0,r.jsx)(n.code,{children:"babel-plugin-import"}),". If there is code like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import * as Comps from 'components';\n\nexport const libs = {\n comps: Comps,\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["In this case ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," may also cause ",(0,r.jsx)(n.code,{children:"Comps"})," to become ",(0,r.jsx)(n.code,{children:"undefined"}),". So you need to remove the corresponding ",(0,r.jsx)(n.code,{children:"babel-plugin-import"})," as well."]}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-module-http",children:["Cannot find module http",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-http",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["If the output reports an error like ",(0,r.jsx)(n.code,{children:"Cannot find module 'http'"})," at browser runtime, it means that your output has bundled node modules.\nThis may occur if some of your dependencies support both browser and node, such as ",(0,r.jsx)(n.code,{children:"axios"}),", in which case you only need to set the ",(0,r.jsx)(n.a,{href:"/api/config/build-config#platform",children:"platform"})," to ",(0,r.jsx)(n.code,{children:"browser"}),".\nIf some third-party packages don't support the browser, you may need to manually inject ",(0,r.jsx)(n.a,{href:"/plugins/official-list/plugin-node-polyfill",children:"node polyfill"}),"."]}),"\n",(0,r.jsxs)(n.h2,{id:"exceptions-faq",children:["Exceptions FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#exceptions-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"dynamic-require-of-react-is-not-supported",children:['Dynamic require of "react" is not supported',(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dynamic-require-of-react-is-not-supported",children:"#"})]}),"\n",(0,r.jsxs)(n.h4,{id:"problem-description",children:["Problem Description",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#problem-description",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When the product format in the product configuration of the build is ES modules."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"If you import a cjs product from a third-party npm package, the resulting product may not work properly under webpack."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/1280X1280.png",alt:""})}),"\n",(0,r.jsxs)(n.h4,{id:"solution",children:["Solution",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#solution",children:"#"})]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"First you need to find which third-party package is causing the problem"}),". For example, if the error message points to the ",(0,r.jsx)(n.code,{children:"react"})," package, then look for a third-party package that has code like ",(0,r.jsx)(n.code,{children:"require('react')"})," in it. For example ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/react-draggable",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"react-draggable"})}),", which only contains ",(0,r.jsx)(n.code,{children:"cjs"})," artifacts, then the problem is localized to the ",(0,r.jsx)(n.code,{children:"react-draggable"})," package."]}),"\n",(0,r.jsxs)(n.li,{children:["Then we need to exclude this package with the following configuration, i.e. ",(0,r.jsx)(n.strong,{children:"not package problematic third-party packages"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n externals: ['react-draggable'],\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"reference-links",children:["Reference Links",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#reference-links",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/68423950/when-using-esbuild-with-external-react-i-get-dynamic-require-of-react-is-not-s",target:"_blank",rel:"noopener noreferrer",children:'When using esbuild with external react I get Dynamic require of "react" is not supported'})}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",children:["During compilation, an error was reported in the less file of a component library:",(0,r.jsx)(n.code,{children:"'Operation on an invalid type'"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["This is probably because the component library depends on Less version v3, while Modern.js Module defaults to v4. v3 and v4 have a Break Change in the ",(0,r.jsx)(n.code,{children:"math"})," configuration, check this ",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/73298187/less-error-operation-on-an-invalid-type-in-antd-dependency",target:"_blank",rel:"noopener noreferrer",children:"link"})," for details."]}),"\n",(0,r.jsx)(n.p,{children:"Therefore, if a component library like this is used in the source code:"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"buildPreset"})," is used in the build configuration, make the following changes:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildPreset({ extendPreset }) {\n return extendPreset('your-build-preset', {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n });\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Or, if a custom ",(0,r.jsx)(n.code,{children:"buildConfig"})," is used, modify it as follows:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"module.exports = {\n buildConfig: {\n style: {\n less: {\n lessOptions: {\n math: 'always',\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"If you are using a component like this in Storybook, you will need to modify the debugging configuration of Storybook:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:"filename='.storybook/main.ts'",children:"module.exports = {\n framework: {\n options: {\n builderConfig: {\n tools: {\n webpackChain(chain, { CHAIN_ID }) {\n chain.module\n .rule(CHAIN_ID.RULE.LESS)\n .use(CHAIN_ID.USE.LESS)\n .tap(options => {\n options.lessOptions = {\n ...options.lessOptions,\n math: 'always',\n };\n return options;\n });\n },\n },\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"bundleless-dts-failed",children:["Bundleless DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["In the bundleless scenario, it's ",(0,r.jsx)(n.code,{children:"tsc"})," that generates the type declaration file directly. You can find the problem file by printing the error message in the terminal.\nFor source code files, it is recommended to fix the type problem, which can better enable reuse of your package. However. if you encounter a type checking problem with a thrid-party package:"]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["enable ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#skipLibCheck",target:"_blank",rel:"noopener noreferrer",children:"skipLibCheck"})," to skip the d.ts check of the thrid-party package."]}),"\n",(0,r.jsxs)(n.li,{children:["If the package exports ts files directly, skipLibCheck will not work because it can only skip the d.ts check,\nso you can only turn off ",(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsabortonerror",children:"dts.abortOnError"})," to ignore these errors."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"bundle-dts-failed",children:["Bundle DTS failed",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-dts-failed",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["The Modern.js Module directly uses ",(0,r.jsx)(n.a,{href:"https://github.com/Swatinem/rollup-plugin-dts",target:"_blank",rel:"noopener noreferrer",children:"rollup-plugin-dts"})," to package your type description files.\n",(0,r.jsx)(n.strong,{children:"It may not be able to handle the type files of some third-party dependencies"})]}),"\n",(0,r.jsxs)(n.p,{children:['If you encounter an error message titled "Bundle DTS failed" during the build process of the Modern.js Module, you can observe that the error message is from a third-party dependency.\nTry setting ',(0,r.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:(0,r.jsx)(n.code,{children:"dts.respectExternal"})})," to ",(0,r.jsx)(n.code,{children:"false"})," to turn off the behavior of packaging type files of third-party dependencies."]}),"\n",(0,r.jsxs)(n.h3,{id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",children:["Error reported for ",(0,r.jsx)(n.code,{children:"defineConfig"})," function type: ",(0,r.jsx)(n.code,{children:'If there is no reference to "..." then the inferred type of "default" cannot be named'}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Check if the ",(0,r.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#include",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"include"})})," configuration exists in the project's tsconfig.json file, and if not, try adding the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "include": ["src"]\n}\n'})}),"\n",(0,r.jsxs)(n.h2,{id:"other-faq",children:["Other FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#other-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",children:["How to skip the pre-processing of less/scss files with bundleless",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["Bundleless is a single-file compilation method. You just need to remove your less/scss files from the entry and copy them to the output.\nNote that we will also rewrite the moduleId of js referencing less/scss, turn it off through the ",(0,r.jsx)(n.a,{href:"/api/config/build-config#redirect",children:"redirect"})," plugin."]}),"\n",(0,r.jsx)(n.p,{children:"Below is an example of skipping less file processing. You will find that all less files in src are copied to dist and the relative path is preserved."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/**/*.less'],\n redirect: {\n style: false,\n },\n copy: {\n patterns: [\n {\n from: './**/*.less',\n to: './',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n});\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"add-additional-compilation-feature",children:["Add additional compilation feature",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-additional-compilation-feature",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"The Modern.js Module is based on the esbuild implementation, so if you have special needs or want to add additional compilation capabilities, you can do so by implementing the esbuild plugin."}),"\n",(0,r.jsxs)(n.p,{children:["The Modern.js Module provides ",(0,r.jsx)(n.a,{href:"/api/config/build-config#esbuildoptions",children:(0,r.jsx)(n.code,{children:"esbuildOptions"})})," configuration to allow modification of Modern.js's internal esbuild configuration, so that custom esbuild plugins can be added via this configuration:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,r.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."}),"\n",(0,r.jsxs)(n.h3,{id:"support-for-generating-typescript-declaration-files-for-css-modules",children:["Support for generating TypeScript declaration files for CSS Modules",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#support-for-generating-typescript-declaration-files-for-css-modules",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["First Solution: ",(0,r.jsx)(n.a,{href:"https://github.com/Quramy/typed-css-modules",target:"_blank",rel:"noopener noreferrer",children:"typed-css-modules"})]}),"\n",(0,r.jsxs)(n.li,{children:["Second Solution: ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/@guanghechen/postcss-modules-dts",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules-dts"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig(async () => {\n const { dts } = await import('@guanghechen/postcss-modules-dts');\n return {\n buildConfig: {\n style: {\n modules: { ...dts },\n },\n },\n // custom config\n };\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Fbuild.mdx"]={toc:[{text:"Product FAQ",id:"product-faq",depth:2},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3},{text:"Cannot find module http",id:"cannot-find-module-http",depth:3},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3},{text:"Problem Description",id:"problem-description",depth:4},{text:"Solution",id:"solution",depth:4},{text:"Reference Links",id:"reference-links",depth:4},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3},{text:"Other FAQ",id:"other-faq",depth:2},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3}],title:"Build FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4053.30624338.js b/modern-js/module-tools/static/js/async/3900.4969da18.js similarity index 93% rename from modern-js/module-tools/static/js/async/4053.30624338.js rename to modern-js/module-tools/static/js/async/3900.4969da18.js index 8c88738826..bed7043d8d 100644 --- a/modern-js/module-tools/static/js/async/4053.30624338.js +++ b/modern-js/module-tools/static/js/async/3900.4969da18.js @@ -1,2 +1,2 @@ -/*! For license information please see 4053.30624338.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4053"],{64219:function(e,n,t){"use strict";t.r(n);var r=t("39980"),o=t("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h3:"h3",code:"code",p:"p",img:"img"},(0,o.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"test-faq",children:["Test FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#test-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:["Execute ",(0,r.jsx)(n.code,{children:"test"})," command with an error ",(0,r.jsx)(n.code,{children:"TypeError: Cannot read property 'testEnvironmentOptions' of undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/jest-error-testEnvironmentOptions-of-undefined.jpeg",alt:"jest-error"})}),"\n",(0,r.jsxs)(n.p,{children:["You can check whether other projects in Monorepo have ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," dependencies and unify them with the overrides provided by Monorepo."]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Ftest.mdx"]={toc:[{text:"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:3}],title:"Test FAQ",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 3900.4969da18.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3900"],{37549:function(e,n,t){"use strict";t.r(n);var r=t("39980"),o=t("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h3:"h3",code:"code",p:"p",img:"img"},(0,o.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"test-faq",children:["Test FAQ",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#test-faq",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:["Execute ",(0,r.jsx)(n.code,{children:"test"})," command with an error ",(0,r.jsx)(n.code,{children:"TypeError: Cannot read property 'testEnvironmentOptions' of undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/jest-error-testEnvironmentOptions-of-undefined.jpeg",alt:"jest-error"})}),"\n",(0,r.jsxs)(n.p,{children:["You can check whether other projects in Monorepo have ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," dependencies and unify them with the overrides provided by Monorepo."]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Ftest.mdx"]={toc:[{text:"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:3}],title:"Test FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3934.38c21141.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3900.4969da18.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3934.38c21141.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3900.4969da18.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6356.53c422e3.js b/modern-js/module-tools/static/js/async/3937.df16bfbb.js similarity index 99% rename from modern-js/module-tools/static/js/async/6356.53c422e3.js rename to modern-js/module-tools/static/js/async/3937.df16bfbb.js index fec8ff69ed..5b45a0bf88 100644 --- a/modern-js/module-tools/static/js/async/6356.53c422e3.js +++ b/modern-js/module-tools/static/js/async/3937.df16bfbb.js @@ -1,2 +1,2 @@ -/*! For license information please see 6356.53c422e3.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6356"],{50049:function(e,s,n){"use strict";n.r(s);var r=n("39980"),l=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul",h3:"h3",blockquote:"blockquote",strong:"strong"},(0,l.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.h1,{id:"\u5F00\u53D1\u7EC4\u4EF6",children:["\u5F00\u53D1\u7EC4\u4EF6",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u7EC4\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u672C\u7AE0\u5C06\u8981\u4ECB\u7ECD\u5982\u4F55\u4F7F\u7528 Modern.js Module \u5F00\u53D1\u7EC4\u4EF6\u9879\u76EE\u3002"}),"\n",(0,r.jsxs)(s.h2,{id:"\u521D\u59CB\u5316\u9879\u76EE",children:["\u521D\u59CB\u5316\u9879\u76EE",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521D\u59CB\u5316\u9879\u76EE",children:"#"})]}),"\n",(0,r.jsxs)(s.ol,{children:["\n",(0,r.jsxs)(s.li,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"@modern-js/create"})," \u547D\u4EE4\u6765\u521D\u59CB\u5316\u4E00\u4E2A npm \u9879\u76EE\u3002"]}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-text",meta:'title="\u4EA4\u4E92\u5F0F\u95EE\u9898"',children:"npx @modern-js/create@latest components-project\n\n? \u8BF7\u9009\u62E9\u4F60\u60F3\u521B\u5EFA\u7684\u5DE5\u7A0B\u7C7B\u578B\uFF1ANpm \u6A21\u5757\n? \u8BF7\u586B\u5199\u9879\u76EE\u540D\u79F0\uFF1Acomponents-demo\n? \u8BF7\u9009\u62E9\u5F00\u53D1\u8BED\u8A00\uFF1ATS\n? \u8BF7\u9009\u62E9\u5305\u7BA1\u7406\u5DE5\u5177\uFF1Apnpm\n"})}),"\n",(0,r.jsxs)(s.ol,{start:"2",children:["\n",(0,r.jsx)(s.li,{children:"\u521D\u59CB\u5316\u7684\u76EE\u5F55\u7ED3\u6784\u5982\u4E0B\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 README.md\n\u251C\u2500\u2500 node_modules/\n\u251C\u2500\u2500 dist/\n\u251C\u2500\u2500 modern.config.ts\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pnpm-lock.yaml\n\u251C\u2500\u2500 src\n\u2502 \u251C\u2500\u2500 index.ts\n\u2502 \u2514\u2500\u2500 modern-app-env.d.ts\n\u2514\u2500\u2500 tsconfig.json\n"})}),"\n",(0,r.jsxs)(s.ol,{start:"3",children:["\n",(0,r.jsxs)(s.li,{children:["\u6700\u540E\u4FEE\u6539 ",(0,r.jsx)(s.code,{children:"./src/index.ts"})," \u6587\u4EF6\u540E\u7F00\u548C\u5185\u5BB9\u5982\u4E0B\uFF0C\u5C31\u5B8C\u6210\u4E86\u7EC4\u4EF6\u9879\u76EE\u7684\u521D\u59CB\u5316\u3002"]}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"export default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",children:["\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u8BF7\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/basic/using-storybook",children:"\u300C\u4F7F\u7528 Storybook\u300D"})," \u6765\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801\u3002"]}),"\n",(0,r.jsxs)(s.h2,{id:"\u5F00\u53D1\u6837\u5F0F",children:["\u5F00\u53D1\u6837\u5F0F",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6837\u5F0F",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u53EF\u4EE5\u7ED9\u7EC4\u4EF6\u6DFB\u52A0\u6837\u5F0F\u3002"}),"\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u652F\u6301\u5F00\u53D1\u6837\u5F0F\u7684\u80FD\u529B\u6709\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"CSS/PostCSS"}),"\n",(0,r.jsx)(s.li,{children:"Less"}),"\n",(0,r.jsx)(s.li,{children:"Scss/Sass"}),"\n",(0,r.jsx)(s.li,{children:"Tailwind CSS"}),"\n",(0,r.jsx)(s.li,{children:"CSS Modules"}),"\n"]}),"\n",(0,r.jsxs)(s.h3,{id:"csspostcss",children:["CSS/PostCSS",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#csspostcss",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301 PostCSS\uFF0C\u5E76\u4E14\u5185\u7F6E\u4E86\u4EE5\u4E0B PostCSS \u63D2\u4EF6\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/luisrudge/postcss-flexbugs-fixes",target:"_blank",rel:"noopener noreferrer",children:"flexbugs-fixes"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-custom-properties",target:"_blank",rel:"noopener noreferrer",children:"custom-properties"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/maximkoretskiy/postcss-initial",target:"_blank",rel:"noopener noreferrer",children:"initial"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/shrpne/postcss-page-break",target:"_blank",rel:"noopener noreferrer",children:"page-break"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-font-variant",target:"_blank",rel:"noopener noreferrer",children:"font-variant"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-media-minmax",target:"_blank",rel:"noopener noreferrer",children:"media-minmax"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",target:"_blank",rel:"noopener noreferrer",children:"nesting"})}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5728\u9879\u76EE\u4E2D\u521B\u5EFA ",(0,r.jsx)(s.code,{children:".css"})," \u6587\u4EF6\uFF0C\u5E76\u4E14\u53EF\u4EE5\u76F4\u63A5\u5728 css \u6587\u4EF6\u4E2D\u4F7F\u7528\u8FD9\u4E9B\u63D2\u4EF6\u63D0\u4F9B\u7684\u8BED\u6CD5\u652F\u6301\u548C\u80FD\u529B\u3002"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-less",meta:'title="./src/index.css"',children:'a,\nb {\n color: red;\n\n /* "&" comes first */\n & c,\n & d {\n color: white;\n }\n\n /* "&" comes later, requiring "@nest" */\n @nest e & {\n color: yellow;\n }\n}\n'})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"CSS \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:"a,\nb {\n color: red;\n}\na c,\nb c,\na d,\nb d {\n color: white;\n}\ne a,\ne b {\n color: yellow;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"less",children:["Less",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Less \u5F00\u53D1\u6837\u5F0F\u3002"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u5185\u7F6E\u7684 Less \u7248\u672C\u4E3A v4.1.3"}),"\n"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-less",meta:'title="./src/common.less"',children:"@bg: black;\n@bg-light: boolean(luma(@bg) > 50%);\n\ndiv {\n background: @bg;\n color: if(@bg-light, black, white);\n}\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"Less \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"div {\n background: black;\n color: white;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"sassscss",children:["Sass/Scss",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#sassscss",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Scss/Sass \u5F00\u53D1\u6837\u5F0F\u3002"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u5185\u7F6E\u7684 Sass \u7248\u672C\u4E3A v1.54.4"}),"\n"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-scss",meta:'title="./src/common.sass"',children:"$font-stack: Helvetica, sans-serif;\n$primary-color: #333;\n\nbody {\n font: 100% $font-stack;\n color: $primary-color;\n}\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"Sass \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"body {\n font: 100% Helvetica, sans-serif;\n color: #333;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"tailwind-css",children:["Tailwind CSS",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u8BF7\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/best-practices/use-tailwindcss",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u6765\u4E86\u89E3\u76F8\u5173\u7528\u6CD5\u3002"]}),"\n",(0,r.jsxs)(s.h3,{id:"css-modules",children:["CSS Modules",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#css-modules",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 CSS Module \u5F00\u53D1\u6837\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u5C06\u4EE5\u4E0B\u6587\u4EF6\u8BC6\u522B\u4E3A CSS Module \u6587\u4EF6\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.css"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.less"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.scss"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.sass"})}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"\u5982\u679C\u9700\u8981\u5BF9 CSS Modules \u8FDB\u884C\u914D\u7F6E\uFF0C\u53EF\u4EE5\u67E5\u770B\u4EE5\u4E0B API\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/api/config/build-config#styleautomodules",children:"style.autoModules"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/api/config/build-config#stylemodules",children:"style.modules"})}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u4EE3\u7801\u793A\u4F8B\uFF1A"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import style from './index.module.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./src/index.module.css"',children:".btn {\n color: blue;\n}\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",children:["\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u6839\u636E\u7EC4\u4EF6\u9879\u76EE\u4F7F\u7528\u7684\u591A\u6570\u573A\u666F\uFF0C",(0,r.jsxs)(s.strong,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"npm-component"})," \u6784\u5EFA\u9884\u8BBE"]}),"\u3002\u8BE5\u9884\u8BBE\u5F97\u5230\u7684\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 dist\n\u2502 \u251C\u2500\u2500 es\n\u2502 \u251C\u2500\u2500 lib\n\u2502 \u2514\u2500\u2500 types\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/es"}),": \u5305\u542B\u4E86\u652F\u6301 es6 \u8BED\u6CD5\u7684 ES modules \u683C\u5F0F\u7684 bundleless \u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/lib"}),": \u5305\u542B\u4E86\u652F\u6301 es6 \u8BED\u6CD5\u7684 CommonJS \u683C\u5F0F\u7684 bundleless \u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/types"}),": \u5305\u542B\u4E86\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u5982\u679C\u5BF9\u4F7F\u7528\u8BED\u6CD5\u652F\u6301\u6709\u8981\u6C42\uFF0C\u53EF\u4EE5\u624B\u52A8\u914D\u7F6E ",(0,r.jsx)(s.a,{href:"/api/config/build-preset",children:(0,r.jsx)(s.code,{children:"buildPreset"})}),"\uFF0C\u5E76\u4E14\u652F\u6301\u5728 ",(0,r.jsx)(s.code,{children:"npm-component"})," \u57FA\u7840\u4E0A\u589E\u52A0\u540E\u7F00\u7684\u65B9\u5F0F\u4FEE\u6539\u652F\u6301\u7684\u8BED\u6CD5\uFF1A"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",children:"export default defineConfig({\n buildPreset: 'npm-component-es2019',\n});\n"})}),"\n",(0,r.jsxs)(s.p,{children:["\u5982\u679C\u5BF9\u6784\u5EFA\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u6709\u7279\u6B8A\u9700\u6C42\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528 ",(0,r.jsxs)(s.a,{href:"/api/config/build-config",children:[(0,r.jsx)(s.code,{children:"buildConfig"})," API"]}),"\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u4F7F\u7528\u65B9\u5F0F\uFF1A"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/guide/basic/modify-output-product#%E6%9E%84%E5%BB%BA%E9%85%8D%E7%BD%AE%E5%AF%B9%E8%B1%A1",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/guide/advance/in-depth-about-build",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n",(0,r.jsxs)(s.h2,{id:"\u53D1\u5E03\u7EC4\u4EF6",children:["\u53D1\u5E03\u7EC4\u4EF6",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53D1\u5E03\u7EC4\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u63A8\u8350\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u7248\u672C\u53D1\u5E03\u529F\u80FD\uFF0C\u53EF\u4EE5\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/basic/publish-your-project",children:"\u300C\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03\u300D"}),"\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,l.ah)(),e.components);return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}s.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Fbest-practices%2Fcomponents.mdx"]={toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2},{text:"CSS/PostCSS",id:"csspostcss",depth:3},{text:"Less",id:"less",depth:3},{text:"Sass/Scss",id:"sassscss",depth:3},{text:"Tailwind CSS",id:"tailwind-css",depth:3},{text:"CSS Modules",id:"css-modules",depth:3},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2}],title:"\u5F00\u53D1\u7EC4\u4EF6",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 3937.df16bfbb.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3937"],{54266:function(e,s,n){"use strict";n.r(s);var r=n("39980"),l=n("9580");function i(e){let s=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul",h3:"h3",blockquote:"blockquote",strong:"strong"},(0,l.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.h1,{id:"\u5F00\u53D1\u7EC4\u4EF6",children:["\u5F00\u53D1\u7EC4\u4EF6",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u7EC4\u4EF6",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u672C\u7AE0\u5C06\u8981\u4ECB\u7ECD\u5982\u4F55\u4F7F\u7528 Modern.js Module \u5F00\u53D1\u7EC4\u4EF6\u9879\u76EE\u3002"}),"\n",(0,r.jsxs)(s.h2,{id:"\u521D\u59CB\u5316\u9879\u76EE",children:["\u521D\u59CB\u5316\u9879\u76EE",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521D\u59CB\u5316\u9879\u76EE",children:"#"})]}),"\n",(0,r.jsxs)(s.ol,{children:["\n",(0,r.jsxs)(s.li,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"@modern-js/create"})," \u547D\u4EE4\u6765\u521D\u59CB\u5316\u4E00\u4E2A npm \u9879\u76EE\u3002"]}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-text",meta:'title="\u4EA4\u4E92\u5F0F\u95EE\u9898"',children:"npx @modern-js/create@latest components-project\n\n? \u8BF7\u9009\u62E9\u4F60\u60F3\u521B\u5EFA\u7684\u5DE5\u7A0B\u7C7B\u578B\uFF1ANpm \u6A21\u5757\n? \u8BF7\u586B\u5199\u9879\u76EE\u540D\u79F0\uFF1Acomponents-demo\n? \u8BF7\u9009\u62E9\u5F00\u53D1\u8BED\u8A00\uFF1ATS\n? \u8BF7\u9009\u62E9\u5305\u7BA1\u7406\u5DE5\u5177\uFF1Apnpm\n"})}),"\n",(0,r.jsxs)(s.ol,{start:"2",children:["\n",(0,r.jsx)(s.li,{children:"\u521D\u59CB\u5316\u7684\u76EE\u5F55\u7ED3\u6784\u5982\u4E0B\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 README.md\n\u251C\u2500\u2500 node_modules/\n\u251C\u2500\u2500 dist/\n\u251C\u2500\u2500 modern.config.ts\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pnpm-lock.yaml\n\u251C\u2500\u2500 src\n\u2502 \u251C\u2500\u2500 index.ts\n\u2502 \u2514\u2500\u2500 modern-app-env.d.ts\n\u2514\u2500\u2500 tsconfig.json\n"})}),"\n",(0,r.jsxs)(s.ol,{start:"3",children:["\n",(0,r.jsxs)(s.li,{children:["\u6700\u540E\u4FEE\u6539 ",(0,r.jsx)(s.code,{children:"./src/index.ts"})," \u6587\u4EF6\u540E\u7F00\u548C\u5185\u5BB9\u5982\u4E0B\uFF0C\u5C31\u5B8C\u6210\u4E86\u7EC4\u4EF6\u9879\u76EE\u7684\u521D\u59CB\u5316\u3002"]}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"export default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",children:["\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u8BF7\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/basic/using-storybook",children:"\u300C\u4F7F\u7528 Storybook\u300D"})," \u6765\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801\u3002"]}),"\n",(0,r.jsxs)(s.h2,{id:"\u5F00\u53D1\u6837\u5F0F",children:["\u5F00\u53D1\u6837\u5F0F",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6837\u5F0F",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u53EF\u4EE5\u7ED9\u7EC4\u4EF6\u6DFB\u52A0\u6837\u5F0F\u3002"}),"\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u652F\u6301\u5F00\u53D1\u6837\u5F0F\u7684\u80FD\u529B\u6709\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"CSS/PostCSS"}),"\n",(0,r.jsx)(s.li,{children:"Less"}),"\n",(0,r.jsx)(s.li,{children:"Scss/Sass"}),"\n",(0,r.jsx)(s.li,{children:"Tailwind CSS"}),"\n",(0,r.jsx)(s.li,{children:"CSS Modules"}),"\n"]}),"\n",(0,r.jsxs)(s.h3,{id:"csspostcss",children:["CSS/PostCSS",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#csspostcss",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301 PostCSS\uFF0C\u5E76\u4E14\u5185\u7F6E\u4E86\u4EE5\u4E0B PostCSS \u63D2\u4EF6\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/luisrudge/postcss-flexbugs-fixes",target:"_blank",rel:"noopener noreferrer",children:"flexbugs-fixes"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-custom-properties",target:"_blank",rel:"noopener noreferrer",children:"custom-properties"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/maximkoretskiy/postcss-initial",target:"_blank",rel:"noopener noreferrer",children:"initial"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/shrpne/postcss-page-break",target:"_blank",rel:"noopener noreferrer",children:"page-break"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-font-variant",target:"_blank",rel:"noopener noreferrer",children:"font-variant"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/postcss/postcss-media-minmax",target:"_blank",rel:"noopener noreferrer",children:"media-minmax"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",target:"_blank",rel:"noopener noreferrer",children:"nesting"})}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5728\u9879\u76EE\u4E2D\u521B\u5EFA ",(0,r.jsx)(s.code,{children:".css"})," \u6587\u4EF6\uFF0C\u5E76\u4E14\u53EF\u4EE5\u76F4\u63A5\u5728 css \u6587\u4EF6\u4E2D\u4F7F\u7528\u8FD9\u4E9B\u63D2\u4EF6\u63D0\u4F9B\u7684\u8BED\u6CD5\u652F\u6301\u548C\u80FD\u529B\u3002"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-less",meta:'title="./src/index.css"',children:'a,\nb {\n color: red;\n\n /* "&" comes first */\n & c,\n & d {\n color: white;\n }\n\n /* "&" comes later, requiring "@nest" */\n @nest e & {\n color: yellow;\n }\n}\n'})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"CSS \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:"a,\nb {\n color: red;\n}\na c,\nb c,\na d,\nb d {\n color: white;\n}\ne a,\ne b {\n color: yellow;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"less",children:["Less",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Less \u5F00\u53D1\u6837\u5F0F\u3002"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u5185\u7F6E\u7684 Less \u7248\u672C\u4E3A v4.1.3"}),"\n"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-less",meta:'title="./src/common.less"',children:"@bg: black;\n@bg-light: boolean(luma(@bg) > 50%);\n\ndiv {\n background: @bg;\n color: if(@bg-light, black, white);\n}\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"Less \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"div {\n background: black;\n color: white;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"sassscss",children:["Sass/Scss",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#sassscss",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Scss/Sass \u5F00\u53D1\u6837\u5F0F\u3002"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u76EE\u524D\u5185\u7F6E\u7684 Sass \u7248\u672C\u4E3A v1.54.4"}),"\n"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-scss",meta:'title="./src/common.sass"',children:"$font-stack: Helvetica, sans-serif;\n$primary-color: #333;\n\nbody {\n font: 100% $font-stack;\n color: $primary-color;\n}\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:"Sass \u4EA7\u7269\uFF1A"}),"\n"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"body {\n font: 100% Helvetica, sans-serif;\n color: #333;\n}\n"})}),"\n",(0,r.jsxs)(s.h3,{id:"tailwind-css",children:["Tailwind CSS",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u8BF7\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/best-practices/use-tailwindcss",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u6765\u4E86\u89E3\u76F8\u5173\u7528\u6CD5\u3002"]}),"\n",(0,r.jsxs)(s.h3,{id:"css-modules",children:["CSS Modules",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#css-modules",children:"#"})]}),"\n",(0,r.jsx)(s.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 CSS Module \u5F00\u53D1\u6837\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u5C06\u4EE5\u4E0B\u6587\u4EF6\u8BC6\u522B\u4E3A CSS Module \u6587\u4EF6\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.css"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.less"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.scss"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.code,{children:".module.sass"})}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"\u5982\u679C\u9700\u8981\u5BF9 CSS Modules \u8FDB\u884C\u914D\u7F6E\uFF0C\u53EF\u4EE5\u67E5\u770B\u4EE5\u4E0B API\uFF1A"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/api/config/build-config#styleautomodules",children:"style.autoModules"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/api/config/build-config#stylemodules",children:"style.modules"})}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u4EE3\u7801\u793A\u4F8B\uFF1A"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import style from './index.module.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-css",meta:'title="./src/index.module.css"',children:".btn {\n color: blue;\n}\n"})}),"\n",(0,r.jsxs)(s.h2,{id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",children:["\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u6839\u636E\u7EC4\u4EF6\u9879\u76EE\u4F7F\u7528\u7684\u591A\u6570\u573A\u666F\uFF0C",(0,r.jsxs)(s.strong,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,r.jsx)(s.code,{children:"npm-component"})," \u6784\u5EFA\u9884\u8BBE"]}),"\u3002\u8BE5\u9884\u8BBE\u5F97\u5230\u7684\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u4E3A\uFF1A"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 dist\n\u2502 \u251C\u2500\u2500 es\n\u2502 \u251C\u2500\u2500 lib\n\u2502 \u2514\u2500\u2500 types\n"})}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/es"}),": \u5305\u542B\u4E86\u652F\u6301 es6 \u8BED\u6CD5\u7684 ES modules \u683C\u5F0F\u7684 bundleless \u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/lib"}),": \u5305\u542B\u4E86\u652F\u6301 es6 \u8BED\u6CD5\u7684 CommonJS \u683C\u5F0F\u7684 bundleless \u4EA7\u7269\u3002"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"./dist/types"}),": \u5305\u542B\u4E86\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["\u5982\u679C\u5BF9\u4F7F\u7528\u8BED\u6CD5\u652F\u6301\u6709\u8981\u6C42\uFF0C\u53EF\u4EE5\u624B\u52A8\u914D\u7F6E ",(0,r.jsx)(s.a,{href:"/api/config/build-preset",children:(0,r.jsx)(s.code,{children:"buildPreset"})}),"\uFF0C\u5E76\u4E14\u652F\u6301\u5728 ",(0,r.jsx)(s.code,{children:"npm-component"})," \u57FA\u7840\u4E0A\u589E\u52A0\u540E\u7F00\u7684\u65B9\u5F0F\u4FEE\u6539\u652F\u6301\u7684\u8BED\u6CD5\uFF1A"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",children:"export default defineConfig({\n buildPreset: 'npm-component-es2019',\n});\n"})}),"\n",(0,r.jsxs)(s.p,{children:["\u5982\u679C\u5BF9\u6784\u5EFA\u4EA7\u7269\u76EE\u5F55\u7ED3\u6784\u6709\u7279\u6B8A\u9700\u6C42\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528 ",(0,r.jsxs)(s.a,{href:"/api/config/build-config",children:[(0,r.jsx)(s.code,{children:"buildConfig"})," API"]}),"\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u4F7F\u7528\u65B9\u5F0F\uFF1A"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/guide/basic/modify-output-product#%E6%9E%84%E5%BB%BA%E9%85%8D%E7%BD%AE%E5%AF%B9%E8%B1%A1",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,r.jsx)(s.li,{children:(0,r.jsx)(s.a,{href:"/guide/advance/in-depth-about-build",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n",(0,r.jsxs)(s.h2,{id:"\u53D1\u5E03\u7EC4\u4EF6",children:["\u53D1\u5E03\u7EC4\u4EF6",(0,r.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53D1\u5E03\u7EC4\u4EF6",children:"#"})]}),"\n",(0,r.jsxs)(s.p,{children:["\u63A8\u8350\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u7248\u672C\u53D1\u5E03\u529F\u80FD\uFF0C\u53EF\u4EE5\u53C2\u8003 ",(0,r.jsx)(s.a,{href:"/guide/basic/publish-your-project",children:"\u300C\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03\u300D"}),"\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,l.ah)(),e.components);return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}s.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Fbest-practices%2Fcomponents.mdx"]={toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2},{text:"CSS/PostCSS",id:"csspostcss",depth:3},{text:"Less",id:"less",depth:3},{text:"Sass/Scss",id:"sassscss",depth:3},{text:"Tailwind CSS",id:"tailwind-css",depth:3},{text:"CSS Modules",id:"css-modules",depth:3},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2}],title:"\u5F00\u53D1\u7EC4\u4EF6",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4053.30624338.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3937.df16bfbb.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4053.30624338.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3937.df16bfbb.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3637.128b81a4.js b/modern-js/module-tools/static/js/async/3969.12bd3b87.js similarity index 95% rename from modern-js/module-tools/static/js/async/3637.128b81a4.js rename to modern-js/module-tools/static/js/async/3969.12bd3b87.js index fb03eedd84..7e0e9bcbc6 100644 --- a/modern-js/module-tools/static/js/async/3637.128b81a4.js +++ b/modern-js/module-tools/static/js/async/3969.12bd3b87.js @@ -1,2 +1,2 @@ -/*! For license information please see 3637.128b81a4.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3637"],{74040:function(e,i,l){"use strict";l.r(i);var n=l("39980"),o=l("9580");function s(e){let i=Object.assign({h1:"h1",a:"a",h2:"h2",ul:"ul",li:"li",code:"code"},(0,o.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.h1,{id:"overview",children:["Overview",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,n.jsxs)(i.h2,{id:"official-plugins",children:["Official Plugins",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#official-plugins",children:"#"})]}),"\n",(0,n.jsxs)(i.ul,{children:["\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-import",children:"@modern-js/plugin-module-import"}),"\uFF1AUse SWC to provide the same ability as ",(0,n.jsx)(i.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,n.jsx)(i.code,{children:"babel-plugin-import"})}),"."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-banner",children:"@modern-js/plugin-module-banner"}),"\uFF1AAdd custom content, such as copyright information, to the top and bottom of each JS and CSS file."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-node-polyfill",children:"@modern-js/plugin-module-node-polyfill"}),"\uFF1A Inject Polyfills of Node core modules in the browser side."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-polyfill",children:"@modern-js/plugin-module-polyfill"}),"\uFF1AInject polyfill for unsupported features used in your code."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-babel",children:"@modern-js/plugin-module-babel"}),"\uFF1AUse Babel to transform your code."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-vue",children:"@modern-js/plugin-module-vue"}),"\uFF1ASupport for Vue component."]}),"\n"]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,o.ah)(),e.components);return i?(0,n.jsx)(i,{...e,children:(0,n.jsx)(s,{...e})}):s(e)}i.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Foverview.md"]={toc:[{text:"Official Plugins",id:"official-plugins",depth:2}],title:"Overview",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 3969.12bd3b87.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3969"],{68606:function(e,i,l){"use strict";l.r(i);var n=l("39980"),o=l("9580");function s(e){let i=Object.assign({h1:"h1",a:"a",h2:"h2",ul:"ul",li:"li",code:"code"},(0,o.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.h1,{id:"overview",children:["Overview",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,n.jsxs)(i.h2,{id:"official-plugins",children:["Official Plugins",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#official-plugins",children:"#"})]}),"\n",(0,n.jsxs)(i.ul,{children:["\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-import",children:"@modern-js/plugin-module-import"}),"\uFF1AUse SWC to provide the same ability as ",(0,n.jsx)(i.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,n.jsx)(i.code,{children:"babel-plugin-import"})}),"."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-banner",children:"@modern-js/plugin-module-banner"}),"\uFF1AAdd custom content, such as copyright information, to the top and bottom of each JS and CSS file."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-node-polyfill",children:"@modern-js/plugin-module-node-polyfill"}),"\uFF1A Inject Polyfills of Node core modules in the browser side."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-polyfill",children:"@modern-js/plugin-module-polyfill"}),"\uFF1AInject polyfill for unsupported features used in your code."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-babel",children:"@modern-js/plugin-module-babel"}),"\uFF1AUse Babel to transform your code."]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/en/plugins/official-list/plugin-vue",children:"@modern-js/plugin-module-vue"}),"\uFF1ASupport for Vue component."]}),"\n"]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,o.ah)(),e.components);return i?(0,n.jsx)(i,{...e,children:(0,n.jsx)(s,{...e})}):s(e)}i.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Foverview.md"]={toc:[{text:"Official Plugins",id:"official-plugins",depth:2}],title:"Overview",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4159.3e9cf225.js.LICENSE.txt b/modern-js/module-tools/static/js/async/3969.12bd3b87.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4159.3e9cf225.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/3969.12bd3b87.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4131.e7c23464.js b/modern-js/module-tools/static/js/async/4131.e7c23464.js new file mode 100644 index 0000000000..4e4e7776bd --- /dev/null +++ b/modern-js/module-tools/static/js/async/4131.e7c23464.js @@ -0,0 +1,2 @@ +/*! For license information please see 4131.e7c23464.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4131"],{9990:function(n,e,d){"use strict";d.r(e);var i=d("39980"),s=d("9580");function l(n){let e=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ol:"ol",li:"li",ul:"ul",pre:"pre"},(0,s.ah)(),n.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e.h1,{id:"\u6DF1\u5165\u7406\u89E3-dev-\u547D\u4EE4",children:["\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6DF1\u5165\u7406\u89E3-dev-\u547D\u4EE4",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:["Modern.js Module \u63D0\u4F9B\u7684 ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u4E3B\u8981\u7528\u4E8E\u4EE3\u7801\u7684\u8C03\u8BD5\u3002"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",children:["\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",children:"#"})]}),"\n",(0,i.jsxs)(e.ol,{children:["\n",(0,i.jsxs)(e.li,{children:["\u5F53\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0CModern.js Module \u5F00\u59CB\u5BFB\u627E\u662F\u5426\u5B58\u5728\u53EF\u4EE5\u6267\u884C\u7684\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u3002\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u5C31\u662F\u7C7B\u4F3C doc \u8FD9\u6837\u7684 Modern.js Module \u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\u3002"]}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u53D1\u73B0\u5B58\u5728\u4E00\u4E2A\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u4F1A\u7ACB\u5373\u6267\u884C\u5B83\u3002"}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u53D1\u73B0\u591A\u4E2A\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u663E\u793A\u8C03\u8BD5\u5DE5\u5177\u5217\u8868\u83DC\u5355\u3002\u53EF\u4EE5\u901A\u8FC7\u9009\u62E9\u67D0\u4E2A\u8C03\u8BD5\u5DE5\u5177\u5BF9\u5E94\u7684\u540D\u79F0\u9009\u9879\u542F\u52A8\u5B83\u3002"}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u6CA1\u6709\u53D1\u73B0\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u544A\u8BC9\u7528\u6237\u6CA1\u6709\u53EF\u7528\u7684\u8C03\u8BD5\u5DE5\u5177\u3002"}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:["\u6211\u4EEC\u9664\u4E86\u53EF\u4EE5\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u4EE5\u5916\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(e.code,{children:"dev [\u8C03\u8BD5\u5DE5\u5177\u540D\u79F0]"})," \u7684\u65B9\u5F0F\u6765\u76F4\u63A5\u542F\u52A8\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u3002"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u6269\u5C55-dev-\u547D\u4EE4",children:["\u6269\u5C55 dev \u547D\u4EE4",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6269\u5C55-dev-\u547D\u4EE4",children:"#"})]}),"\n",(0,i.jsx)(e.p,{children:"\u5982\u679C\u9700\u8981\u6269\u5C55 dev \u547D\u4EE4\u6216\u8005\u8BF4\u63D0\u4F9B\u81EA\u5DF1\u7684 Modern.js Module \u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5148\u4E86\u89E3\u4EE5\u4E0B\u5185\u5BB9\uFF1A"}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/plugins/guide/getting-started",children:"\u5F00\u53D1\u63D2\u4EF6"})}),"\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/plugin-api/plugin-hooks#%E8%B0%83%E8%AF%95%E9%92%A9%E5%AD%90",children:"\u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6 API"})}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:"\u4E00\u822C\u6765\u8BF4\uFF0C\u5B9E\u73B0\u4E00\u4E2A\u4EC0\u4E48\u90FD\u4E0D\u505A\u7684\u8C03\u8BD5\u5DE5\u5177\uFF0C\u5176\u5B9E\u73B0\u4EE3\u7801\u4EE5\u53CA\u76F8\u5173\u914D\u7F6E\u5982\u4E0B\uFF1A"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",meta:"do-nothing.ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'do-nothing',\n setup() {\n return {\n registerDev() {\n return {\n // \u8C03\u8BD5\u5DE5\u5177\u540D\u79F0\n name: 'do-nothing',\n // \u83DC\u5355\u663E\u793A\u5185\u5BB9\n menuItem: {\n name: 'DoNothing',\n value: 'do-nothing',\n },\n // \u5B9A\u4E49\u7684 dev \u5B50\u547D\u4EE4\n subCommands: ['donothing', 'dn'],\n async action() {\n // dev logic\n console.info('Run build --watch, and do nothing.');\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,i.jsx)(e.p,{children:"\u5982\u679C\u9700\u8981\u4F7F\u7528\u8BE5\u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\uFF0C\u5219\u9700\u8981\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u589E\u52A0\u5B83\uFF1A"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"import doNothingPlugin from './plugins/do-nothing';\n\nexport default defineConfig({\n plugins: [\n //..\n doNothingPlugin()\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u6B64\u65F6\u6211\u4EEC\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u6216\u8005 ",(0,i.jsx)(e.code,{children:"dev do-nothing"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C\u5B83\u4E86\u3002\u5728\u6267\u884C\u540E\uFF0C\u5B83\u4F1A\u5148\u6267\u884C\u76D1\u542C\u6A21\u5F0F\u7684\u6E90\u7801\u6784\u5EFA\u4EFB\u52A1\uFF0C\u5E76\u7D27\u63A5\u7740\u6253\u5370\u65E5\u5FD7\u4FE1\u606F\u3002"]}),"\n",(0,i.jsxs)(e.p,{children:["\u5BF9\u4E8E\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\u548C\u7B2C\u4E09\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\uFF0C\u53EF\u4EE5\u5728",(0,i.jsx)(e.a,{href:"/plugins/official-list/overview",children:"\u63D2\u4EF6\u5217\u8868"}),"\u4E2D\u67E5\u770B\u3002"]})]})}function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),n.components);return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(l,{...n})}):l(n)}e.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fin-depth-about-dev-command.md"]={toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2}],title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5185.b039a3f1.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4131.e7c23464.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5185.b039a3f1.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4131.e7c23464.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5055.7000603c.js b/modern-js/module-tools/static/js/async/4191.ec0c85d1.js similarity index 98% rename from modern-js/module-tools/static/js/async/5055.7000603c.js rename to modern-js/module-tools/static/js/async/4191.ec0c85d1.js index 612f6b0f2b..57cac600dc 100644 --- a/modern-js/module-tools/static/js/async/5055.7000603c.js +++ b/modern-js/module-tools/static/js/async/4191.ec0c85d1.js @@ -1,2 +1,2 @@ -/*! For license information please see 5055.7000603c.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5055"],{17754:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function c(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",h2:"h2",strong:"strong",code:"code",pre:"pre",blockquote:"blockquote"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",children:["\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u4E00\u4E2A npm \u7C7B\u578B\u7684\u6A21\u5757\u9879\u76EE\u53D1\u5E03\u6D41\u7A0B\u5305\u542B\u4E86\u4E24\u4E2A\u9636\u6BB5\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u7B2C\u4E00\u9636\u6BB5\u662F\u5728\u5F00\u53D1\u671F\u95F4\uFF0C\u5F00\u53D1\u8005\u9700\u8981\u63D0\u4F9B\u53D8\u66F4\u6587\u4EF6\uFF0C\u8BE5\u6587\u4EF6\u8BB0\u5F55\u4E86\u5728\u53D1\u5E03\u671F\u95F4\u9700\u8981\u7684\u53D8\u66F4\u5185\u5BB9\uFF1B"}),"\n",(0,s.jsxs)(n.li,{children:["\u7B2C\u4E8C\u9636\u6BB5\u662F\u5728\u53D1\u5E03\u671F\u95F4\uFF0C\u9700\u8981\u6536\u96C6\u6240\u6709\u7684\u53D8\u66F4\u6587\u4EF6\u6765\u66F4\u65B0\u7248\u672C\u3001\u66F4\u65B0\u53D1\u5E03\u65E5\u5FD7\uFF0C\u5E76\u53D1\u5E03\u65B0\u7684\u5305\u5230 ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"})," \u4E0A\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86\u4E00\u5957\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03\u7684\u65B9\u6848\uFF0C\u8FD9\u9002\u7528\u4E8E\u5355\u5305\u573A\u666F\u3002\u5BF9\u4E8E monorepo \u91CC\u7684 npm \u5305\u4F60\u9700\u8981\u9075\u5FAA\u5404\u7C7B monorepo \u89E3\u51B3\u65B9\u6848\u63D0\u4F9B\u7684\u7B56\u7565\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u8DDF\u8E2A\u53D8\u66F4",children:["\u8DDF\u8E2A\u53D8\u66F4",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8DDF\u8E2A\u53D8\u66F4",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"\u5F53\u9879\u76EE\u53D1\u751F\u53D8\u5316\u7684\u65F6\u5019\u9700\u8981\u5C06\u53D8\u5316\u7684\u5185\u5BB9\u8BB0\u5F55\u4E0B\u6765"}),"\u3002\u9879\u76EE\u53D1\u751F\u7684\u53D8\u5316\u4E00\u822C\u662F\u6307\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u65B0\u529F\u80FD"}),"\n",(0,s.jsx)(n.li,{children:"\u4FEE\u590D\u95EE\u9898"}),"\n",(0,s.jsx)(n.li,{children:"\u914D\u7F6E\u6587\u4EF6\u4FEE\u6539"}),"\n",(0,s.jsx)(n.li,{children:"..."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u8FD9\u4E9B\u4EFB\u52A1\u4E00\u65E6\u5F00\u53D1\u5B8C\u6210\u540E\uFF0C\u9700\u8981\u901A\u8FC7\u4EE5\u4E0B\u547D\u4EE4\u6765\u5BF9\u5F53\u524D\u7684\u53D8\u5316\u8FDB\u884C\u8BB0\u5F55\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-change",children:(0,s.jsx)(n.code,{children:"modern change"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern change"})," \u547D\u4EE4\u540E\u4F1A\u5411\u5F00\u53D1\u8005\u63D0\u51FA\u51E0\u4E2A\u95EE\u9898\uFF0C\u5E76\u6839\u636E\u5F00\u53D1\u8005\u7684\u56DE\u7B54\u751F\u6210\u53D8\u66F4\u8BB0\u5F55\u3002\u53D8\u66F4\u8BB0\u5F55\u6587\u4EF6\u5305\u542B\u4E86\u7248\u672C\u53D8\u5316\u7684\u7C7B\u578B\u548C\u5176\u63CF\u8FF0\uFF0C\u8BE5\u6587\u4EF6\u4F1A\u88AB\u63D0\u4EA4\u5230 git \u4ED3\u5E93\u4E2D\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern change\n\uD83E\uDD8B What kind of change is this for module-example? (current version is 0.1.0) \xb7 patch\n\uD83E\uDD8B Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor\n\uD83E\uDD8B Summary \xb7 publish test\n\uD83E\uDD8B === Releasing the following packages ===\n\uD83E\uDD8B [Patch]\n\uD83E\uDD8B module\n\uD83E\uDD8B Is this your desired changeset? (Y/n) \xb7 true\n\uD83E\uDD8B Changeset added! - you can now commit it\n\uD83E\uDD8B\n\uD83E\uDD8B If you want to modify or expand on the changeset summary, you can find it here\n\uD83E\uDD8B info /xxxxxx/module/.changeset/brave-dryers-agree.md\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6267\u884C\u6210\u529F\u540E\uFF0C\u751F\u6210\u7684\u5305\u542B\u53D8\u66F4\u8BB0\u5F55\u7684 Markdown \u6587\u4EF6\u4F1A\u4FDD\u5B58\u5728\u9879\u76EE\u7684 ",(0,s.jsx)(n.code,{children:".changeset"})," \u76EE\u5F55\u4E0B\u9762\u3002\u5176\u5185\u5BB9\u7C7B\u4F3C\u4E0B\u9762\u8FD9\u6837\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-markdown",meta:'title=".changeset/brave-dryers-agree.md"',children:"---\n'module-example': patch\n---\n\npublish test\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u7248\u672C\u66F4\u65B0",children:["\u7248\u672C\u66F4\u65B0",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7248\u672C\u66F4\u65B0",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u9700\u8981\u66F4\u65B0\u9879\u76EE\u7248\u672C\u7684\u65F6\u5019\uFF0C\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-bump",children:(0,s.jsx)(n.code,{children:"modern bump"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern bump"})," \u5C06\u4F1A\u57FA\u4E8E ",(0,s.jsx)(n.code,{children:".changeset/"})," \u76EE\u5F55\u4E0B\u8BB0\u5F55\u4E86\u53D8\u66F4\u7684 Markdown \u6587\u4EF6\u5185\u5BB9\u6765\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684\u7248\u672C\u53F7\uFF0C\u540C\u65F6\u751F\u6210 ",(0,s.jsx)(n.code,{children:"CHANGELOG.md"})," \u6587\u4EF6\u3002",(0,s.jsx)(n.strong,{children:"\u800C\u5F53\u7248\u672C\u66F4\u65B0\u5B8C\u6210\u540E\uFF0C\u8FD9\u4E9B\u8BB0\u5F55\u53D8\u66F4\u7684 Markdown \u6587\u4EF6\u4E5F\u4F1A\u88AB\u5220\u9664\uFF0C\u4E5F\u53EF\u8BF4\u8FD9\u4E9B Markdown \u6587\u4EF6\u88AB\u201C\u6D88\u8017\u201D\u6389\u4E86"}),"\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-markdown",meta:'title="CHANGELOG.md"',children:"# module\n\n## 0.1.1\n\n### Patch Changes\n\n- publish test\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u53D1\u5E03",children:["\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u53D1\u5E03\u9879\u76EE\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-release",children:(0,s.jsx)(n.code,{children:"modern release"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"modern release"})," \u547D\u4EE4\u53EF\u4EE5\u5C06\u9879\u76EE\u53D1\u5E03\u5230 npm Registry\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u53D1\u5E03\u7684\u662F ",(0,s.jsx)(n.code,{children:"latest"})," \u7248\u672C\uFF0C\u4E5F\u53EF\u4EE5\u8BF4\u662F\u6B63\u5F0F\u7248\u672C\u3002\u5982\u679C\u60F3\u8981\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"modern release --tag"})," \u547D\u4EE4\u6765\u6307\u5B9A\u3002\u4F8B\u5982\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"modern release --tag beta\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4F46\u662F\u5982\u679C\u5E0C\u671B\u5C06\u5F53\u524D\u9879\u76EE\u7684\u7248\u672C\u53F7\u4E5F\u4FEE\u6539\u4E3A\u9884\u53D1\u5E03\u7684\u7248\u672C\u53F7\uFF0C\u5219\u9700\u8981\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern pre"})," \u547D\u4EE4\u3002"]}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u6240\u8C13 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\uFF0C\u53EF\u4EE5\u7406\u89E3\uFF1A\u4E3A\u5F53\u524D\u53D1\u5E03\u7684\u7248\u672C\u6253\u6807\u7B7E\u3002\u4E00\u822C\u6765\u8BF4\uFF0C\u9ED8\u8BA4\u53D1\u5E03\u7684\u7248\u672C\u5BF9\u5E94\u7684 ",(0,s.jsx)(n.code,{children:"dist-tag"})," \u4E3A ",(0,s.jsx)(n.code,{children:"latest"}),"\uFF0C\u56E0\u6B64\u53EF\u4EE5\u628A ",(0,s.jsx)(n.code,{children:"latest"})," \u8BA4\u4E3A\u662F\u6B63\u5F0F\u7248\u672C\u7684 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u9884\u53D1\u5E03",children:["\u9884\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9884\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u9700\u8981\u5728\u6B63\u5F0F\u53D1\u5E03\u4E4B\u524D\u8FDB\u884C\u9884\u53D1\u5E03\uFF0C\u5219\u9700\u8981\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-pre",children:(0,s.jsx)(n.code,{children:"modern pre"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9996\u5148 ",(0,s.jsx)(n.code,{children:"modern pre enter "})," \u8FDB\u5165\u9884\u53D1\u5E03\u6A21\u5F0F\uFF0C",(0,s.jsx)(n.code,{children:""})," \u53EF\u4EE5\u4E0E\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern release --tag"})," \u547D\u4EE4\u6307\u5B9A\u7684 ",(0,s.jsx)(n.code,{children:"tag"})," \u4E00\u81F4\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern pre enter next\n\uD83E\uDD8B success Entered pre mode with tag next\n\uD83E\uDD8B info Run `changeset version` to version packages with prerelease versions\n\u2728 Done in 5.30s.\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u7740\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern bump"})," \u547D\u4EE4\u66F4\u65B0\u5177\u4F53\u7684\u7248\u672C\u53F7\uFF0C",(0,s.jsx)(n.strong,{children:"\u6B64\u65F6\u4E0D\u4F1A\u771F\u6B63\u7684\u201C\u6D88\u8017\u201D\u8BB0\u5F55\u53D8\u66F4\u7684 Markdown \u6587\u4EF6"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern bump\n\uD83E\uDD8B warn ===============================IMPORTANT!===============================\n\uD83E\uDD8B warn You are in prerelease mode\n\uD83E\uDD8B warn If you meant to do a normal release you should revert these changes and run `changeset pre exit`\n\uD83E\uDD8B warn You can then run `changeset version` again to do a normal release\n\uD83E\uDD8B warn ----------------------------------------------------------------------\n\uD83E\uDD8B All files have been updated. Review them and commit at your leisure\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u7136\u540E\u53EF\u4EE5\u770B\u5230 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u66F4\u65B0\u7684\u7248\u672C\u53F7\u4F1A\u7C7B\u4F3C\u8FD9\u6837\uFF1A",(0,s.jsx)(n.code,{children:"0.1.2-next.0"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6700\u540E\uFF0C",(0,s.jsxs)(n.strong,{children:["\u5982\u679C\u4E0D\u9700\u8981\u518D\u8FDB\u884C\u9884\u53D1\u5E03\uFF0C\u5219\u4E00\u5B9A\u8981\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern pre exit"})," \u547D\u4EE4"]}),"\uFF0C\u8FD9\u6837\u53EF\u4EE5\u9000\u51FA\u9884\u53D1\u5E03\u72B6\u6001\uFF0C\u5E76\u4E14\u5F53\u518D\u6B21\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern bump"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5C31\u53EF\u4EE5\u53D1\u5E03\u6B63\u5F0F\u7684\u7248\u672C\u3002"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fpublish-your-project.mdx"]={toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2}],title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file +/*! For license information please see 4191.ec0c85d1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4191"],{50894:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function c(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",h2:"h2",strong:"strong",code:"code",pre:"pre",blockquote:"blockquote"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",children:["\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u4E00\u4E2A npm \u7C7B\u578B\u7684\u6A21\u5757\u9879\u76EE\u53D1\u5E03\u6D41\u7A0B\u5305\u542B\u4E86\u4E24\u4E2A\u9636\u6BB5\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u7B2C\u4E00\u9636\u6BB5\u662F\u5728\u5F00\u53D1\u671F\u95F4\uFF0C\u5F00\u53D1\u8005\u9700\u8981\u63D0\u4F9B\u53D8\u66F4\u6587\u4EF6\uFF0C\u8BE5\u6587\u4EF6\u8BB0\u5F55\u4E86\u5728\u53D1\u5E03\u671F\u95F4\u9700\u8981\u7684\u53D8\u66F4\u5185\u5BB9\uFF1B"}),"\n",(0,s.jsxs)(n.li,{children:["\u7B2C\u4E8C\u9636\u6BB5\u662F\u5728\u53D1\u5E03\u671F\u95F4\uFF0C\u9700\u8981\u6536\u96C6\u6240\u6709\u7684\u53D8\u66F4\u6587\u4EF6\u6765\u66F4\u65B0\u7248\u672C\u3001\u66F4\u65B0\u53D1\u5E03\u65E5\u5FD7\uFF0C\u5E76\u53D1\u5E03\u65B0\u7684\u5305\u5230 ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"})," \u4E0A\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86\u4E00\u5957\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03\u7684\u65B9\u6848\uFF0C\u8FD9\u9002\u7528\u4E8E\u5355\u5305\u573A\u666F\u3002\u5BF9\u4E8E monorepo \u91CC\u7684 npm \u5305\u4F60\u9700\u8981\u9075\u5FAA\u5404\u7C7B monorepo \u89E3\u51B3\u65B9\u6848\u63D0\u4F9B\u7684\u7B56\u7565\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u8DDF\u8E2A\u53D8\u66F4",children:["\u8DDF\u8E2A\u53D8\u66F4",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8DDF\u8E2A\u53D8\u66F4",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"\u5F53\u9879\u76EE\u53D1\u751F\u53D8\u5316\u7684\u65F6\u5019\u9700\u8981\u5C06\u53D8\u5316\u7684\u5185\u5BB9\u8BB0\u5F55\u4E0B\u6765"}),"\u3002\u9879\u76EE\u53D1\u751F\u7684\u53D8\u5316\u4E00\u822C\u662F\u6307\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u65B0\u529F\u80FD"}),"\n",(0,s.jsx)(n.li,{children:"\u4FEE\u590D\u95EE\u9898"}),"\n",(0,s.jsx)(n.li,{children:"\u914D\u7F6E\u6587\u4EF6\u4FEE\u6539"}),"\n",(0,s.jsx)(n.li,{children:"..."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u8FD9\u4E9B\u4EFB\u52A1\u4E00\u65E6\u5F00\u53D1\u5B8C\u6210\u540E\uFF0C\u9700\u8981\u901A\u8FC7\u4EE5\u4E0B\u547D\u4EE4\u6765\u5BF9\u5F53\u524D\u7684\u53D8\u5316\u8FDB\u884C\u8BB0\u5F55\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-change",children:(0,s.jsx)(n.code,{children:"modern change"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern change"})," \u547D\u4EE4\u540E\u4F1A\u5411\u5F00\u53D1\u8005\u63D0\u51FA\u51E0\u4E2A\u95EE\u9898\uFF0C\u5E76\u6839\u636E\u5F00\u53D1\u8005\u7684\u56DE\u7B54\u751F\u6210\u53D8\u66F4\u8BB0\u5F55\u3002\u53D8\u66F4\u8BB0\u5F55\u6587\u4EF6\u5305\u542B\u4E86\u7248\u672C\u53D8\u5316\u7684\u7C7B\u578B\u548C\u5176\u63CF\u8FF0\uFF0C\u8BE5\u6587\u4EF6\u4F1A\u88AB\u63D0\u4EA4\u5230 git \u4ED3\u5E93\u4E2D\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern change\n\uD83E\uDD8B What kind of change is this for module-example? (current version is 0.1.0) \xb7 patch\n\uD83E\uDD8B Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor\n\uD83E\uDD8B Summary \xb7 publish test\n\uD83E\uDD8B === Releasing the following packages ===\n\uD83E\uDD8B [Patch]\n\uD83E\uDD8B module\n\uD83E\uDD8B Is this your desired changeset? (Y/n) \xb7 true\n\uD83E\uDD8B Changeset added! - you can now commit it\n\uD83E\uDD8B\n\uD83E\uDD8B If you want to modify or expand on the changeset summary, you can find it here\n\uD83E\uDD8B info /xxxxxx/module/.changeset/brave-dryers-agree.md\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6267\u884C\u6210\u529F\u540E\uFF0C\u751F\u6210\u7684\u5305\u542B\u53D8\u66F4\u8BB0\u5F55\u7684 Markdown \u6587\u4EF6\u4F1A\u4FDD\u5B58\u5728\u9879\u76EE\u7684 ",(0,s.jsx)(n.code,{children:".changeset"})," \u76EE\u5F55\u4E0B\u9762\u3002\u5176\u5185\u5BB9\u7C7B\u4F3C\u4E0B\u9762\u8FD9\u6837\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-markdown",meta:'title=".changeset/brave-dryers-agree.md"',children:"---\n'module-example': patch\n---\n\npublish test\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u7248\u672C\u66F4\u65B0",children:["\u7248\u672C\u66F4\u65B0",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7248\u672C\u66F4\u65B0",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u9700\u8981\u66F4\u65B0\u9879\u76EE\u7248\u672C\u7684\u65F6\u5019\uFF0C\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-bump",children:(0,s.jsx)(n.code,{children:"modern bump"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern bump"})," \u5C06\u4F1A\u57FA\u4E8E ",(0,s.jsx)(n.code,{children:".changeset/"})," \u76EE\u5F55\u4E0B\u8BB0\u5F55\u4E86\u53D8\u66F4\u7684 Markdown \u6587\u4EF6\u5185\u5BB9\u6765\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684\u7248\u672C\u53F7\uFF0C\u540C\u65F6\u751F\u6210 ",(0,s.jsx)(n.code,{children:"CHANGELOG.md"})," \u6587\u4EF6\u3002",(0,s.jsx)(n.strong,{children:"\u800C\u5F53\u7248\u672C\u66F4\u65B0\u5B8C\u6210\u540E\uFF0C\u8FD9\u4E9B\u8BB0\u5F55\u53D8\u66F4\u7684 Markdown \u6587\u4EF6\u4E5F\u4F1A\u88AB\u5220\u9664\uFF0C\u4E5F\u53EF\u8BF4\u8FD9\u4E9B Markdown \u6587\u4EF6\u88AB\u201C\u6D88\u8017\u201D\u6389\u4E86"}),"\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-markdown",meta:'title="CHANGELOG.md"',children:"# module\n\n## 0.1.1\n\n### Patch Changes\n\n- publish test\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u53D1\u5E03",children:["\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u53D1\u5E03\u9879\u76EE\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-release",children:(0,s.jsx)(n.code,{children:"modern release"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"modern release"})," \u547D\u4EE4\u53EF\u4EE5\u5C06\u9879\u76EE\u53D1\u5E03\u5230 npm Registry\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u53D1\u5E03\u7684\u662F ",(0,s.jsx)(n.code,{children:"latest"})," \u7248\u672C\uFF0C\u4E5F\u53EF\u4EE5\u8BF4\u662F\u6B63\u5F0F\u7248\u672C\u3002\u5982\u679C\u60F3\u8981\u4FEE\u6539 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"modern release --tag"})," \u547D\u4EE4\u6765\u6307\u5B9A\u3002\u4F8B\u5982\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"modern release --tag beta\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4F46\u662F\u5982\u679C\u5E0C\u671B\u5C06\u5F53\u524D\u9879\u76EE\u7684\u7248\u672C\u53F7\u4E5F\u4FEE\u6539\u4E3A\u9884\u53D1\u5E03\u7684\u7248\u672C\u53F7\uFF0C\u5219\u9700\u8981\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern pre"})," \u547D\u4EE4\u3002"]}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u6240\u8C13 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\uFF0C\u53EF\u4EE5\u7406\u89E3\uFF1A\u4E3A\u5F53\u524D\u53D1\u5E03\u7684\u7248\u672C\u6253\u6807\u7B7E\u3002\u4E00\u822C\u6765\u8BF4\uFF0C\u9ED8\u8BA4\u53D1\u5E03\u7684\u7248\u672C\u5BF9\u5E94\u7684 ",(0,s.jsx)(n.code,{children:"dist-tag"})," \u4E3A ",(0,s.jsx)(n.code,{children:"latest"}),"\uFF0C\u56E0\u6B64\u53EF\u4EE5\u628A ",(0,s.jsx)(n.code,{children:"latest"})," \u8BA4\u4E3A\u662F\u6B63\u5F0F\u7248\u672C\u7684 ",(0,s.jsx)(n.code,{children:"dist-tag"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u9884\u53D1\u5E03",children:["\u9884\u53D1\u5E03",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9884\u53D1\u5E03",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u9700\u8981\u5728\u6B63\u5F0F\u53D1\u5E03\u4E4B\u524D\u8FDB\u884C\u9884\u53D1\u5E03\uFF0C\u5219\u9700\u8981\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/guide/basic/command-preview#modern-pre",children:(0,s.jsx)(n.code,{children:"modern pre"})})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9996\u5148 ",(0,s.jsx)(n.code,{children:"modern pre enter "})," \u8FDB\u5165\u9884\u53D1\u5E03\u6A21\u5F0F\uFF0C",(0,s.jsx)(n.code,{children:""})," \u53EF\u4EE5\u4E0E\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern release --tag"})," \u547D\u4EE4\u6307\u5B9A\u7684 ",(0,s.jsx)(n.code,{children:"tag"})," \u4E00\u81F4\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern pre enter next\n\uD83E\uDD8B success Entered pre mode with tag next\n\uD83E\uDD8B info Run `changeset version` to version packages with prerelease versions\n\u2728 Done in 5.30s.\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u7740\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"modern bump"})," \u547D\u4EE4\u66F4\u65B0\u5177\u4F53\u7684\u7248\u672C\u53F7\uFF0C",(0,s.jsx)(n.strong,{children:"\u6B64\u65F6\u4E0D\u4F1A\u771F\u6B63\u7684\u201C\u6D88\u8017\u201D\u8BB0\u5F55\u53D8\u66F4\u7684 Markdown \u6587\u4EF6"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"$ npx modern bump\n\uD83E\uDD8B warn ===============================IMPORTANT!===============================\n\uD83E\uDD8B warn You are in prerelease mode\n\uD83E\uDD8B warn If you meant to do a normal release you should revert these changes and run `changeset pre exit`\n\uD83E\uDD8B warn You can then run `changeset version` again to do a normal release\n\uD83E\uDD8B warn ----------------------------------------------------------------------\n\uD83E\uDD8B All files have been updated. Review them and commit at your leisure\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u7136\u540E\u53EF\u4EE5\u770B\u5230 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u66F4\u65B0\u7684\u7248\u672C\u53F7\u4F1A\u7C7B\u4F3C\u8FD9\u6837\uFF1A",(0,s.jsx)(n.code,{children:"0.1.2-next.0"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6700\u540E\uFF0C",(0,s.jsxs)(n.strong,{children:["\u5982\u679C\u4E0D\u9700\u8981\u518D\u8FDB\u884C\u9884\u53D1\u5E03\uFF0C\u5219\u4E00\u5B9A\u8981\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern pre exit"})," \u547D\u4EE4"]}),"\uFF0C\u8FD9\u6837\u53EF\u4EE5\u9000\u51FA\u9884\u53D1\u5E03\u72B6\u6001\uFF0C\u5E76\u4E14\u5F53\u518D\u6B21\u6267\u884C ",(0,s.jsx)(n.code,{children:"modern bump"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5C31\u53EF\u4EE5\u53D1\u5E03\u6B63\u5F0F\u7684\u7248\u672C\u3002"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fpublish-your-project.mdx"]={toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2}],title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4273.fb3f085a.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4191.ec0c85d1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4273.fb3f085a.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4191.ec0c85d1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/7524.842b2e3f.js b/modern-js/module-tools/static/js/async/4306.aa23082a.js similarity index 98% rename from modern-js/module-tools/static/js/async/7524.842b2e3f.js rename to modern-js/module-tools/static/js/async/4306.aa23082a.js index af59c84971..efe06795e0 100644 --- a/modern-js/module-tools/static/js/async/7524.842b2e3f.js +++ b/modern-js/module-tools/static/js/async/4306.aa23082a.js @@ -1,2 +1,2 @@ -/*! For license information please see 7524.842b2e3f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7524"],{52637:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580"),r=s("23657");function o(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",h3:"h3",pre:"pre",code:"code",div:"div",blockquote:"blockquote",ul:"ul",li:"li"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"quick-start",children:["Quick Start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h2,{id:"3-minute-demo",children:["3 minute demo",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#3-minute-demo",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Want to experience Modern.js Module in action? The only prerequisite you need is ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"Node.js LTS"})," and make sure your Node version is ",(0,i.jsx)(n.strong,{children:">= 16.0.0"}),".We recommend using the LTS version of Node.js 18."]}),"\n",(0,i.jsxs)(n.h3,{id:"create-new-project",children:["Create new project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#create-new-project",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"If you want to create a complete Modern.js Module, you can execute the following command:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npx @modern-js/create your-project-dir-name\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Execute ",(0,i.jsx)(n.code,{children:"npx @modern-js/create -h"})," for more command line arguments\n"]})})]}),"\n",(0,i.jsx)(n.p,{children:"Next, in the issue interaction, follow the options below."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? Please select the type of project you want to create: Npm Module\n? Please fill in the project name: library\n? Please select the programming language: TS\n? Please select the package manager: pnpm\n"})}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["The project name is the value of the ",(0,i.jsx)(n.code,{children:'"name"'})," field in ",(0,i.jsx)(n.code,{children:"package.json"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Then the process of initializing the project will start. After the project directory and files are generated and the dependencies are installed, a complete module project is created."}),"\n",(0,i.jsxs)(n.p,{children:["We can start the project build directly with the ",(0,i.jsx)(n.code,{children:"pnpm build"})," command, and start the build in watching mode with the ",(0,i.jsx)(n.code,{children:"pnpm build --watch"})," command."]}),"\n",(0,i.jsxs)(n.h3,{id:"add-to-an-existing-project",children:["Add to an existing project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-to-an-existing-project",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"From your shell, install the following dependencies in your project."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"typescript"'})," (omitted if not a TypeScript project)"]}),"\n"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["If it's a TypeScript project, add the ",(0,i.jsx)(n.code,{children:'"typescript"'})," dependency."]}),"\n"]}),"\n","\n",(0,i.jsx)(r.SU,{command:"add @modern-js/module-tools typescript -D"}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["For projects that use pnpm or the Yarn package manager, just replace npm. ",(0,i.jsx)(n.strong,{children:"pnpm is recommended"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Next, create the ",(0,i.jsx)(n.code,{children:"modern.config.(t|j)s"})," file in the root of the project."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Finally, add the command ",(0,i.jsx)(n.code,{children:'"build": "modern build"'})," to the project's ",(0,i.jsx)(n.code,{children:"package.json"})," file."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "build": "modern build"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["If your project has a ",(0,i.jsx)(n.code,{children:"src/index.(js|jsx)"})," file or both ",(0,i.jsx)(n.code,{children:"src/index.(ts|tsx)"})," and ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," files, then congratulations you can run the ",(0,i.jsx)(n.code,{children:"npm run build"})," command directly to build your project with Modern.js Module."]}),"\n",(0,i.jsxs)(n.h3,{id:"core-npm-package",children:["Core npm Package",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#core-npm-package",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," is the core npm package of Modern.js Module, providing the following capabilities:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["It offers commonly used CLI commands such as ",(0,i.jsx)(n.code,{children:"modern dev"}),", ",(0,i.jsx)(n.code,{children:"modern build"}),", and more."]}),"\n",(0,i.jsx)(n.li,{children:"It integrates Modern.js Core, providing capabilities for configuration parsing, plugin loading, and more."}),"\n",(0,i.jsx)(n.li,{children:"It integrates esbuild and SWC, providing build capabilities."}),"\n",(0,i.jsxs)(n.li,{children:["It integrates some commonly used plugins, such as ",(0,i.jsx)(n.code,{children:"plugin-lint"}),", ",(0,i.jsx)(n.code,{children:"plugin-changeset"}),", and others."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," is implemented based on the plugin system of Modern.js. Essentially, it is a plugin. Therefore, you need to register ",(0,i.jsx)(n.code,{children:"moduleTools"})," in the ",(0,i.jsx)(n.code,{children:"plugins"})," field of the configuration file:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"view-official-example",children:["View official example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#view-official-example",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"If you want to see the complete project using the Modern.js Module, you can execute the following command"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/web-infra-dev/modern-js-examples\ncd modern-js-examples/examples/basic-module\n\n## Execute the build.\npnpm build\n\n## Execute the build in listening mode.\npnpm build --watch\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"lets-get-started",children:["Let's get started",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#lets-get-started",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Choose your tutorial scenario..."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["I'm a beginner and need to learn ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started",children:"basic usage"})," of Modern.js Module."]}),"\n",(0,i.jsxs)(n.li,{children:["I have learned the basic usage of Modern.js Module and can learn ",(0,i.jsx)(n.a,{href:"/en/guide/advance/in-depth-about-build",children:"advanced usage"})," of Modern.js Module."]}),"\n",(0,i.jsxs)(n.li,{children:["I need to expand my project capabilities and need to learn how to develop ",(0,i.jsx)(n.a,{href:"/en/plugins/guide/getting-started",children:"plugins"})," for Modern.js Module."]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fgetting-started.mdx"]={toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2},{text:"Create new project",id:"create-new-project",depth:3},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3},{text:"Core npm Package",id:"core-npm-package",depth:3},{text:"View official example",id:"view-official-example",depth:3},{text:"Let's get started",id:"lets-get-started",depth:2}],title:"Quick Start",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 4306.aa23082a.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4306"],{98041:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580"),r=s("23657");function o(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",h3:"h3",pre:"pre",code:"code",div:"div",blockquote:"blockquote",ul:"ul",li:"li"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"quick-start",children:["Quick Start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h2,{id:"3-minute-demo",children:["3 minute demo",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#3-minute-demo",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Want to experience Modern.js Module in action? The only prerequisite you need is ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"Node.js LTS"})," and make sure your Node version is ",(0,i.jsx)(n.strong,{children:">= 16.0.0"}),".We recommend using the LTS version of Node.js 18."]}),"\n",(0,i.jsxs)(n.h3,{id:"create-new-project",children:["Create new project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#create-new-project",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"If you want to create a complete Modern.js Module, you can execute the following command:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npx @modern-js/create your-project-dir-name\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Execute ",(0,i.jsx)(n.code,{children:"npx @modern-js/create -h"})," for more command line arguments\n"]})})]}),"\n",(0,i.jsx)(n.p,{children:"Next, in the issue interaction, follow the options below."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? Please select the type of project you want to create: Npm Module\n? Please fill in the project name: library\n? Please select the programming language: TS\n? Please select the package manager: pnpm\n"})}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["The project name is the value of the ",(0,i.jsx)(n.code,{children:'"name"'})," field in ",(0,i.jsx)(n.code,{children:"package.json"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Then the process of initializing the project will start. After the project directory and files are generated and the dependencies are installed, a complete module project is created."}),"\n",(0,i.jsxs)(n.p,{children:["We can start the project build directly with the ",(0,i.jsx)(n.code,{children:"pnpm build"})," command, and start the build in watching mode with the ",(0,i.jsx)(n.code,{children:"pnpm build --watch"})," command."]}),"\n",(0,i.jsxs)(n.h3,{id:"add-to-an-existing-project",children:["Add to an existing project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-to-an-existing-project",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"From your shell, install the following dependencies in your project."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"typescript"'})," (omitted if not a TypeScript project)"]}),"\n"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["If it's a TypeScript project, add the ",(0,i.jsx)(n.code,{children:'"typescript"'})," dependency."]}),"\n"]}),"\n","\n",(0,i.jsx)(r.SU,{command:"add @modern-js/module-tools typescript -D"}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["For projects that use pnpm or the Yarn package manager, just replace npm. ",(0,i.jsx)(n.strong,{children:"pnpm is recommended"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Next, create the ",(0,i.jsx)(n.code,{children:"modern.config.(t|j)s"})," file in the root of the project."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Finally, add the command ",(0,i.jsx)(n.code,{children:'"build": "modern build"'})," to the project's ",(0,i.jsx)(n.code,{children:"package.json"})," file."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "build": "modern build"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["If your project has a ",(0,i.jsx)(n.code,{children:"src/index.(js|jsx)"})," file or both ",(0,i.jsx)(n.code,{children:"src/index.(ts|tsx)"})," and ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," files, then congratulations you can run the ",(0,i.jsx)(n.code,{children:"npm run build"})," command directly to build your project with Modern.js Module."]}),"\n",(0,i.jsxs)(n.h3,{id:"core-npm-package",children:["Core npm Package",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#core-npm-package",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," is the core npm package of Modern.js Module, providing the following capabilities:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["It offers commonly used CLI commands such as ",(0,i.jsx)(n.code,{children:"modern dev"}),", ",(0,i.jsx)(n.code,{children:"modern build"}),", and more."]}),"\n",(0,i.jsx)(n.li,{children:"It integrates Modern.js Core, providing capabilities for configuration parsing, plugin loading, and more."}),"\n",(0,i.jsx)(n.li,{children:"It integrates esbuild and SWC, providing build capabilities."}),"\n",(0,i.jsxs)(n.li,{children:["It integrates some commonly used plugins, such as ",(0,i.jsx)(n.code,{children:"plugin-lint"}),", ",(0,i.jsx)(n.code,{children:"plugin-changeset"}),", and others."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," is implemented based on the plugin system of Modern.js. Essentially, it is a plugin. Therefore, you need to register ",(0,i.jsx)(n.code,{children:"moduleTools"})," in the ",(0,i.jsx)(n.code,{children:"plugins"})," field of the configuration file:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"view-official-example",children:["View official example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#view-official-example",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"If you want to see the complete project using the Modern.js Module, you can execute the following command"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/web-infra-dev/modern-js-examples\ncd modern-js-examples/examples/basic-module\n\n## Execute the build.\npnpm build\n\n## Execute the build in listening mode.\npnpm build --watch\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"lets-get-started",children:["Let's get started",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#lets-get-started",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Choose your tutorial scenario..."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["I'm a beginner and need to learn ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started",children:"basic usage"})," of Modern.js Module."]}),"\n",(0,i.jsxs)(n.li,{children:["I have learned the basic usage of Modern.js Module and can learn ",(0,i.jsx)(n.a,{href:"/en/guide/advance/in-depth-about-build",children:"advanced usage"})," of Modern.js Module."]}),"\n",(0,i.jsxs)(n.li,{children:["I need to expand my project capabilities and need to learn how to develop ",(0,i.jsx)(n.a,{href:"/en/plugins/guide/getting-started",children:"plugins"})," for Modern.js Module."]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fgetting-started.mdx"]={toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2},{text:"Create new project",id:"create-new-project",depth:3},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3},{text:"Core npm Package",id:"core-npm-package",depth:3},{text:"View official example",id:"view-official-example",depth:3},{text:"Let's get started",id:"lets-get-started",depth:2}],title:"Quick Start",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6917.5162bac3.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4306.aa23082a.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6917.5162bac3.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4306.aa23082a.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4327.89e5ba97.js b/modern-js/module-tools/static/js/async/4327.89e5ba97.js deleted file mode 100644 index 63a35eab16..0000000000 --- a/modern-js/module-tools/static/js/async/4327.89e5ba97.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 4327.89e5ba97.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4327"],{39511:function(n,e,r){"use strict";r.r(e);var i=r("39980"),o=r("9580");function d(n){let e=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",ul:"ul",li:"li",pre:"pre",blockquote:"blockquote",h3:"h3"},(0,o.ah)(),n.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e.h1,{id:"\u4F7F\u7528-copy-\u5DE5\u5177",children:["\u4F7F\u7528 Copy \u5DE5\u5177",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-copy-\u5DE5\u5177",children:"#"})]}),"\n",(0,i.jsx)(e.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86 Copy \u5DE5\u5177\u7528\u4E8E\u5C06\u5DF2\u7ECF\u5B58\u5728\u7684\u5355\u4E2A\u6587\u4EF6\u6216\u6574\u4E2A\u76EE\u5F55\u590D\u5236\u5230\u4EA7\u7269\u76EE\u5F55\u4E2D\u3002\u63A5\u4E0B\u6765\u6211\u4EEC\u5B66\u4E60\u5982\u4F55\u4F7F\u7528\u5B83\u3002"}),"\n",(0,i.jsxs)(e.h2,{id:"\u4E86\u89E3-copy-api",children:["\u4E86\u89E3 Copy API",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E86\u89E3-copy-api",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(e.a,{href:"/api/config/build-config#copy",children:(0,i.jsx)(e.code,{children:"buildConfig.copy"})})," API \u6765\u4F7F\u7528 Copy \u5DE5\u5177\uFF0C\u5B83\u5305\u542B\u4EE5\u4E0B\u4E24\u4E2A\u4E3B\u8981\u914D\u7F6E\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/config/build-config#copypatterns",children:(0,i.jsx)(e.code,{children:"patterns"})})}),"\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/config/build-config#copyoptions",children:(0,i.jsx)(e.code,{children:"options"})})}),"\n"]}),"\n",(0,i.jsxs)(e.h2,{id:"api-\u8BE6\u89E3",children:["API \u8BE6\u89E3",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#api-\u8BE6\u89E3",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"copy.patterns"})," \u7528\u4E8E\u5BFB\u627E\u590D\u5236\u7684\u6587\u4EF6\u4EE5\u53CA\u914D\u7F6E\u8F93\u51FA\u7684\u8DEF\u5F84\u3002"]}),"\n",(0,i.jsxs)(e.p,{children:["\u5176\u4E2D ",(0,i.jsx)(e.code,{children:"patterns.from"})," \u7528\u4E8E\u6307\u5B9A\u8981\u590D\u5236\u7684\u6587\u4EF6\u6216\u8005\u76EE\u5F55\u3002\u5B83\u63A5\u6536 Glob \u5F62\u5F0F\u5B57\u7B26\u4E32\u6216\u5177\u4F53\u8DEF\u5F84\u3002Glob \u5F62\u5F0F\u5B57\u7B26\u4E32\u662F\u6307 ",(0,i.jsx)(e.a,{href:"https://github.com/mrmlnc/fast-glob#pattern-syntax",target:"_blank",rel:"noopener noreferrer",children:"fast-glob pattern-syntax"}),"\u3002\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u4E24\u79CD\u65B9\u5F0F\u4F7F\u7528\u5B83\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './index.html', to: '' },\n { from: './*.html', to: '' },\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"patterns.context"})," \u4E00\u822C\u548C ",(0,i.jsx)(e.code,{children:"patterns.from"})," \u914D\u5408\u4F7F\u7528\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u5B83\u7684\u503C\u4E0E ",(0,i.jsx)(e.a,{href:"/api/config/build-config#sourcedir",children:(0,i.jsx)(e.code,{children:"buildConfig.sourceDir"})})," \u76F8\u540C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6307\u5B9A ",(0,i.jsx)(e.code,{children:"src/data.json"})," \u6587\u4EF6\u4E3A\u8981\u590D\u5236\u7684\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsxs)(e.p,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C",(0,i.jsx)(e.code,{children:"buildConfig.sourceDir"})," \u4E3A ",(0,i.jsx)(e.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './data.json' to: ''},\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u5F53\u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5728\u6E90\u7801\u76EE\u5F55\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4FEE\u6539 ",(0,i.jsx)(e.code,{children:"context"})," \u914D\u7F6E\u3002\u4F8B\u5982\u6307\u5B9A\u9879\u76EE\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(e.code,{children:"temp/index.html"})," \u4E3A\u8981\u590D\u5236\u7684\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"import path from 'path';\n\nexport default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n {\n from: './index.html',\n context: path.join(__dirname, './temp')\n to: '',\n }\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"patterns.to"})," \u7528\u4E8E\u6307\u5B9A\u590D\u5236\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u5B83\u7684\u503C\u4E3A ",(0,i.jsx)(e.a,{href:"/api/config/build-config#outdir",children:(0,i.jsx)(e.code,{children:"buildConfig.outDir"})}),"\u5BF9\u5E94\u7684\u503C\u3002\u56E0\u6B64\u6211\u4EEC\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u5C06 ",(0,i.jsx)(e.code,{children:"src/index.html"})," \u590D\u5236\u5230 ",(0,i.jsx)(e.code,{children:"dist"})," \u76EE\u5F55\u4E0B\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './index.html' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u5F53\u6211\u4EEC\u914D\u7F6E\u4E86 ",(0,i.jsx)(e.code,{children:"patterns.to"})," \u7684\u65F6\u5019\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["\u5982\u679C\u662F\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u5219\u8BE5\u8DEF\u5F84\u4F1A\u76F8\u5BF9\u4E8E ",(0,i.jsx)(e.code,{children:"buildConfig.outDir"})," \u8BA1\u7B97\u51FA\u590D\u5236\u6587\u4EF6\u8F93\u51FA\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002"]}),"\n",(0,i.jsx)(e.li,{children:"\u5982\u679C\u662F\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5219\u4F1A\u76F4\u63A5\u4F7F\u7528\u8BE5\u503C\u3002"}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:["\u6700\u540E ",(0,i.jsx)(e.code,{children:"patterns.globOptions"})," \u7528\u4E8E\u914D\u7F6E\u5BFB\u627E\u590D\u5236\u6587\u4EF6 ",(0,i.jsx)(e.a,{href:"https://github.com/sindresorhus/globby",target:"_blank",rel:"noopener noreferrer",children:"globby"})," \u5BF9\u8C61\uFF0C\u5176\u914D\u7F6E\u53EF\u53C2\u8003\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"https://github.com/sindresorhus/globby#options",target:"_blank",rel:"noopener noreferrer",children:"globby.options"})}),"\n"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",children:["\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",children:"#"})]}),"\n",(0,i.jsxs)(e.h3,{id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",children:["\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to file\n */\n {\n from: './temp-1/a.png',\n context: __dirname,\n to: './temp-1/b.png',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",children:["\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to dir\n */\n {\n from: './temp-2/a.png',\n context: __dirname,\n to: './temp-2',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",children:["\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to dir\n */\n {\n from: './temp-3/',\n to: './temp-3',\n context: __dirname,\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",children:["\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to file\n */\n {\n from: './temp-4/',\n context: __dirname,\n to: './temp-4/_index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4F7F\u7528-glob",children:["\u4F7F\u7528 Glob",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-glob",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy glob to dir\n */\n {\n from: './*.html',\n to: './temp-5',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n {\n copy: {\n patterns: [\n /**\n * copy glob to file\n */\n {\n from: './*.html',\n to: './temp-6/index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})})]})}function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,o.ah)(),n.components);return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(d,{...n})}):d(n)}e.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fcopy.md"]={toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3}],title:"\u4F7F\u7528 Copy \u5DE5\u5177",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/433.b3f966b6.js b/modern-js/module-tools/static/js/async/433.b3f966b6.js deleted file mode 100644 index 08067b1a68..0000000000 --- a/modern-js/module-tools/static/js/async/433.b3f966b6.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 433.b3f966b6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["433"],{72246:function(e,l,n){"use strict";n.r(l);var s=n("39980"),o=n("9580"),i=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.h1,{id:"polyfill-\u63D2\u4EF6",children:["Polyfill \u63D2\u4EF6",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#polyfill-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,s.jsx)(l.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(l.div,{className:"rspress-directive-content",children:[(0,s.jsx)(l.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u9700\u8981\u4E3A npm \u5305\u6CE8\u5165 polyfill\uFF0C\u8FD9\u4E00\u6B65\u5E94\u8BE5\u5728 Web \u5E94\u7528\u7684\u6846\u67B6\u4FA7\u5B8C\u6210\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u573A\u666F\uFF0C\u4E3A\u4E86\u8BA9\u6211\u4EEC\u7684\u5E93\u80FD\u591F\u76F4\u63A5\u8FD0\u884C\u5728\u4F4E\u7248\u672C\u6D4F\u89C8\u5668\u91CC\uFF0C\u6211\u4EEC\u9700\u8981\u6CE8\u5165 polyfill\u3002"}),"\n",(0,s.jsxs)(l.p,{children:["\u8BF7\u6CE8\u610F\uFF0C\u6B64\u63D2\u4EF6\u5E76\u4E0D\u4F1A\u8F6C\u5316\u4F60\u7684\u4EE3\u7801\u8BED\u6CD5\uFF0C\u53EA\u4F1A\u4E3A\u4F60\u7684\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u4E0D\u652F\u6301\u7684\u529F\u80FD\u6CE8\u5165 polyfill\uFF0C\u628A\u5B83\u4EEC\u4F5C\u4E3A\u666E\u901A\u51FD\u6570\u5BFC\u5165\u800C\u4E0D\u662F\u6C61\u67D3\u5168\u5C40\u3002\u4F60\u9700\u8981\u5B89\u88C5 ",(0,s.jsx)(l.code,{children:"core-js-pure"})," \u4F9D\u8D56"]}),"\n"]})]}),"\n",(0,s.jsxs)(l.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(l.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(i.SU,{command:"add @modern-js/plugin-module-polyfill -D"}),"\n",(0,s.jsxs)(l.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(l.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginPolyfill()],\n});\n"})}),"\n",(0,s.jsx)(l.p,{children:"\u4F60\u4E5F\u53EF\u4EE5\u901A\u8FC7 hooks \u914D\u7F6E\u6CE8\u518C\uFF0C\u4F8B\u5982\u4F60\u540C\u65F6\u5177\u6709\u591A\u4EFD\u6784\u5EFA\u914D\u7F6E\uFF0C\u5E76\u53EA\u9700\u8981\u5728 bundle \u6784\u5EFA\u65F6\u6CE8\u5165 polyfill\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getPolyfillHook } from '@modern-js/plugin-module-polyfill';\n\nconst polyfillHook = getPolyfillHook();\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n buildType: 'bundle',\n hooks: [polyfillHook],\n },\n {\n buildType: 'bundleless',\n },\n ],\n});\n"})}),"\n",(0,s.jsxs)(l.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(l.ul,{children:["\n",(0,s.jsx)(l.li,{children:(0,s.jsx)(l.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"type options = {\n targets?: Record | string;\n};\n"})}),"\n",(0,s.jsxs)(l.h3,{id:"targets",children:["targets",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#targets",children:"#"})]}),"\n",(0,s.jsxs)(l.p,{children:["\u53C2\u8003 ",(0,s.jsx)(l.a,{href:"https://babeljs.io/docs/options#targets",target:"_blank",rel:"noopener noreferrer",children:"Babel target"}),"."]}),"\n",(0,s.jsx)(l.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u4F8B\u5B50\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginPolyfill({\n targets: '> 0.25%, not dead',\n }),\n ],\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,o.ah)(),e.components);return l?(0,s.jsx)(l,{...e,children:(0,s.jsx)(r,{...e})}):r(e)}l.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-polyfill.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"targets",id:"targets",depth:3}],title:"Polyfill \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8200.2c9b573e.js b/modern-js/module-tools/static/js/async/4344.57789f12.js similarity index 79% rename from modern-js/module-tools/static/js/async/8200.2c9b573e.js rename to modern-js/module-tools/static/js/async/4344.57789f12.js index bd8a76d92c..dfe834012b 100644 --- a/modern-js/module-tools/static/js/async/8200.2c9b573e.js +++ b/modern-js/module-tools/static/js/async/4344.57789f12.js @@ -1,2 +1,2 @@ -/*! For license information please see 8200.2c9b573e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8200"],{82555:function(e,n,o){"use strict";o.r(n);var t=o("39980"),s=o("9580");function _(e){return(0,t.jsx)(t.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Frelease-module-doc.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 4344.57789f12.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4344"],{56795:function(e,n,o){"use strict";o.r(n);var t=o("39980"),s=o("9580");function _(e){return(0,t.jsx)(t.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Frelease-module-doc.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4327.89e5ba97.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4344.57789f12.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4327.89e5ba97.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4344.57789f12.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2454.1092ba62.js b/modern-js/module-tools/static/js/async/4523.5b0b69f9.js similarity index 99% rename from modern-js/module-tools/static/js/async/2454.1092ba62.js rename to modern-js/module-tools/static/js/async/4523.5b0b69f9.js index ba0689b783..114041697a 100644 --- a/modern-js/module-tools/static/js/async/2454.1092ba62.js +++ b/modern-js/module-tools/static/js/async/4523.5b0b69f9.js @@ -1,2 +1,2 @@ -/*! For license information please see 2454.1092ba62.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2454"],{24389:function(e,n,r){"use strict";r.r(n);var s=r("39980"),i=r("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",blockquote:"blockquote"},(0,i.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"plugin-hooks",children:["Plugin Hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-hooks",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"This chapter describes the lifecycle hooks supported by module-tools."}),"\n",(0,s.jsx)(n.p,{children:"Currently there are following main types of lifecycle hooks."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Config hooks: change user config."}),"\n",(0,s.jsxs)(n.li,{children:["Build hooks: triggered only when the ",(0,s.jsx)(n.code,{children:"build"})," command is executed to build the source code product."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"buildPlatform"})," hook: triggered only when the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed to generate other build artifacts."]}),"\n",(0,s.jsxs)(n.li,{children:["dev hooks: hooks that are triggered when running the ",(0,s.jsx)(n.code,{children:"dev"})," command."]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/hook.html",target:"_blank",rel:"noopener noreferrer",children:"Hook Model"})," is explained in detail here."]}),"\n",(0,s.jsxs)(n.h2,{id:"config-hooks",children:["Config hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"resolvemoduleuserconfig",children:[(0,s.jsx)(n.code,{children:"resolveModuleUserConfig"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemoduleuserconfig",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"chang user config."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n resolveModuleUserConfig(config: ModuleUserConfig): ModuleUserConfig {},\n };\n },\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"build-hooks",children:["build hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["The following Hooks are triggered in order when the ",(0,s.jsx)(n.code,{children:"build"})," command is executed."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuild"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuildTask"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuildTask"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuild"})}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuild",children:[(0,s.jsx)(n.code,{children:"beforeBuild"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuild",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the execution of the overall build process."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuild(options: Options): void {},\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Options = {\n options: { config: BaseBuildConfig[]; cliOptions: BuildCommandOptions };\n};\n\nexport interface BuildCommandOptions {\n config: string;\n clear?: boolean;\n dts?: boolean;\n platform?: boolean | string[];\n tsconfig: string;\n watch?: boolean;\n}\n"})}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"BuildConfig"})," type reference ",(0,s.jsx)(n.a,{href:"/en/api/",children:"API configuration"})]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuildtask",children:[(0,s.jsx)(n.code,{children:"beforeBuildTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Based on the build configuration, Modern.js Module will split the overall build into multiple sub-build tasks. The Hook will be triggered before each build subtask."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildTask(config: BaseBuildConfig): BaseBuildConfig {\n return config;\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"BaseBuildConfig"})," type reference ",(0,s.jsx)(n.a,{href:"/en/api/",children:"API configuration"})]}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuildtask",children:[(0,s.jsx)(n.code,{children:"afterBuildTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered after the end of each build subtask."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildTask(options: BuildTaskResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildTaskResult {\n status: 'success' | 'fail';\n message?: string;\n config: BaseBuildConfig;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuild",children:[(0,s.jsx)(n.code,{children:"afterBuild"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuild",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered after the end of the overall build process."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuild(options: BuildResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildResult {\n status: 'success' | 'fail';\n message?: string;\n config: BuildConfig;\n commandOptions: BuildCommandOptions;\n totalDuration: number;\n}\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"buildplatform-hooks",children:["buildPlatform hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["module-tools also provides the ",(0,s.jsx)(n.code,{children:"build --platform"})," command to perform specific build tasks."]}),"\n",(0,s.jsxs)(n.p,{children:["For example, after installing the Module Doc plugin, you can run ",(0,s.jsx)(n.code,{children:"build --platform"})," or ",(0,s.jsx)(n.code,{children:"build --platform doc"})," to perform Doc build tasks."]}),"\n",(0,s.jsxs)(n.p,{children:["Hooks are triggered in the following order after executing ",(0,s.jsx)(n.code,{children:"build --platform"}),"."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"registerBuildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"buildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuildPlatform"})}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"registerbuildplatform",children:[(0,s.jsx)(n.code,{children:"registerBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerbuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["Gets information about the tasks that need to be run when executing the ",(0,s.jsx)(n.code,{children:"build --platform"})," command."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerBuildPlatform(): RegisterBuildPlatformResult {\n // ...\n return {\n platform: 'doc',\n build() {\n // logic\n },\n }, };\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // the currently running platform build task\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuildplatform",children:[(0,s.jsx)(n.code,{children:"beforeBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["Triggers all registered build tasks when the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed. ",(0,s.jsx)(n.code,{children:"beforeBuildPlatform"})," will be triggered before the execution of the overall build task."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildPlatform(platforms: RegisterBuildPlatformResult[]): void {\n console.info(`have ${platforms.length} platform tasks`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // the currently running platform build task\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"buildplatform",children:[(0,s.jsx)(n.code,{children:"buildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["When the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed, all registered build tasks will be triggered. ",(0,s.jsx)(n.code,{children:"buildPlatform"})," will be triggered before each build task is executed."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n buildPlatform({ platform }: Options): void {\n console.info(`current task is ${platform}`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface Options {\n platform: string;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuildplatform",children:[(0,s.jsx)(n.code,{children:"afterBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["When the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed, all registered build tasks will be triggered. ",(0,s.jsx)(n.code,{children:"afterBuildPlatform"})," will be triggered after the overall platform build task is finished."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildPlatform(result: BuildPlatformResult): void {\n if (result.status === 'success') {\n console.info(`all platform build task success`);\n } else {\n console.error(result.message);\n }\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildPlatformResult {\n status: 'success' | 'fail';\n message: string | Error | null;\n}\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"dev-hooks",children:["Dev Hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["The following Hooks are triggered in order when the ",(0,s.jsx)(n.code,{children:"dev"})," command is executed."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"registerDev"}),": triggered when getting dev function information."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDev"}),": Triggered before starting the dev process as a whole."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDevMenu"}),": triggered before the dev list/menu appears."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"afterDevMenu"}),": triggered after dev list/menu option is selected."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDevTask"}),": Triggered before executing the dev task."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"afterDev"}),": Triggered at the end of the overall dev process."]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"registerdev",children:[(0,s.jsx)(n.code,{children:"registerDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerdev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Register dev tool related data. Mainly contains."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"the name of the dev tool"}),"\n",(0,s.jsx)(n.li,{children:"The name of the item displayed in the menu list and the corresponding value."}),"\n",(0,s.jsxs)(n.li,{children:["The definition of the ",(0,s.jsx)(n.code,{children:"dev"})," subcommand."]}),"\n",(0,s.jsx)(n.li,{children:"Whether to execute the source code build before running the dev task"}),"\n",(0,s.jsx)(n.li,{children:"The function to execute the dev task."}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerDev() {\n return {\n // Dev tool name\n name: 'storybook',\n // Menu content\n menuItem: {\n name: 'Storybook',\n value: 'storybook',\n },\n // Defined dev subcommands\n subCommands: ['storybook', 'story'],\n async action() {\n // dev logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforedev",children:[(0,s.jsx)(n.code,{children:"beforeDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the dev task is executed after all dev tool metadata has been collected."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDev(metas: DevToolData[]) {\n console.info(`have ${metas.length} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforeafterdevmenu",children:[(0,s.jsx)(n.code,{children:"(before|after)DevMenu"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforeafterdevmenu",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"beforeDevMenu"})," is triggered before the dev list/menu appears. Receives ",(0,s.jsx)(n.a,{href:"https://github.com/SBoudrias/Inquirer.js#question",target:"_blank",rel:"noopener noreferrer",children:"inquirer question"})," as argument. Default value is."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"const question = [\n {\n name: 'choiceDevTool',\n message: 'Select dev tool',\n type: 'list',\n // Registered dev messages\n choices,\n },\n];\n"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"afterDevMenu"})," Triggered after selecting dev list/menu options."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevMenu(questions) {\n questions[0].message += '!';\n return questions; // required\n },\n afterDevMenu(options: Options) {\n console.info(`choise ${options.result.choiceDevTool} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export type { QuestionCollection } from 'inquirer';\n\nexport interface Options {\n result: PromptResult;\n devTools: DevToolData[];\n}\n\nexport type PromptResult = { choiceDevTool: string };\nexport interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforedevtask",children:[(0,s.jsx)(n.code,{children:"beforeDevTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedevtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the dev task is executed."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevTask(currentDevData: DevToolData) {\n console.info(`${currentDevData.name} running`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterdev",children:[(0,s.jsx)(n.code,{children:"afterDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterdev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered when the dev task process is interrupted."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterDev() {\n console.info(`exit!`);\n },\n };\n },\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fapi%2Fplugin-api%2Fplugin-hooks.md"]={toc:[{text:"Config hooks",id:"config-hooks",depth:2},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3},{text:"build hooks",id:"build-hooks",depth:2},{text:"`beforeBuild`",id:"beforebuild",depth:3},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3},{text:"`afterBuild`",id:"afterbuild",depth:3},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3},{text:"`buildPlatform`",id:"buildplatform",depth:3},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3},{text:"Dev Hooks",id:"dev-hooks",depth:2},{text:"`registerDev`",id:"registerdev",depth:3},{text:"`beforeDev`",id:"beforedev",depth:3},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3},{text:"`beforeDevTask`",id:"beforedevtask",depth:3},{text:"`afterDev`",id:"afterdev",depth:3}],title:"Plugin Hooks",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 4523.5b0b69f9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4523"],{10712:function(e,n,r){"use strict";r.r(n);var s=r("39980"),i=r("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",blockquote:"blockquote"},(0,i.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"plugin-hooks",children:["Plugin Hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-hooks",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"This chapter describes the lifecycle hooks supported by module-tools."}),"\n",(0,s.jsx)(n.p,{children:"Currently there are following main types of lifecycle hooks."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Config hooks: change user config."}),"\n",(0,s.jsxs)(n.li,{children:["Build hooks: triggered only when the ",(0,s.jsx)(n.code,{children:"build"})," command is executed to build the source code product."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"buildPlatform"})," hook: triggered only when the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed to generate other build artifacts."]}),"\n",(0,s.jsxs)(n.li,{children:["dev hooks: hooks that are triggered when running the ",(0,s.jsx)(n.code,{children:"dev"})," command."]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/hook.html",target:"_blank",rel:"noopener noreferrer",children:"Hook Model"})," is explained in detail here."]}),"\n",(0,s.jsxs)(n.h2,{id:"config-hooks",children:["Config hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"resolvemoduleuserconfig",children:[(0,s.jsx)(n.code,{children:"resolveModuleUserConfig"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemoduleuserconfig",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"chang user config."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n resolveModuleUserConfig(config: ModuleUserConfig): ModuleUserConfig {},\n };\n },\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"build-hooks",children:["build hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["The following Hooks are triggered in order when the ",(0,s.jsx)(n.code,{children:"build"})," command is executed."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuild"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuildTask"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuildTask"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuild"})}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuild",children:[(0,s.jsx)(n.code,{children:"beforeBuild"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuild",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the execution of the overall build process."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuild(options: Options): void {},\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Options = {\n options: { config: BaseBuildConfig[]; cliOptions: BuildCommandOptions };\n};\n\nexport interface BuildCommandOptions {\n config: string;\n clear?: boolean;\n dts?: boolean;\n platform?: boolean | string[];\n tsconfig: string;\n watch?: boolean;\n}\n"})}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"BuildConfig"})," type reference ",(0,s.jsx)(n.a,{href:"/en/api/",children:"API configuration"})]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuildtask",children:[(0,s.jsx)(n.code,{children:"beforeBuildTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Based on the build configuration, Modern.js Module will split the overall build into multiple sub-build tasks. The Hook will be triggered before each build subtask."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildTask(config: BaseBuildConfig): BaseBuildConfig {\n return config;\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"BaseBuildConfig"})," type reference ",(0,s.jsx)(n.a,{href:"/en/api/",children:"API configuration"})]}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuildtask",children:[(0,s.jsx)(n.code,{children:"afterBuildTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered after the end of each build subtask."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildTask(options: BuildTaskResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildTaskResult {\n status: 'success' | 'fail';\n message?: string;\n config: BaseBuildConfig;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuild",children:[(0,s.jsx)(n.code,{children:"afterBuild"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuild",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered after the end of the overall build process."}),"\n",(0,s.jsxs)(n.p,{children:["type: ",(0,s.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuild(options: BuildResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Parameters and return value types."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildResult {\n status: 'success' | 'fail';\n message?: string;\n config: BuildConfig;\n commandOptions: BuildCommandOptions;\n totalDuration: number;\n}\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"buildplatform-hooks",children:["buildPlatform hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["module-tools also provides the ",(0,s.jsx)(n.code,{children:"build --platform"})," command to perform specific build tasks."]}),"\n",(0,s.jsxs)(n.p,{children:["For example, after installing the Module Doc plugin, you can run ",(0,s.jsx)(n.code,{children:"build --platform"})," or ",(0,s.jsx)(n.code,{children:"build --platform doc"})," to perform Doc build tasks."]}),"\n",(0,s.jsxs)(n.p,{children:["Hooks are triggered in the following order after executing ",(0,s.jsx)(n.code,{children:"build --platform"}),"."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"registerBuildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"beforeBuildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"buildPlatform"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"afterBuildPlatform"})}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"registerbuildplatform",children:[(0,s.jsx)(n.code,{children:"registerBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerbuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["Gets information about the tasks that need to be run when executing the ",(0,s.jsx)(n.code,{children:"build --platform"})," command."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerBuildPlatform(): RegisterBuildPlatformResult {\n // ...\n return {\n platform: 'doc',\n build() {\n // logic\n },\n }, };\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // the currently running platform build task\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforebuildplatform",children:[(0,s.jsx)(n.code,{children:"beforeBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["Triggers all registered build tasks when the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed. ",(0,s.jsx)(n.code,{children:"beforeBuildPlatform"})," will be triggered before the execution of the overall build task."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildPlatform(platforms: RegisterBuildPlatformResult[]): void {\n console.info(`have ${platforms.length} platform tasks`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // the currently running platform build task\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"buildplatform",children:[(0,s.jsx)(n.code,{children:"buildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["When the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed, all registered build tasks will be triggered. ",(0,s.jsx)(n.code,{children:"buildPlatform"})," will be triggered before each build task is executed."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n buildPlatform({ platform }: Options): void {\n console.info(`current task is ${platform}`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface Options {\n platform: string;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterbuildplatform",children:[(0,s.jsx)(n.code,{children:"afterBuildPlatform"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildplatform",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["When the ",(0,s.jsx)(n.code,{children:"build --platform"})," command is executed, all registered build tasks will be triggered. ",(0,s.jsx)(n.code,{children:"afterBuildPlatform"})," will be triggered after the overall platform build task is finished."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildPlatform(result: BuildPlatformResult): void {\n if (result.status === 'success') {\n console.info(`all platform build task success`);\n } else {\n console.error(result.message);\n }\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface BuildPlatformResult {\n status: 'success' | 'fail';\n message: string | Error | null;\n}\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"dev-hooks",children:["Dev Hooks",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev-hooks",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["The following Hooks are triggered in order when the ",(0,s.jsx)(n.code,{children:"dev"})," command is executed."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"registerDev"}),": triggered when getting dev function information."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDev"}),": Triggered before starting the dev process as a whole."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDevMenu"}),": triggered before the dev list/menu appears."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"afterDevMenu"}),": triggered after dev list/menu option is selected."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"beforeDevTask"}),": Triggered before executing the dev task."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"afterDev"}),": Triggered at the end of the overall dev process."]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"registerdev",children:[(0,s.jsx)(n.code,{children:"registerDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerdev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Register dev tool related data. Mainly contains."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"the name of the dev tool"}),"\n",(0,s.jsx)(n.li,{children:"The name of the item displayed in the menu list and the corresponding value."}),"\n",(0,s.jsxs)(n.li,{children:["The definition of the ",(0,s.jsx)(n.code,{children:"dev"})," subcommand."]}),"\n",(0,s.jsx)(n.li,{children:"Whether to execute the source code build before running the dev task"}),"\n",(0,s.jsx)(n.li,{children:"The function to execute the dev task."}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerDev() {\n return {\n // Dev tool name\n name: 'storybook',\n // Menu content\n menuItem: {\n name: 'Storybook',\n value: 'storybook',\n },\n // Defined dev subcommands\n subCommands: ['storybook', 'story'],\n async action() {\n // dev logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforedev",children:[(0,s.jsx)(n.code,{children:"beforeDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the dev task is executed after all dev tool metadata has been collected."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDev(metas: DevToolData[]) {\n console.info(`have ${metas.length} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforeafterdevmenu",children:[(0,s.jsx)(n.code,{children:"(before|after)DevMenu"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforeafterdevmenu",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"beforeDevMenu"})," is triggered before the dev list/menu appears. Receives ",(0,s.jsx)(n.a,{href:"https://github.com/SBoudrias/Inquirer.js#question",target:"_blank",rel:"noopener noreferrer",children:"inquirer question"})," as argument. Default value is."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"const question = [\n {\n name: 'choiceDevTool',\n message: 'Select dev tool',\n type: 'list',\n // Registered dev messages\n choices,\n },\n];\n"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"afterDevMenu"})," Triggered after selecting dev list/menu options."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevMenu(questions) {\n questions[0].message += '!';\n return questions; // required\n },\n afterDevMenu(options: Options) {\n console.info(`choise ${options.result.choiceDevTool} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export type { QuestionCollection } from 'inquirer';\n\nexport interface Options {\n result: PromptResult;\n devTools: DevToolData[];\n}\n\nexport type PromptResult = { choiceDevTool: string };\nexport interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"beforedevtask",children:[(0,s.jsx)(n.code,{children:"beforeDevTask"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedevtask",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered before the dev task is executed."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevTask(currentDevData: DevToolData) {\n console.info(`${currentDevData.name} running`);\n },\n };\n },\n});\n"})}),"\n",(0,s.jsx)(n.p,{children:"Types of parameters entered and returned."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"afterdev",children:[(0,s.jsx)(n.code,{children:"afterDev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterdev",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"Triggered when the dev task process is interrupted."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterDev() {\n console.info(`exit!`);\n },\n };\n },\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fapi%2Fplugin-api%2Fplugin-hooks.md"]={toc:[{text:"Config hooks",id:"config-hooks",depth:2},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3},{text:"build hooks",id:"build-hooks",depth:2},{text:"`beforeBuild`",id:"beforebuild",depth:3},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3},{text:"`afterBuild`",id:"afterbuild",depth:3},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3},{text:"`buildPlatform`",id:"buildplatform",depth:3},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3},{text:"Dev Hooks",id:"dev-hooks",depth:2},{text:"`registerDev`",id:"registerdev",depth:3},{text:"`beforeDev`",id:"beforedev",depth:3},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3},{text:"`beforeDevTask`",id:"beforedevtask",depth:3},{text:"`afterDev`",id:"afterdev",depth:3}],title:"Plugin Hooks",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/638.36ecfdbd.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4523.5b0b69f9.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/638.36ecfdbd.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4523.5b0b69f9.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4575.0ddcba6d.js b/modern-js/module-tools/static/js/async/4575.0ddcba6d.js new file mode 100644 index 0000000000..70e823eb80 --- /dev/null +++ b/modern-js/module-tools/static/js/async/4575.0ddcba6d.js @@ -0,0 +1,2 @@ +/*! For license information please see 4575.0ddcba6d.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4575"],{95466:function(e,n,r){"use strict";r.r(n);var l=r("39980"),s=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",blockquote:"blockquote"},(0,s.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"plugin-hooks",children:["Plugin Hooks",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-hooks",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u5173\u4E8E Modern.js Module \u652F\u6301\u7684\u751F\u547D\u5468\u671F\u94A9\u5B50\u3002"}),"\n",(0,l.jsx)(n.p,{children:"\u76EE\u524D\u4E3B\u8981\u5305\u542B\u4EE5\u4E0B\u51E0\u7C7B\u751F\u547D\u5468\u671F\u94A9\u5B50\uFF1A"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"\u914D\u7F6E\u94A9\u5B50\uFF1A\u7528\u4E8E\u5904\u7406\u7528\u6237\u914D\u7F6E\u3002"}),"\n",(0,l.jsxs)(n.li,{children:["\u6784\u5EFA\u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u6784\u5EFA\u6E90\u7801\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"buildPlatform"})," \u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u751F\u6210\u5176\u4ED6\u6784\u5EFA\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u8C03\u8BD5\u94A9\u5B50\uFF1A\u8FD0\u884C ",(0,l.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u65F6\u4F1A\u89E6\u53D1\u7684\u94A9\u5B50\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8FD9\u91CC\u8BE6\u7EC6\u89E3\u91CA\u4E86 ",(0,l.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/hook.html",target:"_blank",rel:"noopener noreferrer",children:"Hook \u6A21\u578B"})]}),"\n",(0,l.jsxs)(n.h2,{id:"\u914D\u7F6E\u94A9\u5B50",children:["\u914D\u7F6E\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"resolvemoduleuserconfig",children:[(0,l.jsx)(n.code,{children:"resolveModuleUserConfig"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemoduleuserconfig",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u7528\u4E8E\u4FEE\u6539\u7528\u6237\u914D\u7F6E\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n resolveModuleUserConfig(config: ModuleUserConfig): ModuleUserConfig {},\n };\n },\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u6784\u5EFA\u94A9\u5B50",children:["\u6784\u5EFA\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u6309\u7167\u987A\u5E8F\u89E6\u53D1\u4EE5\u4E0B Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuild"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuildTask"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuildTask"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuild"})}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuild",children:[(0,l.jsx)(n.code,{children:"beforeBuild"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuild",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6267\u884C\u6574\u4F53\u6784\u5EFA\u6D41\u7A0B\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuild(options: Options): void {},\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"type Options = {\n options: { config: BaseBuildConfig[]; cliOptions: BuildCommandOptions };\n};\n\nexport interface BuildCommandOptions {\n config: string;\n clear?: boolean;\n dts?: boolean;\n platform?: boolean | string[];\n tsconfig: string;\n watch?: boolean;\n}\n"})}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"BuildConfig"})," \u7C7B\u578B\u53C2\u8003 ",(0,l.jsx)(n.a,{href:"/api/",children:"API \u914D\u7F6E"})]}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuildtask",children:[(0,l.jsx)(n.code,{children:"beforeBuildTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildtask",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6839\u636E\u6784\u5EFA\u914D\u7F6E\uFF0CModern.js Module \u4F1A\u5C06\u6574\u4F53\u6784\u5EFA\u5206\u6210\u591A\u4E2A\u5B50\u6784\u5EFA\u4EFB\u52A1\u3002\u8BE5 Hook \u5C06\u4F1A\u5728\u6BCF\u4E00\u4E2A\u6784\u5EFA\u5B50\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildTask(config: BaseBuildConfig): BaseBuildConfig {\n return config;\n },\n };\n },\n});\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuildtask",children:[(0,l.jsx)(n.code,{children:"afterBuildTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildtask",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"}),"\uFF0C\u6BCF\u4E00\u4E2A\u6784\u5EFA\u5B50\u4EFB\u52A1\u7ED3\u675F\u4E4B\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildTask(options: BuildTaskResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u548C\u8FD4\u56DE\u503C\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildTaskResult {\n status: 'success' | 'fail';\n message?: string;\n config: BaseBuildConfig;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuild",children:[(0,l.jsx)(n.code,{children:"afterBuild"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuild",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"}),"\uFF0C\u6574\u4F53\u6784\u5EFA\u6D41\u7A0B\u7ED3\u675F\u4E4B\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuild(options: BuildResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u548C\u8FD4\u56DE\u503C\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildResult {\n status: 'success' | 'fail';\n message?: string;\n config: BuildConfig;\n commandOptions: BuildCommandOptions;\n totalDuration: number;\n}\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"buildplatform-\u94A9\u5B50",children:["buildPlatform \u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform-\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["module-tools \u8FD8\u63D0\u4F9B\u4E86 ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u6765\u6267\u884C\u7279\u5B9A\u7684\u6784\u5EFA\u4EFB\u52A1\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u4F8B\u5982\u5728\u5B89\u88C5\u4E86 Doc \u63D2\u4EF6\u540E\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u6216\u8005 ",(0,l.jsx)(n.code,{children:"build --platform doc"})," \u6765\u6267\u884C doc \u7684\u6784\u5EFA\u4EFB\u52A1\u3002\u56E0\u4E3A doc \u63D2\u4EF6\u57FA\u4E8E buildPlatform Hooks \u5B9E\u73B0\u4E86\u8BE5\u529F\u80FD\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u540E\u4F1A\u6309\u7167\u4EE5\u4E0B\u987A\u5E8F\u89E6\u53D1 Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"registerBuildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"buildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuildPlatform"})}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"registerbuildplatform",children:[(0,l.jsx)(n.code,{children:"registerBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerbuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u83B7\u53D6\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u65F6\u5019\u9700\u8981\u8FD0\u884C\u7684\u4EFB\u52A1\u4FE1\u606F\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerBuildPlatform(): RegisterBuildPlatformResult {\n // ...\n return {\n platform: 'doc',\n build() {\n // logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // \u5F53\u524D\u8FD0\u884C\u7684 platform \u6784\u5EFA\u4EFB\u52A1\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuildplatform",children:[(0,l.jsx)(n.code,{children:"beforeBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"beforeBuildPlatform"})," \u4F1A\u5728\u6267\u884C\u6574\u4F53\u7684\u6784\u5EFA\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildPlatform(platforms: RegisterBuildPlatformResult[]): void {\n console.info(`have ${platforms.length} platform tasks`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // \u5F53\u524D\u8FD0\u884C\u7684 platform \u6784\u5EFA\u4EFB\u52A1\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"buildplatform",children:[(0,l.jsx)(n.code,{children:"buildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"buildPlatform"})," \u4F1A\u5728\u6BCF\u4E2A\u6784\u5EFA\u4EFB\u52A1\u6267\u884C\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n buildPlatform({ platform }: Options): void {\n console.info(`current task is ${platform}`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface Options {\n platform: string;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuildplatform",children:[(0,l.jsx)(n.code,{children:"afterBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"afterBuildPlatform"})," \u4F1A\u5728\u6574\u4F53 platform \u6784\u5EFA\u4EFB\u52A1\u7ED3\u675F\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildPlatform(result: BuildPlatformResult): void {\n if (result.status === 'success') {\n console.info(`all platform build task success`);\n } else {\n console.error(result.message);\n }\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildPlatformResult {\n status: 'success' | 'fail';\n message: string | Error | null;\n}\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u8C03\u8BD5\u94A9\u5B50",children:["\u8C03\u8BD5\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8C03\u8BD5\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u6309\u7167\u987A\u5E8F\u89E6\u53D1\u4EE5\u4E0B Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"registerDev"}),": \u5728\u83B7\u53D6\u8C03\u8BD5\u529F\u80FD\u4FE1\u606F\u7684\u65F6\u5019\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDev"}),": \u5F00\u59CB\u6267\u884C\u8C03\u8BD5\u6574\u4F53\u6D41\u7A0B\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDevMenu"}),": \u51FA\u73B0\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"afterDevMenu"}),": \u9009\u62E9\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u9009\u9879\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDevTask"}),": \u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"afterDev"}),": \u6267\u884C dev \u6574\u4F53\u6D41\u7A0B\u6700\u540E\u89E6\u53D1\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"registerdev",children:[(0,l.jsx)(n.code,{children:"registerDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerdev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6CE8\u518C\u8C03\u8BD5\u5DE5\u5177\u76F8\u5173\u7684\u6570\u636E\u3002\u4E3B\u8981\u5305\u542B\uFF1A"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"\u8C03\u8BD5\u5DE5\u5177\u7684\u540D\u79F0"}),"\n",(0,l.jsx)(n.li,{children:"\u663E\u793A\u5728\u83DC\u5355\u5217\u8868\u4E2D\u7684\u9879\u76EE\u540D\u79F0\u4EE5\u53CA\u5BF9\u5E94\u7684\u503C\u3002"}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"dev"})," \u5B50\u547D\u4EE4\u7684\u5B9A\u4E49\u3002"]}),"\n",(0,l.jsx)(n.li,{children:"\u662F\u5426\u5728\u8FD0\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u6267\u884C\u6E90\u7801\u6784\u5EFA"}),"\n",(0,l.jsx)(n.li,{children:"\u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u7684\u51FD\u6570\u3002"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerDev() {\n return {\n // \u8C03\u8BD5\u5DE5\u5177\u540D\u79F0\n name: 'storybook',\n // \u83DC\u5355\u663E\u793A\u5185\u5BB9\n menuItem: {\n name: 'Storybook',\n value: 'storybook',\n },\n // \u5B9A\u4E49\u7684 dev \u5B50\u547D\u4EE4\n subCommands: ['storybook', 'story'],\n async action() {\n // dev logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforedev",children:[(0,l.jsx)(n.code,{children:"beforeDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728\u6536\u96C6\u5B8C\u6240\u6709\u8C03\u8BD5\u5DE5\u5177\u5143\u6570\u636E\u540E\uFF0C\u6267\u884C dev \u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDev(metas: DevToolData[]) {\n console.info(`have ${metas.length} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforeafterdevmenu",children:[(0,l.jsx)(n.code,{children:"(before|after)DevMenu"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforeafterdevmenu",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"beforeDevMenu"})," \u5728\u51FA\u73B0\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u4E4B\u524D\u89E6\u53D1\u3002\u63A5\u6536 ",(0,l.jsx)(n.a,{href:"https://github.com/SBoudrias/Inquirer.js#question",target:"_blank",rel:"noopener noreferrer",children:"inquirer question"})," \u4F5C\u4E3A\u53C2\u6570\u3002\u9ED8\u8BA4\u503C\u4E3A\uFF1A"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"const question = [\n {\n name: 'choiceDevTool',\n message: '\u9009\u62E9\u8C03\u8BD5\u5DE5\u5177',\n type: 'list',\n // \u6CE8\u518C\u7684\u8C03\u8BD5\u4FE1\u606F\n choices,\n },\n];\n"})}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"afterDevMenu"})," \u9009\u62E9\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u9009\u9879\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevMenu(questions) {\n questions[0].message += '!';\n return questions; // required\n },\n afterDevMenu(options: Options) {\n console.info(`choise ${options.result.choiceDevTool} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export type { QuestionCollection } from 'inquirer';\n\nexport interface Options {\n result: PromptResult;\n devTools: DevToolData[];\n}\n\nexport type PromptResult = { choiceDevTool: string };\nexport interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforedevtask",children:[(0,l.jsx)(n.code,{children:"beforeDevTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedevtask",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevTask(currentDevData: DevToolData) {\n console.info(`${currentDevData.name} running`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterdev",children:[(0,l.jsx)(n.code,{children:"afterDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterdev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728\u4E2D\u65AD\u8C03\u8BD5\u4EFB\u52A1\u8FDB\u7A0B\u65F6\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterDev() {\n console.info(`exit!`);\n },\n };\n },\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(i,{...e})}):i(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fapi%2Fplugin-api%2Fplugin-hooks.md"]={toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2},{text:"`beforeBuild`",id:"beforebuild",depth:3},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3},{text:"`afterBuild`",id:"afterbuild",depth:3},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3},{text:"`buildPlatform`",id:"buildplatform",depth:3},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2},{text:"`registerDev`",id:"registerdev",depth:3},{text:"`beforeDev`",id:"beforedev",depth:3},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3},{text:"`beforeDevTask`",id:"beforedevtask",depth:3},{text:"`afterDev`",id:"afterdev",depth:3}],title:"Plugin Hooks",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/679.dad5d5aa.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4575.0ddcba6d.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/679.dad5d5aa.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4575.0ddcba6d.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6955.09d1828c.js b/modern-js/module-tools/static/js/async/4607.a515024b.js similarity index 98% rename from modern-js/module-tools/static/js/async/6955.09d1828c.js rename to modern-js/module-tools/static/js/async/4607.a515024b.js index 0b1c2a6d6f..ccc951dc58 100644 --- a/modern-js/module-tools/static/js/async/6955.09d1828c.js +++ b/modern-js/module-tools/static/js/async/4607.a515024b.js @@ -1,2 +1,2 @@ -/*! For license information please see 6955.09d1828c.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6955"],{33800:function(e,n,s){"use strict";s.r(n);var r=s("39980"),d=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",div:"div",pre:"pre",em:"em"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"buildpreset",children:["buildPreset",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildpreset",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u6784\u5EFA\u7684\u9884\u8BBE\u5B57\u7B26\u4E32\u6216\u8005\u9884\u8BBE\u51FD\u6570\u3002\u63D0\u4F9B\u5F00\u7BB1\u5373\u7528\u7684\u6784\u5EFA\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(n.code,{children:"string | Function"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C: ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library",children:[(0,r.jsx)(n.code,{children:"npm-library"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684 Library \u901A\u7528\u6A21\u5F0F\uFF0C\u5305\u542B ",(0,r.jsx)(n.code,{children:"esm"})," \u548C ",(0,r.jsx)(n.code,{children:"cjs"})," \u4E24\u79CD Bundle \u4EA7\u7269\uFF0C\u5E76\u4E14\u5305\u542B\u4E00\u4EFD\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive info",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsxs)(n.p,{children:["\u5173\u4E8E\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.npmjs.com",target:"_blank",rel:"noopener noreferrer",children:"npm"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"yarn"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})}),"\n"]}),"\n"]})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts"\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-library-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\uFF0C\u5E76\u4E14 Library \u652F\u6301\u7C7B\u4F3C ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"})," \u7684\u6A21\u5F0F\u3002\u5728\u9884\u8BBE ",(0,r.jsx)(n.code,{children:"'npm-library'"})," \u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u63D0\u4F9B ",(0,r.jsx)(n.code,{children:"umd"})," \u4EA7\u7269\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n};\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-component",children:[(0,r.jsx)(n.code,{children:"npm-component"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684 \u7EC4\u4EF6\uFF08\u5E93\uFF09\u901A\u7528\u6A21\u5F0F\u3002\u5305\u542B ",(0,r.jsx)(n.code,{children:"esm"})," \u548C ",(0,r.jsx)(n.code,{children:"cjs"})," \u4E24\u79CD Bundleless \u4EA7\u7269\uFF08\u4FBF\u4E8E ",(0,r.jsx)(n.em,{children:(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/zh-CN/docs/Glossary/Tree_shaking",target:"_blank",rel:"noopener noreferrer",children:"Tree shaking"})})," \u4F18\u5316\uFF09\uFF0C\u4EE5\u53CA\u5305\u542B\u4E00\u4EFD\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5BF9\u4E8E\u6E90\u7801\u4E2D\u5305\u542B\u7684\u6837\u5F0F\u6587\u4EF6\uFF0C\u4EA7\u7269\u4E2D\u63D0\u4F9B\u6837\u5F0F\u7684\u7F16\u8BD1\u4EA7\u7269\u548C\u6837\u5F0F\u7684\u6E90\u6587\u4EF6\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n};\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-component-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-component-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684\u7EC4\u4EF6\uFF08\u5E93\uFF09\uFF0C\u540C\u65F6\u652F\u6301\u7C7B ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"})," \u7684\u6A21\u5F0F\u3002 \u5728\u9884\u8BBE ",(0,r.jsx)(n.code,{children:"'npm-component'"})," \u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u63D0\u4F9B ",(0,r.jsx)(n.code,{children:"umd"})," \u4EA7\u7269\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n};\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library-es5esnext",children:[(0,r.jsx)(n.code,{children:"npm-library-{es5...esnext}"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-es5esnext",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u60F3\u8981\u4F7F\u7528\u652F\u6301\u5176\u4ED6 ECMAScript \u7248\u672C\u7684 ",(0,r.jsx)(n.code,{children:"buildPreset"})," \u9884\u8BBE\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u76F4\u63A5\u5728 ",(0,r.jsx)(n.code,{children:"'npm-library'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-library-with-umd'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-component'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-component-with-umd'"})," \u8FD9\u4E9B\u9884\u8BBE\u503C\u540E\u9762\u589E\u52A0\u60F3\u8981\u652F\u6301\u7684\u7248\u672C\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4F8B\u5982\u5E0C\u671B ",(0,r.jsx)(n.code,{children:"'npm-library'"})," \u9884\u8BBE\u652F\u6301 ",(0,r.jsx)(n.code,{children:"'es2017'"}),"\uFF0C\u5219\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u914D\u7F6E\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset: 'npm-library-es2017',\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"string--function",children:["string / function",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#string--function",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["buildPreset \u9664\u4E86\u652F\u6301\u57FA\u672C\u7684\u5B57\u7B26\u4E32\u5F62\u5F0F\uFF0C\u8FD8\u652F\u6301\u51FD\u6570\u5F62\u5F0F\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.code,{children:"preset"})," \u6216\u8005 ",(0,r.jsx)(n.code,{children:"extendPreset"})," \u53C2\u6570\u83B7\u53D6\u6211\u4EEC\u63D0\u4F9B\u7684\u9884\u8BBE\u503C\uFF0C\u7136\u540E\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4EE5\u4E0B\u662F\u4E24\u4E2A\u5206\u522B\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"preset"})," \u548C ",(0,r.jsx)(n.code,{children:"extendPreset"})," \u7684\u4F8B\u5B50\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ preset }) {\n const { NPM_LIBRARY } = preset;\n return NPM_LIBRARY.map(config => {\n config.define = {\n VERSION: '1.0.1',\n };\n return config;\n });\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"extendPreset"})," \u91CC\u4F1A\u4F7F\u7528 lodash.merge \u8FDB\u884C\u914D\u7F6E\u5408\u5E76"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ extendPreset }) {\n return extendPreset('npm-library', {\n define: {\n VERSION: '1.0.1',\n },\n });\n },\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-preset.mdx"]={toc:[{text:"`npm-library`",id:"npm-library",depth:2},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2},{text:"`npm-component`",id:"npm-component",depth:2},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2},{text:"string / function",id:"string--function",depth:2}],title:"buildPreset",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 4607.a515024b.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4607"],{15543:function(e,n,s){"use strict";s.r(n);var r=s("39980"),d=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",div:"div",pre:"pre",em:"em"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"buildpreset",children:["buildPreset",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildpreset",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u6784\u5EFA\u7684\u9884\u8BBE\u5B57\u7B26\u4E32\u6216\u8005\u9884\u8BBE\u51FD\u6570\u3002\u63D0\u4F9B\u5F00\u7BB1\u5373\u7528\u7684\u6784\u5EFA\u914D\u7F6E\u3002"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,r.jsx)(n.code,{children:"string | Function"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C: ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library",children:[(0,r.jsx)(n.code,{children:"npm-library"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684 Library \u901A\u7528\u6A21\u5F0F\uFF0C\u5305\u542B ",(0,r.jsx)(n.code,{children:"esm"})," \u548C ",(0,r.jsx)(n.code,{children:"cjs"})," \u4E24\u79CD Bundle \u4EA7\u7269\uFF0C\u5E76\u4E14\u5305\u542B\u4E00\u4EFD\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive info",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsxs)(n.p,{children:["\u5173\u4E8E\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://www.npmjs.com",target:"_blank",rel:"noopener noreferrer",children:"npm"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"yarn"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})}),"\n"]}),"\n"]})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts"\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-library-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\uFF0C\u5E76\u4E14 Library \u652F\u6301\u7C7B\u4F3C ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"})," \u7684\u6A21\u5F0F\u3002\u5728\u9884\u8BBE ",(0,r.jsx)(n.code,{children:"'npm-library'"})," \u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u63D0\u4F9B ",(0,r.jsx)(n.code,{children:"umd"})," \u4EA7\u7269\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n};\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-component",children:[(0,r.jsx)(n.code,{children:"npm-component"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684 \u7EC4\u4EF6\uFF08\u5E93\uFF09\u901A\u7528\u6A21\u5F0F\u3002\u5305\u542B ",(0,r.jsx)(n.code,{children:"esm"})," \u548C ",(0,r.jsx)(n.code,{children:"cjs"})," \u4E24\u79CD Bundleless \u4EA7\u7269\uFF08\u4FBF\u4E8E ",(0,r.jsx)(n.em,{children:(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/zh-CN/docs/Glossary/Tree_shaking",target:"_blank",rel:"noopener noreferrer",children:"Tree shaking"})})," \u4F18\u5316\uFF09\uFF0C\u4EE5\u53CA\u5305\u542B\u4E00\u4EFD\u7C7B\u578B\u6587\u4EF6\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5BF9\u4E8E\u6E90\u7801\u4E2D\u5305\u542B\u7684\u6837\u5F0F\u6587\u4EF6\uFF0C\u4EA7\u7269\u4E2D\u63D0\u4F9B\u6837\u5F0F\u7684\u7F16\u8BD1\u4EA7\u7269\u548C\u6837\u5F0F\u7684\u6E90\u6587\u4EF6\u3002"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n};\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u9884\u8BBE\u5B57\u7B26\u4E32\u5BF9\u5E94\u7684\u6784\u5EFA\u914D\u7F6E\uFF1A"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-component-with-umd",children:[(0,r.jsx)(n.code,{children:"npm-component-with-umd"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-component-with-umd",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728\u7C7B ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"NPM"})," \u5305\u7BA1\u7406\u5668\u4E0B\u4F7F\u7528\u7684\u7EC4\u4EF6\uFF08\u5E93\uFF09\uFF0C\u540C\u65F6\u652F\u6301\u7C7B ",(0,r.jsx)(n.a,{href:"https://unpkg.com/",target:"_blank",rel:"noopener noreferrer",children:"unpkg"})," \u7684\u6A21\u5F0F\u3002 \u5728\u9884\u8BBE ",(0,r.jsx)(n.code,{children:"'npm-component'"})," \u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u63D0\u4F9B ",(0,r.jsx)(n.code,{children:"umd"})," \u4EA7\u7269\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "main": "./dist/lib/index.js", // bundleless type\n "module": "./dist/es/index.js", // bundleless type\n "types": "./dist/types/index.d.ts",\n "unpkg": "./dist/umd/index.js",\n};\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"export const buildConfig = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n },\n];\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"npm-library-es5esnext",children:[(0,r.jsx)(n.code,{children:"npm-library-{es5...esnext}"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-library-es5esnext",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u5F53\u60F3\u8981\u4F7F\u7528\u652F\u6301\u5176\u4ED6 ECMAScript \u7248\u672C\u7684 ",(0,r.jsx)(n.code,{children:"buildPreset"})," \u9884\u8BBE\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u76F4\u63A5\u5728 ",(0,r.jsx)(n.code,{children:"'npm-library'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-library-with-umd'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-component'"}),"\u3001",(0,r.jsx)(n.code,{children:"'npm-component-with-umd'"})," \u8FD9\u4E9B\u9884\u8BBE\u503C\u540E\u9762\u589E\u52A0\u60F3\u8981\u652F\u6301\u7684\u7248\u672C\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4F8B\u5982\u5E0C\u671B ",(0,r.jsx)(n.code,{children:"'npm-library'"})," \u9884\u8BBE\u652F\u6301 ",(0,r.jsx)(n.code,{children:"'es2017'"}),"\uFF0C\u5219\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u914D\u7F6E\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset: 'npm-library-es2017',\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"string--function",children:["string / function",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#string--function",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["buildPreset \u9664\u4E86\u652F\u6301\u57FA\u672C\u7684\u5B57\u7B26\u4E32\u5F62\u5F0F\uFF0C\u8FD8\u652F\u6301\u51FD\u6570\u5F62\u5F0F\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,r.jsx)(n.code,{children:"preset"})," \u6216\u8005 ",(0,r.jsx)(n.code,{children:"extendPreset"})," \u53C2\u6570\u83B7\u53D6\u6211\u4EEC\u63D0\u4F9B\u7684\u9884\u8BBE\u503C\uFF0C\u7136\u540E\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4EE5\u4E0B\u662F\u4E24\u4E2A\u5206\u522B\u4F7F\u7528 ",(0,r.jsx)(n.code,{children:"preset"})," \u548C ",(0,r.jsx)(n.code,{children:"extendPreset"})," \u7684\u4F8B\u5B50\uFF1A"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ preset }) {\n const { NPM_LIBRARY } = preset;\n return NPM_LIBRARY.map(config => {\n config.define = {\n VERSION: '1.0.1',\n };\n return config;\n });\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"extendPreset"})," \u91CC\u4F1A\u4F7F\u7528 lodash.merge \u8FDB\u884C\u914D\u7F6E\u5408\u5E76"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildPreset({ extendPreset }) {\n return extendPreset('npm-library', {\n define: {\n VERSION: '1.0.1',\n },\n });\n },\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-preset.mdx"]={toc:[{text:"`npm-library`",id:"npm-library",depth:2},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2},{text:"`npm-component`",id:"npm-component",depth:2},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2},{text:"string / function",id:"string--function",depth:2}],title:"buildPreset",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4465.3480ef34.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4607.a515024b.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4465.3480ef34.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4607.a515024b.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4699.75859fc3.js b/modern-js/module-tools/static/js/async/4699.75859fc3.js new file mode 100644 index 0000000000..6fcf6cf550 --- /dev/null +++ b/modern-js/module-tools/static/js/async/4699.75859fc3.js @@ -0,0 +1,2 @@ +/*! For license information please see 4699.75859fc3.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4699"],{5449:function(e,n,d){"use strict";d.r(n);var s=d("39980"),c=d("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",pre:"pre",h2:"h2",strong:"strong",h3:"h3",ul:"ul",li:"li",blockquote:"blockquote"},(0,c.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",children:["\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E00\u822C\u6765\u8BF4\uFF0C\u9879\u76EE\u6240\u9700\u8981\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u53EF\u4EE5\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u7684 ",(0,s.jsx)(n.code,{children:"install"})," \u547D\u4EE4\u5B89\u88C5\uFF0C\u5728\u5B89\u88C5\u7B2C\u4E09\u65B9\u4F9D\u8D56\u6210\u529F\u540E\uFF0C\u8FD9\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u4E00\u822C\u4F1A\u51FA\u73B0\u5728\u9879\u76EE ",(0,s.jsx)(n.code,{children:"package.json"})," \u7684 ",(0,s.jsx)(n.code,{children:"dependencies"})," \u548C ",(0,s.jsx)(n.code,{children:"devDependencies"})," \u4E0B\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="pacakge.json"',children:'{\n "dependencies": {},\n "devDependencies": {}\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4E0B\u7684\u4F9D\u8D56\u901A\u5E38\u6765\u8BF4\u662F\u8FD9\u4E2A\u5305\u8FD0\u884C\u6240\u9700\u7684\u4F9D\u8D56\uFF0C ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u5219\u4EE3\u8868\u7740\u5F00\u53D1\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4EE5\u5916\uFF0C",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started#peerdependencies",children:(0,s.jsx)(n.code,{children:'"peerDependencies"'})})," \u4E5F\u53EF\u4EE5\u58F0\u660E\u5728\u751F\u4EA7\u73AF\u5883\u4E0B\u8FD0\u884C\u6240\u9700\u8981\u7684\u4F9D\u8D56\uFF0C\u6B64\u65F6\u4F1A\u548C\u5B83\u7684\u5BBF\u4E3B\u5171\u4EAB\u4E00\u4EFD\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",children:["\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728 Modern.js Module \u91CC\uFF0C",(0,s.jsxs)(n.strong,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4E0D\u4F1A\u5BF9 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4EE5\u53CA ",(0,s.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u8FDB\u884C\u6253\u5305\u5904\u7406"]}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u662F\u56E0\u4E3A\u5728\u5B89\u88C5 npm \u5305\u65F6\uFF0C\u5176 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4E5F\u4F1A\u88AB\u5B89\u88C5\u3002\u4E0D\u6253\u5305 ",(0,s.jsx)(n.code,{children:'"dependencies"'}),"\uFF0C\u53EF\u4EE5\u51CF\u5C0F\u5305\u4EA7\u7269\u7684\u4F53\u79EF\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u6253\u5305\u67D0\u4E9B\u4F9D\u8D56\uFF0C\u5EFA\u8BAE\u5C06\u5B83\u4EEC\u4ECE ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u632A\u5230 ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \uFF0C\u8FD9\u76F8\u5F53\u4E8E\u5BF9\u4F9D\u8D56\u8FDB\u884C ",(0,s.jsx)(n.strong,{children:"prebundle"})," \uFF0C\u53EF\u4EE5\u51CF\u5C0F\u4F9D\u8D56\u5B89\u88C5\u7684\u4F53\u79EF\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u9879\u76EE\u4F9D\u8D56\u4E86 ",(0,s.jsx)(n.code,{children:"react"}),":"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n },\n // or\n "peerDependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,s.jsx)(n.code,{children:"react"})," \u4F9D\u8D56:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u4EA7\u7269\u4E2D\u4E0D\u4F1A\u5305\u542B ",(0,s.jsx)(n.code,{children:"react"})," \u7684\u4EE3\u7801:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u5982\u679C\u60F3\u8981\u4FEE\u6539\u9ED8\u8BA4\u7684\u5904\u7406\u65B9\u5F0F\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684 API \u8FDB\u884C\u4FEE\u6539\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,s.jsx)(n.code,{children:"buildConfig.autoExternal"})})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",children:["\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728\u4E0A\u9762\u6211\u4EEC\u63D0\u5230\u4E86 ",(0,s.jsx)(n.code,{children:"buildConfig.autoExternal"})," API \u7684\u7528\u9014\uFF0C\u540C\u65F6 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,s.jsx)(n.code,{children:"buildConfig.externals"})})," \u53EF\u4EE5\u5B9E\u73B0\u5BF9\u4E09\u65B9\u4F9D\u8D56\u66F4\u7EC6\u5FAE\u7684\u5904\u7406\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F8B\u5982\u5F53\u6211\u4EEC\u9700\u8981\u4EC5\u5BF9\u67D0\u4E9B\u4F9D\u8D56\u4E0D\u8FDB\u884C\u6253\u5305\u5904\u7406\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u8FDB\u884C\u914D\u7F6E\uFF1A"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"\u4E00\u822C\u8FD9\u79CD\u60C5\u51B5\uFF0C\u53EF\u80FD\u662F\u67D0\u4E9B\u4F9D\u8D56\u4E0D\u9002\u5408\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u9047\u5230\u8FD9\u79CD\u60C5\u51B5\uFF0C\u5219\u53EF\u4EE5\u6309\u7167\u4E0B\u9762\u7684\u65B9\u5F0F\u8FDB\u884C\u5904\u7406\u3002"}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"epxort default defineConfig({\n buildConfig: {\n autoExternal: false,\n externals: ['pkg-1', /pkg-2/],\n }\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,c.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fexternal-dependency.mdx"]={toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2}],title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4888.aefed6d6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4699.75859fc3.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4888.aefed6d6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4699.75859fc3.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2377.66c1b3fa.js b/modern-js/module-tools/static/js/async/4764.26a6f511.js similarity index 97% rename from modern-js/module-tools/static/js/async/2377.66c1b3fa.js rename to modern-js/module-tools/static/js/async/4764.26a6f511.js index 94822cbed0..3e8236d482 100644 --- a/modern-js/module-tools/static/js/async/2377.66c1b3fa.js +++ b/modern-js/module-tools/static/js/async/4764.26a6f511.js @@ -1,2 +1,2 @@ -/*! For license information please see 2377.66c1b3fa.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2377"],{76279:function(e,n,s){"use strict";s.r(n);var l=s("39980"),o=s("9580"),d=s("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code"},(0,o.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"babel-\u63D2\u4EF6",children:["Babel \u63D2\u4EF6",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-\u63D2\u4EF6",children:"#"})]}),"\n",(0,l.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,l.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,l.jsx)(n.div,{className:"rspress-directive-content",children:(0,l.jsx)(n.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u65E0\u9700\u4F7F\u7528 Babel \u8F6C\u6362\u6211\u4EEC\u7684\u4EE3\u7801\uFF0C\u6B64\u63D2\u4EF6\u4EC5\u4F5C\u4E3A\u4E00\u79CD\u964D\u7EA7\u65B9\u5F0F\u3002"})})]}),"\n",(0,l.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,l.jsx)(d.SU,{command:"add @modern-js/plugin-module-babel -D"}),"\n",(0,l.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginBabel()],\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u4F60\u4E5F\u53EF\u4EE5\u901A\u8FC7 hooks \u914D\u7F6E\u6CE8\u518C\uFF0C\u4F8B\u5982\u4F60\u540C\u65F6\u9700\u8981\u6253\u5305 A\uFF0CB \u4E24\u4E2A\u6587\u4EF6\uFF0C\u5E76\u53EA\u9700\u8981\u5728\u6253\u5305 A \u65F6\u4F7F\u7528 babel\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getBabelHook } from '@modern-js/plugin-module-babel';\n\nconst babelHook = getBabelHook({\n // babel options\n});\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n hooks: [babelHook],\n input: ['src/a.ts'],\n },\n {\n input: ['src/b.ts'],\n },\n ],\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["See ",(0,l.jsx)(n.a,{href:"https://babeljs.io/docs/options",target:"_blank",rel:"noopener noreferrer",children:"Babel options"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u4E0B\u9762\u662F\u4E00\u4E2A\u914D\u7F6E\u4E86",(0,l.jsx)(n.code,{children:"@babel/preset-env"}),"\u7684\u4F8B\u5B50\uFF1A"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBabel({\n presets: [['@babel/preset-env']],\n }),\n ],\n});\n"})})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(r,{...e})}):r(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-babel.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2}],title:"Babel \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 4764.26a6f511.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4764"],{33889:function(e,n,s){"use strict";s.r(n);var l=s("39980"),o=s("9580"),d=s("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code"},(0,o.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"babel-\u63D2\u4EF6",children:["Babel \u63D2\u4EF6",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-\u63D2\u4EF6",children:"#"})]}),"\n",(0,l.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,l.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,l.jsx)(n.div,{className:"rspress-directive-content",children:(0,l.jsx)(n.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u65E0\u9700\u4F7F\u7528 Babel \u8F6C\u6362\u6211\u4EEC\u7684\u4EE3\u7801\uFF0C\u6B64\u63D2\u4EF6\u4EC5\u4F5C\u4E3A\u4E00\u79CD\u964D\u7EA7\u65B9\u5F0F\u3002"})})]}),"\n",(0,l.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,l.jsx)(d.SU,{command:"add @modern-js/plugin-module-babel -D"}),"\n",(0,l.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginBabel()],\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u4F60\u4E5F\u53EF\u4EE5\u901A\u8FC7 hooks \u914D\u7F6E\u6CE8\u518C\uFF0C\u4F8B\u5982\u4F60\u540C\u65F6\u9700\u8981\u6253\u5305 A\uFF0CB \u4E24\u4E2A\u6587\u4EF6\uFF0C\u5E76\u53EA\u9700\u8981\u5728\u6253\u5305 A \u65F6\u4F7F\u7528 babel\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getBabelHook } from '@modern-js/plugin-module-babel';\n\nconst babelHook = getBabelHook({\n // babel options\n});\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n hooks: [babelHook],\n input: ['src/a.ts'],\n },\n {\n input: ['src/b.ts'],\n },\n ],\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["See ",(0,l.jsx)(n.a,{href:"https://babeljs.io/docs/options",target:"_blank",rel:"noopener noreferrer",children:"Babel options"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u4E0B\u9762\u662F\u4E00\u4E2A\u914D\u7F6E\u4E86",(0,l.jsx)(n.code,{children:"@babel/preset-env"}),"\u7684\u4F8B\u5B50\uFF1A"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBabel({\n presets: [['@babel/preset-env']],\n }),\n ],\n});\n"})})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(r,{...e})}):r(e)}n.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-babel.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2}],title:"Babel \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4521.5a2181e6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4764.26a6f511.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/4521.5a2181e6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4764.26a6f511.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/7626.2302d513.js b/modern-js/module-tools/static/js/async/4887.e31f697b.js similarity index 61% rename from modern-js/module-tools/static/js/async/7626.2302d513.js rename to modern-js/module-tools/static/js/async/4887.e31f697b.js index 4f2fee5ac8..94ee697025 100644 --- a/modern-js/module-tools/static/js/async/7626.2302d513.js +++ b/modern-js/module-tools/static/js/async/4887.e31f697b.js @@ -1,2 +1,2 @@ -/*! For license information please see 7626.2302d513.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7626"],{8659:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-test.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 4887.e31f697b.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4887"],{9845:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-other.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/721.4493e1c6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/4887.e31f697b.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/721.4493e1c6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/4887.e31f697b.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5185.b039a3f1.js b/modern-js/module-tools/static/js/async/5185.b039a3f1.js deleted file mode 100644 index 45b372906c..0000000000 --- a/modern-js/module-tools/static/js/async/5185.b039a3f1.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 5185.b039a3f1.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5185"],{927:function(e,n,o){"use strict";o.r(n);var r=o("39980"),s=o("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",div:"div",strong:"strong",h3:"h3",ul:"ul",li:"li",code:"code",pre:"pre",img:"img",h4:"h4"},(0,s.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"dev",children:["dev",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dev",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"This section describes all configuration of Modern.js Module related to debugging tools."}),"\n",(0,r.jsxs)(n.h2,{id:"storybook",children:["storybook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Deprecated"}),": This configuration is deprecated and only applicable to Storybook V6. Please see ",(0,r.jsx)(n.a,{href:"/guide/basic/using-storybook",children:"\u4F7F\u7528Storybook"})," to get more info.\n"]})})]}),"\n",(0,r.jsxs)(n.h3,{id:"storybookwebpack",children:["storybook.webpack",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpack",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Type"}),": ",(0,r.jsx)(n.code,{children:"object | Function | undefined"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default"}),": ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpack(config) {\n return config;\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["You can modify the webpack configuration of the Storybook Preview-iframe via ",(0,r.jsx)(n.code,{children:"dev.storybook.webpack"}),". The usage can be found in the ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/builder/en/api/config-tools.html#toolswebpack",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"tools.webpack"})})," configuration of Modern.js Builder."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://storybook.js.org/71522ac365feaf3338d7c242e53378f6/manager-preview.png",alt:"Storybook"})}),"\n",(0,r.jsxs)(n.h4,{id:"configure-manager-app",children:["Configure Manager App",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configure-manager-app",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["For the webpack configuration of the Storybook Manager app section, you can configure it by adding the ",(0,r.jsx)(n.code,{children:"./config/storybook/main.js"})," file to configure it."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"// ./config/storybook/main.js\n\nmodule.exports = {\n // it controls the Storybook manager app\n managerWebpack: async (config, options) => {\n // update config here\n return config;\n },\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"storybookwebpackchain",children:["storybook.webpackChain",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybookwebpackchain",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Type"}),": ",(0,r.jsx)(n.code,{children:"Function | undefined"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Default"}),": ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"export default {\n dev: {\n storybook: {\n webpackChain(chain) {\n return chain;\n },\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["You can modify the webpack configuration of the Storybook Preview-iframe via ",(0,r.jsx)(n.code,{children:"dev.storybook.webpackChain"}),". You can refer to Modern.js Builder's ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/builder/en/api/config-tools.html#toolswebpackchain",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(n.code,{children:"tools.webpackChain"})})," configuration for how to use it."]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Fdev.md"]={toc:[{text:"storybook",id:"storybook",depth:2},{text:"storybook.webpack",id:"storybookwebpack",depth:3},{text:"Configure Manager App",id:"configure-manager-app",depth:4},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3}],title:"dev",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3016.83cb912e.js b/modern-js/module-tools/static/js/async/5188.3f3d6165.js similarity index 94% rename from modern-js/module-tools/static/js/async/3016.83cb912e.js rename to modern-js/module-tools/static/js/async/5188.3f3d6165.js index b737561b99..7ed54dffd0 100644 --- a/modern-js/module-tools/static/js/async/3016.83cb912e.js +++ b/modern-js/module-tools/static/js/async/5188.3f3d6165.js @@ -1,2 +1,2 @@ -/*! For license information please see 3016.83cb912e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3016"],{68544:function(e,n,t){"use strict";t.r(n);var r=t("39980"),o=t("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",code:"code",p:"p",img:"img"},(0,o.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",children:["\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h2,{id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:["\u6267\u884C ",(0,r.jsx)(n.code,{children:"test"})," \u547D\u4EE4\u62A5\u9519 ",(0,r.jsx)(n.code,{children:"TypeError: Cannot read property 'testEnvironmentOptions' of undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/jest-error-testEnvironmentOptions-of-undefined.jpeg",alt:"jest-error"})}),"\n",(0,r.jsxs)(n.p,{children:["\u95EE\u9898\u539F\u56E0\u591A\u662F\u5B58\u5728\u591A\u4E2A\u7248\u672C\u7684 ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," \u4F9D\u8D56\uFF0C\u53EF\u4EE5\u68C0\u67E5 Monorepo \u4E2D\u5176\u4ED6\u9879\u76EE\u662F\u5426\u6709 ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," \u4F9D\u8D56\uFF0C\u5E76\u901A\u8FC7 Monorepo \u63D0\u4F9B\u7684 overrides \u80FD\u529B\u7EDF\u4E00\u4F9D\u8D56\u7248\u672C\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Ftest.mdx"]={toc:[{text:"\u6267\u884C `test` \u547D\u4EE4\u62A5\u9519 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:2}],title:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 5188.3f3d6165.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5188"],{92373:function(e,n,t){"use strict";t.r(n);var r=t("39980"),o=t("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",code:"code",p:"p",img:"img"},(0,o.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",children:["\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsxs)(n.h2,{id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:["\u6267\u884C ",(0,r.jsx)(n.code,{children:"test"})," \u547D\u4EE4\u62A5\u9519 ",(0,r.jsx)(n.code,{children:"TypeError: Cannot read property 'testEnvironmentOptions' of undefined"}),(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/jest-error-testEnvironmentOptions-of-undefined.jpeg",alt:"jest-error"})}),"\n",(0,r.jsxs)(n.p,{children:["\u95EE\u9898\u539F\u56E0\u591A\u662F\u5B58\u5728\u591A\u4E2A\u7248\u672C\u7684 ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," \u4F9D\u8D56\uFF0C\u53EF\u4EE5\u68C0\u67E5 Monorepo \u4E2D\u5176\u4ED6\u9879\u76EE\u662F\u5426\u6709 ",(0,r.jsx)(n.code,{children:"jest-environment-jsdom"})," \u4F9D\u8D56\uFF0C\u5E76\u901A\u8FC7 Monorepo \u63D0\u4F9B\u7684 overrides \u80FD\u529B\u7EDF\u4E00\u4F9D\u8D56\u7248\u672C\u3002"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Ftest.mdx"]={toc:[{text:"\u6267\u884C `test` \u547D\u4EE4\u62A5\u9519 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`",id:"\u6267\u884C-test-\u547D\u4EE4\u62A5\u9519-typeerror-cannot-read-property-testenvironmentoptions-of-undefined",depth:2}],title:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5037.155e45d9.js.LICENSE.txt b/modern-js/module-tools/static/js/async/5188.3f3d6165.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5037.155e45d9.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/5188.3f3d6165.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9983.fc4a3f3f.js b/modern-js/module-tools/static/js/async/5269.379402a1.js similarity index 99% rename from modern-js/module-tools/static/js/async/9983.fc4a3f3f.js rename to modern-js/module-tools/static/js/async/5269.379402a1.js index 04e194c10f..897fb88727 100644 --- a/modern-js/module-tools/static/js/async/9983.fc4a3f3f.js +++ b/modern-js/module-tools/static/js/async/5269.379402a1.js @@ -1,2 +1,2 @@ -/*! For license information please see 9983.fc4a3f3f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9983"],{48982:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",div:"div",h3:"h3",ul:"ul",strong:"strong",h4:"h4"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"\u4F7F\u7528-tailwind-css",children:["\u4F7F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u662F\u4E00\u4E2A\u4EE5 Utility Class \u4E3A\u57FA\u7840\u7684 CSS \u6846\u67B6\u548C\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u53EF\u4EE5\u5FEB\u901F\u5730\u4E3A\u7EC4\u4EF6\u6DFB\u52A0\u5E38\u7528\u6837\u5F0F\uFF0C\u540C\u65F6\u652F\u6301\u4E3B\u9898\u6837\u5F0F\u7684\u7075\u6D3B\u6269\u5C55\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Tailwind CSS \u5F00\u53D1\u7EC4\u4EF6\u6837\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 Modern.js Module \u4E2D\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"\uFF0C\u4F60\u53EA\u9700\u8981\u6309\u7167\u4EE5\u4E0B\u6B65\u9AA4\u64CD\u4F5C\uFF1A"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6267\u884C ",(0,i.jsx)(n.code,{children:"pnpm run new"}),"\uFF0C\u6309\u7167\u5982\u4E0B\u8FDB\u884C\u9009\u62E9\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? \u8BF7\u9009\u62E9\u4F60\u60F3\u8981\u7684\u64CD\u4F5C \u542F\u7528\u53EF\u9009\u529F\u80FD\n? \u8BF7\u9009\u62E9\u529F\u80FD\u540D\u79F0 \u542F\u7528 \u300CTailwind CSS\u300D \u652F\u6301\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230 ",(0,i.jsx)(n.code,{children:"package.json"})," \u4E2D\u65B0\u589E\u4E86 ",(0,i.jsx)(n.code,{children:"tailwindcss"})," \u548C ",(0,i.jsx)(n.code,{children:"@modern-js/plugin-tailwindcss"})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u4E2D\u6CE8\u518C Tailwind \u63D2\u4EF6:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';\n\nexport default defineConfig({\n plugins: [..., tailwindcssPlugin()],\n});\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsxs)(n.li,{children:["\u521B\u5EFA ",(0,i.jsx)(n.code,{children:"index.css"})," \u6587\u4EF6\uFF0C\u6DFB\u52A0\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="index.css"',children:"/* base \u548C components \u662F\u53EF\u9009\u7684\uFF0C\u8BF7\u914C\u60C5\u6DFB\u52A0 */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6839\u636E\u9700\u6C42\u4E0D\u540C\uFF0C\u4F60\u53EF\u4EE5\u9009\u62E9\u6027\u5730\u5BFC\u5165 Tailwind CSS \u63D0\u4F9B\u7684 CSS \u6837\u5F0F\u3002\u8BF7\u53C2\u8003 ",(0,i.jsxs)(n.a,{href:"https://tailwindcss.com/docs/functions-and-directives#tailwind",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)(n.code,{children:"@tailwind"})," \u6587\u6863"]})," \u6765\u4E86\u89E3 ",(0,i.jsx)(n.code,{children:"@tailwind"})," \u6307\u4EE4\u7684\u8BE6\u7EC6\u7528\u6CD5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"4",children:["\n",(0,i.jsxs)(n.li,{children:["\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"index.css"})," \u6587\u4EF6\uFF0C\u6BD4\u5982\u5728\u5165\u53E3\u7684 ",(0,i.jsx)(n.code,{children:"src/index.jsx"})," \u6587\u4EF6\u6DFB\u52A0\u5982\u4E0B\u4EE3\u7801\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import './index.css';\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"5",children:["\n",(0,i.jsx)(n.li,{children:"\u7136\u540E\u5373\u53EF\u5728\u5404\u4E2A\u7EC4\u4EF6\u4E2D\u4F7F\u7528 Tailwind CSS \u63D0\u4F9B\u7684 Utility Class \u4E86\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",children:'const Hello = () => (\n
                  \n

                  hello world

                  \n
                  \n);\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"\u914D\u7F6E-tailwind-css",children:["\u914D\u7F6E Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E-tailwind-css",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u6709\u4E24\u79CD\u65B9\u5F0F\u6765\u914D\u7F6E Tailwind CSS\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\uFF0C\u8BE5\u7528\u6CD5\u4E0E Tailwind CSS \u7684\u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:'"Tailwind CSS - Configuration"'})," \u6765\u4E86\u89E3\u66F4\u591A\u7528\u6CD5\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="tailwind.config.ts"',children:"import type { Config } from 'tailwindcss';\n\nexport default {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n} as Config;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u8BF7\u5347\u7EA7 Modern.js Module \u5230 >= 2.33.0 \u7248\u672C\uFF0C\u4EE5\u652F\u6301\u81EA\u52A8\u8BFB\u53D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styletailwindcss",children:"style.tailwindcss"})," \u914D\u7F6E\u9879\uFF0C\u8FD9\u662F\u65E7\u7248\u672C\u7684\u7528\u6CD5\uFF0C\u6211\u4EEC\u66F4\u63A8\u8350\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u8FDB\u884C\u914D\u7F6E\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"tailwind-css-\u81EA\u52A8\u8865\u5168",children:["Tailwind CSS \u81EA\u52A8\u8865\u5168",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-\u81EA\u52A8\u8865\u5168",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u5B98\u65B9\u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," \u63D2\u4EF6\uFF0C\u7528\u4E8E\u5728 VS Code \u4E2D\u81EA\u52A8\u8865\u5168 Tailwind CSS \u7684 class names\u3001CSS functions \u548C directives\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F60\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u6B65\u9AA4\u6765\u542F\u52A8\u81EA\u52A8\u8865\u5168\u529F\u80FD\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 VS Code \u4E2D\u5B89\u88C5 ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u9879\u76EE\u7684\u6839\u76EE\u5F55\u6CA1\u6709 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u521B\u5EFA\u8BE5\u6587\u4EF6\uFF0C\u5E76\u5199\u5165\u5F53\u524D\u9879\u76EE\u7684 Tailwind CSS \u914D\u7F6E\uFF0C\u5426\u5219 IDE \u63D2\u4EF6\u5C06\u65E0\u6CD5\u6B63\u786E\u751F\u6548\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u6784\u5EFA\u6A21\u5F0F",children:["\u6784\u5EFA\u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u4F7F\u7528 Tailwind CSS \u65F6\uFF0C\u8BF7\u6CE8\u610F\u6784\u5EFA\u4EA7\u7269\u5728 bundle \u548C bundleless \u4E24\u79CD\u6A21\u5F0F\u4E0B\u4F1A\u6709\u5F88\u5927\u533A\u522B\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5173\u4E8E bundle \u548C bundleless \u7684\u5B9A\u4E49\uFF0C\u53EF\u4EE5\u67E5\u770B ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u300C\u6DF1\u5165\u7406\u89E3\u6784\u5EFA\u300D"}),"\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"bundle-\u6A21\u5F0F",children:["Bundle \u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Bundle \u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u751F\u6210\u4E00\u4EFD\u5355\u72EC\u7684\u4EA7\u7269 CSS \u6587\u4EF6\uFF0C\u5E76\u4E14 JS \u4EA7\u7269\u4E0D\u4F1A\u81EA\u52A8\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"// src/index.tsx\nimport { jsx } from 'react/jsx-runtime';\nvar src_default = () => {\n return /* @__PURE__ */ jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n};\nexport { src_default as default };\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u5C06\u6837\u5F0F\u6CE8\u5165 JS \u4EA7\u7269\u4E2D\uFF0C\u53EF\u4EE5\u5F00\u542F ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styleinject",children:"style.inject"})," \u9009\u9879\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u6CA1\u6709\u5F00\u542F ",(0,i.jsx)(n.code,{children:"style.inject"}),"\uFF0C\u90A3\u4E48\u4E5F\u53EF\u4EE5\u8BA9\u7528\u6237\u624B\u52A8\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'your-package/dist/es/index.css';\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"bundleless-\u6A21\u5F0F",children:["Bundleless \u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Bundleless \u6A21\u5F0F\u4E0B\uFF0C\u9ED8\u8BA4\u4F1A\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\uFF0C\u65E0\u987B\u8FDB\u884C\u989D\u5916\u5904\u7406\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"import { jsx as _jsx } from 'react/jsx-runtime';\nimport './index.css';\nexport default () =>\n /* @__PURE__ */ _jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u7C7B\u540D\u524D\u7F00",children:["\u7C7B\u540D\u524D\u7F00",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u540D\u524D\u7F00",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 Tailwind CSS \u63D0\u4F9B\u7684 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration#prefix",target:"_blank",rel:"noopener noreferrer",children:"prefix"})," \u9009\u9879\u6765\u6DFB\u52A0\u7C7B\u540D\u524D\u7F00\uFF0C\u8FD9\u6837\u53EF\u4EE5\u907F\u514D\u6F5C\u5728\u7684\u7C7B\u540D\u51B2\u7A81\u95EE\u9898\uFF08\u6BD4\u5982 App \u548C Module \u4F7F\u7528\u4E86\u4E0D\u540C\u7248\u672C\u7684 Tailwind CSS\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"prefix"})," \u9009\u9879\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"foo-"})," \u524D\u7F00\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="tailwind.config.js"',children:"module.exports = {\n prefix: 'foo-',\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".foo-bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u7528\u6CD5\u4ECB\u7ECD",children:["\u7528\u6CD5\u4ECB\u7ECD",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7528\u6CD5\u4ECB\u7ECD",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E9B Tailwind CSS \u7684\u7528\u6CD5\u793A\u4F8B\u3002"}),"\n",(0,i.jsxs)(n.h3,{id:"html-\u7C7B\u540D",children:["HTML \u7C7B\u540D",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#html-\u7C7B\u540D",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u652F\u6301\u5728 HTML \u6807\u7B7E\u4E0A\u901A\u8FC7\u7C7B\u540D\u7684\u65B9\u5F0F\u589E\u52A0\u6837\u5F0F\u3002",(0,i.jsx)(n.strong,{children:"\u5F53\u4F7F\u7528 HTML \u7C7B\u540D\u7684\u65F6\u5019\uFF0C\u8BF7\u6CE8\u610F\u5FC5\u987B\u8981\u63D0\u524D\u5BFC\u5165 Tailwind CSS \u76F8\u5E94\u7684 CSS \u6837\u5F0F\u3002"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6837\u5F0F\u4EA7\u7269\uFF08\u6B64\u65F6\u662F bundle \u6784\u5EFA\uFF09\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgba(0, 0, 0, var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apply",children:[(0,i.jsx)(n.code,{children:"@apply"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apply",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.a,{href:"https://v2.tailwindcss.com/docs/functions-and-directives#apply",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"@apply"})})," \u6307\u4EE4\uFF0C\u53EF\u4EE5\u901A\u8FC7\u5B83\u5C06 Tailwind CSS \u63D0\u4F9B\u7684\u6837\u5F0F\u5185\u8054\u5230\u6211\u4EEC\u7F16\u5199\u7684\u6837\u5F0F\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@apply"})," \u53EF\u4EE5\u7528\u4E8E CSS\u3001Less\u3001Sass \u4E2D\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".btn {\n @apply font-bold py-2 px-4 rounded;\n}\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F46\u662F\u4F7F\u7528\u8FC7\u7A0B\u4E2D\uFF0C\u5BF9\u4E8E Less \u548C Sass \u6709\u4E9B\u60C5\u51B5\u9700\u8981\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.h4,{id:"sass",children:["Sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5C06 Tailwind \u4E0E Sass \u4E00\u8D77\u4F7F\u7528\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"@apply"})," \u540E\u9762\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"!important"})," \u7684\u65F6\u5019\uFF0C\u9700\u8981\u4F7F\u7528\u63D2\u503C\u6765\u8BA9 Sass \u6B63\u786E\u7F16\u8BD1\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4E0D\u80FD\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 !important;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u80FD\u591F\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 #{!important};\n}\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"less",children:["Less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4E0E Less \u4E00\u8D77\u4F7F\u7528 Tailwind \u65F6\uFF0C\u4F60\u4E0D\u80FD\u5D4C\u5957 Tailwind \u7684 ",(0,i.jsx)(n.code,{children:"@screen"})," \u6307\u4EE4\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4E0D\u80FD\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",children:".card {\n @apply rounded-none;\n\n @screen sm {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u76F8\u53CD\uFF0C\u4F7F\u7528\u5E38\u89C4\u7684\u5A92\u4F53\u67E5\u8BE2\u548C ",(0,i.jsx)(n.code,{children:"theme()"})," \u51FD\u6570\u6765\u5F15\u7528\u4F60\u7684\u5C4F\u5E55\u5C3A\u5BF8\uFF0C\u6216\u8005\u5E72\u8106\u4E0D\u8981\u5D4C\u5957\u4F60\u7684 ",(0,i.jsx)(n.code,{children:"@screen"})," \u6307\u4EE4\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="\u65B9\u6CD5\u4E00"',children:"// Use a regular media query and theme()\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="\u65B9\u6CD5\u4E8C"',children:"// Use the @screen directive at the top-level\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",children:["\u5173\u4E8E ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5173\u4E8E-designsystem-\u914D\u7F6E",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"designSystem"})," \u662F Modern.js Module \u4E2D\u5E9F\u5F03\u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4ECE Modern.js Module v2.33.0 \u7248\u672C\u5F00\u59CB\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u9879\u6765\u4EE3\u66FF ",(0,i.jsx)(n.code,{children:"designSystem"}),"\uFF0C\u4E0D\u518D\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u62C6\u5206\u5E76\u8BBE\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u65E7\u7248\u672C\u7528\u6CD5\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"const { theme, ...rest } = tailwindConfig;\n\nexport default {\n style: {\n tailwindcss: rest,\n },\n designSystem: theme,\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5F53\u524D\u7248\u672C\u7528\u6CD5\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: tailwindConfig,\n },\n};\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fbest-practices%2Fuse-tailwindcss.mdx"]={toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3},{text:"`@apply`",id:"apply",depth:3},{text:"Sass",id:"sass",depth:4},{text:"Less",id:"less",depth:4},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2}],title:"\u4F7F\u7528 Tailwind CSS",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 5269.379402a1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5269"],{44605:function(e,n,s){"use strict";s.r(n);var i=s("39980"),d=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",div:"div",h3:"h3",ul:"ul",strong:"strong",h4:"h4"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"\u4F7F\u7528-tailwind-css",children:["\u4F7F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u662F\u4E00\u4E2A\u4EE5 Utility Class \u4E3A\u57FA\u7840\u7684 CSS \u6846\u67B6\u548C\u8BBE\u8BA1\u7CFB\u7EDF\uFF0C\u53EF\u4EE5\u5FEB\u901F\u5730\u4E3A\u7EC4\u4EF6\u6DFB\u52A0\u5E38\u7528\u6837\u5F0F\uFF0C\u540C\u65F6\u652F\u6301\u4E3B\u9898\u6837\u5F0F\u7684\u7075\u6D3B\u6269\u5C55\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u652F\u6301\u4F7F\u7528 Tailwind CSS \u5F00\u53D1\u7EC4\u4EF6\u6837\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 Modern.js Module \u4E2D\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"\uFF0C\u4F60\u53EA\u9700\u8981\u6309\u7167\u4EE5\u4E0B\u6B65\u9AA4\u64CD\u4F5C\uFF1A"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6267\u884C ",(0,i.jsx)(n.code,{children:"pnpm run new"}),"\uFF0C\u6309\u7167\u5982\u4E0B\u8FDB\u884C\u9009\u62E9\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-text",children:"? \u8BF7\u9009\u62E9\u4F60\u60F3\u8981\u7684\u64CD\u4F5C \u542F\u7528\u53EF\u9009\u529F\u80FD\n? \u8BF7\u9009\u62E9\u529F\u80FD\u540D\u79F0 \u542F\u7528 \u300CTailwind CSS\u300D \u652F\u6301\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6210\u529F\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230 ",(0,i.jsx)(n.code,{children:"package.json"})," \u4E2D\u65B0\u589E\u4E86 ",(0,i.jsx)(n.code,{children:"tailwindcss"})," \u548C ",(0,i.jsx)(n.code,{children:"@modern-js/plugin-tailwindcss"})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u4E2D\u6CE8\u518C Tailwind \u63D2\u4EF6:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';\n\nexport default defineConfig({\n plugins: [..., tailwindcssPlugin()],\n});\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsxs)(n.li,{children:["\u521B\u5EFA ",(0,i.jsx)(n.code,{children:"index.css"})," \u6587\u4EF6\uFF0C\u6DFB\u52A0\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="index.css"',children:"/* base \u548C components \u662F\u53EF\u9009\u7684\uFF0C\u8BF7\u914C\u60C5\u6DFB\u52A0 */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6839\u636E\u9700\u6C42\u4E0D\u540C\uFF0C\u4F60\u53EF\u4EE5\u9009\u62E9\u6027\u5730\u5BFC\u5165 Tailwind CSS \u63D0\u4F9B\u7684 CSS \u6837\u5F0F\u3002\u8BF7\u53C2\u8003 ",(0,i.jsxs)(n.a,{href:"https://tailwindcss.com/docs/functions-and-directives#tailwind",target:"_blank",rel:"noopener noreferrer",children:[(0,i.jsx)(n.code,{children:"@tailwind"})," \u6587\u6863"]})," \u6765\u4E86\u89E3 ",(0,i.jsx)(n.code,{children:"@tailwind"})," \u6307\u4EE4\u7684\u8BE6\u7EC6\u7528\u6CD5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"4",children:["\n",(0,i.jsxs)(n.li,{children:["\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"index.css"})," \u6587\u4EF6\uFF0C\u6BD4\u5982\u5728\u5165\u53E3\u7684 ",(0,i.jsx)(n.code,{children:"src/index.jsx"})," \u6587\u4EF6\u6DFB\u52A0\u5982\u4E0B\u4EE3\u7801\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import './index.css';\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"5",children:["\n",(0,i.jsx)(n.li,{children:"\u7136\u540E\u5373\u53EF\u5728\u5404\u4E2A\u7EC4\u4EF6\u4E2D\u4F7F\u7528 Tailwind CSS \u63D0\u4F9B\u7684 Utility Class \u4E86\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",children:'const Hello = () => (\n
                  \n

                  hello world

                  \n
                  \n);\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"\u914D\u7F6E-tailwind-css",children:["\u914D\u7F6E Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E-tailwind-css",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u6709\u4E24\u79CD\u65B9\u5F0F\u6765\u914D\u7F6E Tailwind CSS\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\uFF0C\u8BE5\u7528\u6CD5\u4E0E Tailwind CSS \u7684\u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:'"Tailwind CSS - Configuration"'})," \u6765\u4E86\u89E3\u66F4\u591A\u7528\u6CD5\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="tailwind.config.ts"',children:"import type { Config } from 'tailwindcss';\n\nexport default {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n} as Config;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u8BF7\u5347\u7EA7 Modern.js Module \u5230 >= 2.33.0 \u7248\u672C\uFF0C\u4EE5\u652F\u6301\u81EA\u52A8\u8BFB\u53D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:["\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styletailwindcss",children:"style.tailwindcss"})," \u914D\u7F6E\u9879\uFF0C\u8FD9\u662F\u65E7\u7248\u672C\u7684\u7528\u6CD5\uFF0C\u6211\u4EEC\u66F4\u63A8\u8350\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u8FDB\u884C\u914D\u7F6E\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: {\n content: ['./src/**/*.{js,jsx,ts,tsx}'],\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"tailwind-css-\u81EA\u52A8\u8865\u5168",children:["Tailwind CSS \u81EA\u52A8\u8865\u5168",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-\u81EA\u52A8\u8865\u5168",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u5B98\u65B9\u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," \u63D2\u4EF6\uFF0C\u7528\u4E8E\u5728 VS Code \u4E2D\u81EA\u52A8\u8865\u5168 Tailwind CSS \u7684 class names\u3001CSS functions \u548C directives\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F60\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u6B65\u9AA4\u6765\u542F\u52A8\u81EA\u52A8\u8865\u5168\u529F\u80FD\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 VS Code \u4E2D\u5B89\u88C5 ",(0,i.jsx)(n.a,{href:"https://github.com/tailwindlabs/tailwindcss-intellisense",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS IntelliSense"})," \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u9879\u76EE\u7684\u6839\u76EE\u5F55\u6CA1\u6709 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u521B\u5EFA\u8BE5\u6587\u4EF6\uFF0C\u5E76\u5199\u5165\u5F53\u524D\u9879\u76EE\u7684 Tailwind CSS \u914D\u7F6E\uFF0C\u5426\u5219 IDE \u63D2\u4EF6\u5C06\u65E0\u6CD5\u6B63\u786E\u751F\u6548\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u6784\u5EFA\u6A21\u5F0F",children:["\u6784\u5EFA\u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u4F7F\u7528 Tailwind CSS \u65F6\uFF0C\u8BF7\u6CE8\u610F\u6784\u5EFA\u4EA7\u7269\u5728 bundle \u548C bundleless \u4E24\u79CD\u6A21\u5F0F\u4E0B\u4F1A\u6709\u5F88\u5927\u533A\u522B\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5173\u4E8E bundle \u548C bundleless \u7684\u5B9A\u4E49\uFF0C\u53EF\u4EE5\u67E5\u770B ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u300C\u6DF1\u5165\u7406\u89E3\u6784\u5EFA\u300D"}),"\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"bundle-\u6A21\u5F0F",children:["Bundle \u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle-\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Bundle \u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u751F\u6210\u4E00\u4EFD\u5355\u72EC\u7684\u4EA7\u7269 CSS \u6587\u4EF6\uFF0C\u5E76\u4E14 JS \u4EA7\u7269\u4E0D\u4F1A\u81EA\u52A8\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"// src/index.tsx\nimport { jsx } from 'react/jsx-runtime';\nvar src_default = () => {\n return /* @__PURE__ */ jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n};\nexport { src_default as default };\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u5C06\u6837\u5F0F\u6CE8\u5165 JS \u4EA7\u7269\u4E2D\uFF0C\u53EF\u4EE5\u5F00\u542F ",(0,i.jsx)(n.a,{href:"/api/config/build-config#styleinject",children:"style.inject"})," \u9009\u9879\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u6CA1\u6709\u5F00\u542F ",(0,i.jsx)(n.code,{children:"style.inject"}),"\uFF0C\u90A3\u4E48\u4E5F\u53EF\u4EE5\u8BA9\u7528\u6237\u624B\u52A8\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'your-package/dist/es/index.css';\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"bundleless-\u6A21\u5F0F",children:["Bundleless \u6A21\u5F0F",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundleless-\u6A21\u5F0F",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728 Bundleless \u6A21\u5F0F\u4E0B\uFF0C\u9ED8\u8BA4\u4F1A\u5F15\u7528\u4EA7\u7269 CSS \u6587\u4EF6\uFF0C\u65E0\u987B\u8FDB\u884C\u989D\u5916\u5904\u7406\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/es/index.js"',children:"import { jsx as _jsx } from 'react/jsx-runtime';\nimport './index.css';\nexport default () =>\n /* @__PURE__ */ _jsx('div', {\n className: 'bg-black',\n children: 'hello world',\n });\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u7C7B\u540D\u524D\u7F00",children:["\u7C7B\u540D\u524D\u7F00",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u540D\u524D\u7F00",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7 Tailwind CSS \u63D0\u4F9B\u7684 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration#prefix",target:"_blank",rel:"noopener noreferrer",children:"prefix"})," \u9009\u9879\u6765\u6DFB\u52A0\u7C7B\u540D\u524D\u7F00\uFF0C\u8FD9\u6837\u53EF\u4EE5\u907F\u514D\u6F5C\u5728\u7684\u7C7B\u540D\u51B2\u7A81\u95EE\u9898\uFF08\u6BD4\u5982 App \u548C Module \u4F7F\u7528\u4E86\u4E0D\u540C\u7248\u672C\u7684 Tailwind CSS\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"prefix"})," \u9009\u9879\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"foo-"})," \u524D\u7F00\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="tailwind.config.js"',children:"module.exports = {\n prefix: 'foo-',\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6E90\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".foo-bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u7528\u6CD5\u4ECB\u7ECD",children:["\u7528\u6CD5\u4ECB\u7ECD",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7528\u6CD5\u4ECB\u7ECD",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E9B Tailwind CSS \u7684\u7528\u6CD5\u793A\u4F8B\u3002"}),"\n",(0,i.jsxs)(n.h3,{id:"html-\u7C7B\u540D",children:["HTML \u7C7B\u540D",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#html-\u7C7B\u540D",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u652F\u6301\u5728 HTML \u6807\u7B7E\u4E0A\u901A\u8FC7\u7C7B\u540D\u7684\u65B9\u5F0F\u589E\u52A0\u6837\u5F0F\u3002",(0,i.jsx)(n.strong,{children:"\u5F53\u4F7F\u7528 HTML \u7C7B\u540D\u7684\u65F6\u5019\uFF0C\u8BF7\u6CE8\u610F\u5FC5\u987B\u8981\u63D0\u524D\u5BFC\u5165 Tailwind CSS \u76F8\u5E94\u7684 CSS \u6837\u5F0F\u3002"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import './index.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6837\u5F0F\u4EA7\u7269\uFF08\u6B64\u65F6\u662F bundle \u6784\u5EFA\uFF09\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:".bg-black {\n --tw-bg-opacity: 1;\n background-color: rgba(0, 0, 0, var(--tw-bg-opacity));\n}\n/** some more... */\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"apply",children:[(0,i.jsx)(n.code,{children:"@apply"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apply",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Tailwind CSS \u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.a,{href:"https://v2.tailwindcss.com/docs/functions-and-directives#apply",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"@apply"})})," \u6307\u4EE4\uFF0C\u53EF\u4EE5\u901A\u8FC7\u5B83\u5C06 Tailwind CSS \u63D0\u4F9B\u7684\u6837\u5F0F\u5185\u8054\u5230\u6211\u4EEC\u7F16\u5199\u7684\u6837\u5F0F\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"@apply"})," \u53EF\u4EE5\u7528\u4E8E CSS\u3001Less\u3001Sass \u4E2D\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".btn {\n @apply font-bold py-2 px-4 rounded;\n}\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F46\u662F\u4F7F\u7528\u8FC7\u7A0B\u4E2D\uFF0C\u5BF9\u4E8E Less \u548C Sass \u6709\u4E9B\u60C5\u51B5\u9700\u8981\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.h4,{id:"sass",children:["Sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5C06 Tailwind \u4E0E Sass \u4E00\u8D77\u4F7F\u7528\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"@apply"})," \u540E\u9762\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"!important"})," \u7684\u65F6\u5019\uFF0C\u9700\u8981\u4F7F\u7528\u63D2\u503C\u6765\u8BA9 Sass \u6B63\u786E\u7F16\u8BD1\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4E0D\u80FD\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 !important;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u80FD\u591F\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sass",children:".alert {\n @apply bg-red-500 #{!important};\n}\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"less",children:["Less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4E0E Less \u4E00\u8D77\u4F7F\u7528 Tailwind \u65F6\uFF0C\u4F60\u4E0D\u80FD\u5D4C\u5957 Tailwind \u7684 ",(0,i.jsx)(n.code,{children:"@screen"})," \u6307\u4EE4\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u4E0D\u80FD\u6B63\u5E38\u5DE5\u4F5C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",children:".card {\n @apply rounded-none;\n\n @screen sm {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u76F8\u53CD\uFF0C\u4F7F\u7528\u5E38\u89C4\u7684\u5A92\u4F53\u67E5\u8BE2\u548C ",(0,i.jsx)(n.code,{children:"theme()"})," \u51FD\u6570\u6765\u5F15\u7528\u4F60\u7684\u5C4F\u5E55\u5C3A\u5BF8\uFF0C\u6216\u8005\u5E72\u8106\u4E0D\u8981\u5D4C\u5957\u4F60\u7684 ",(0,i.jsx)(n.code,{children:"@screen"})," \u6307\u4EE4\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="\u65B9\u6CD5\u4E00"',children:"// Use a regular media query and theme()\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-less",meta:'title="\u65B9\u6CD5\u4E8C"',children:"// Use the @screen directive at the top-level\n.card {\n @apply rounded-none;\n\n @media (min-width: theme('screens.sm')) {\n @apply rounded-lg;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",children:["\u5173\u4E8E ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5173\u4E8E-designsystem-\u914D\u7F6E",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"designSystem"})," \u662F Modern.js Module \u4E2D\u5E9F\u5F03\u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4ECE Modern.js Module v2.33.0 \u7248\u672C\u5F00\u59CB\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u9879\u6765\u4EE3\u66FF ",(0,i.jsx)(n.code,{children:"designSystem"}),"\uFF0C\u4E0D\u518D\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u62C6\u5206\u5E76\u8BBE\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u65E7\u7248\u672C\u7528\u6CD5\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"const { theme, ...rest } = tailwindConfig;\n\nexport default {\n style: {\n tailwindcss: rest,\n },\n designSystem: theme,\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5F53\u524D\u7248\u672C\u7528\u6CD5\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default {\n style: {\n tailwindcss: tailwindConfig,\n },\n};\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fbest-practices%2Fuse-tailwindcss.mdx"]={toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3},{text:"`@apply`",id:"apply",depth:3},{text:"Sass",id:"sass",depth:4},{text:"Less",id:"less",depth:4},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2}],title:"\u4F7F\u7528 Tailwind CSS",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7586.184e82bf.js.LICENSE.txt b/modern-js/module-tools/static/js/async/5269.379402a1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/7586.184e82bf.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/5269.379402a1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4273.fb3f085a.js b/modern-js/module-tools/static/js/async/5305.1ac532a7.js similarity index 79% rename from modern-js/module-tools/static/js/async/4273.fb3f085a.js rename to modern-js/module-tools/static/js/async/5305.1ac532a7.js index 053060a684..66d2ad4bc5 100644 --- a/modern-js/module-tools/static/js/async/4273.fb3f085a.js +++ b/modern-js/module-tools/static/js/async/5305.1ac532a7.js @@ -1,2 +1,2 @@ -/*! For license information please see 4273.fb3f085a.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4273"],{15027:function(e,o,t){"use strict";t.r(o);var n=t("39980"),s=t("9580");function _(e){return(0,n.jsx)(n.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(_,{...e})}):_(e)}o.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-storybook.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 5305.1ac532a7.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5305"],{25407:function(e,o,t){"use strict";t.r(o);var n=t("39980"),s=t("9580");function _(e){return(0,n.jsx)(n.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(_,{...e})}):_(e)}o.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-storybook.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5055.7000603c.js.LICENSE.txt b/modern-js/module-tools/static/js/async/5305.1ac532a7.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5055.7000603c.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/5305.1ac532a7.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/538.b354267e.js b/modern-js/module-tools/static/js/async/538.b354267e.js new file mode 100644 index 0000000000..9c51fce60d --- /dev/null +++ b/modern-js/module-tools/static/js/async/538.b354267e.js @@ -0,0 +1,2 @@ +/*! For license information please see 538.b354267e.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["538"],{79130:function(e,o,t){"use strict";t.r(o);var n=t("39980"),s=t("9580");function _(e){return(0,n.jsx)(n.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(_,{...e})}):_(e)}o.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Frelease-module-doc.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7626.2302d513.js.LICENSE.txt b/modern-js/module-tools/static/js/async/538.b354267e.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/7626.2302d513.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/538.b354267e.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5605.f19af8e6.js b/modern-js/module-tools/static/js/async/5605.f19af8e6.js deleted file mode 100644 index 32e28e632f..0000000000 --- a/modern-js/module-tools/static/js/async/5605.f19af8e6.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 5605.f19af8e6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5605"],{48672:function(e,n,t){"use strict";t.r(n);var o=t("39980"),s=t("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Fpublish-emo.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5800.88e53b08.js b/modern-js/module-tools/static/js/async/5800.88e53b08.js new file mode 100644 index 0000000000..acedd9542a --- /dev/null +++ b/modern-js/module-tools/static/js/async/5800.88e53b08.js @@ -0,0 +1,2 @@ +/*! For license information please see 5800.88e53b08.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5800"],{91083:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-test.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5102.71057cf8.js.LICENSE.txt b/modern-js/module-tools/static/js/async/5800.88e53b08.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5102.71057cf8.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/5800.88e53b08.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5898.258bd4d1.js b/modern-js/module-tools/static/js/async/5898.258bd4d1.js new file mode 100644 index 0000000000..71b75bb208 --- /dev/null +++ b/modern-js/module-tools/static/js/async/5898.258bd4d1.js @@ -0,0 +1,2 @@ +/*! For license information please see 5898.258bd4d1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5898"],{59168:function(e,o,r){"use strict";r.r(o);var n=r("39980"),s=r("9580");function d(e){let o=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",ul:"ul",li:"li",pre:"pre",ol:"ol",img:"img"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"storybook-\u76F8\u5173\u95EE\u9898",children:["Storybook \u76F8\u5173\u95EE\u9898",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u76F8\u5173\u95EE\u9898",children:"#"})]}),"\n",(0,n.jsxs)(o.h2,{id:"\u652F\u6301-storybook-v7",children:["\u652F\u6301 Storybook v7",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u652F\u6301-storybook-v7",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook v7 \u76EE\u524D\u5DF2\u5168\u9762\u652F\u6301\u5E76\u5DF2\u6210\u4E3A\u6211\u4EEC\u7684\u63A8\u8350\u4F7F\u7528\u7248\u672C\u3002"}),"\n",(0,n.jsxs)(o.h2,{id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",children:["\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Modern.js Module \u76EE\u524D\u4F7F\u7528\u7684 Storybook \u7248\u672C\u662F v6\uFF0C\u5982\u679C\u4F7F\u7528\u4E86 v7 \u7248\u672C\u7684 Addon \u53EF\u80FD\u4F1A\u51FA\u73B0\u63D2\u4EF6\u4E0D\u751F\u6548\u7684\u60C5\u51B5\u3002"}),"\n",(0,n.jsxs)(o.p,{children:["\u9664\u4E86 Addon \u4EE5\u5916\uFF0C\u5176\u4ED6\u914D\u7F6E\u4E5F\u53EF\u80FD\u4F1A\u6709\u533A\u522B\u3002\u6BD4\u5982\u4FEE\u6539 ",(0,n.jsx)(o.code,{children:"preview.js"})," \u914D\u7F6E\u6587\u4EF6\u7684\u8BDD\uFF0CStorybook v6 \u4E0E v7 \u7684\u5199\u6CD5\u4E5F\u4E0D\u76F8\u540C\uFF1A"]}),"\n",(0,n.jsxs)(o.ul,{children:["\n",(0,n.jsxs)(o.li,{children:["v6\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/6.5/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u94FE\u63A5"})]}),"\n",(0,n.jsxs)(o.li,{children:["v7\uFF1A",(0,n.jsx)(o.a,{href:"https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u94FE\u63A5"})]}),"\n"]}),"\n",(0,n.jsxs)(o.h2,{id:"cannot-find-module-react-dompackagejson",children:["Cannot find module 'react-dom/package.json'",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#cannot-find-module-react-dompackagejson",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"\u5728\u6267\u884C Storybook \u8C03\u8BD5\u7684\u65F6\u5019\uFF0C\u51FA\u73B0\u4E0B\u9762\u7684\u62A5\u9519\u63D0\u793A\uFF1A"}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-bash",children:"ERR! Error: Cannot find module 'react-dom/package.json'\n"})}),"\n",(0,n.jsxs)(o.p,{children:["\u89E3\u51B3\u529E\u6CD5\uFF1A\u5728\u9879\u76EE\u4E2D\u5B89\u88C5 ",(0,n.jsx)(o.code,{children:"react-dom"})," \u4F9D\u8D56\u3002"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-json",children:'{\n "devDependencies": {\n "react-dom": "^17"\n }\n}\n'})}),"\n",(0,n.jsxs)(o.h2,{id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",children:["\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"\u89E3\u51B3\u529E\u6CD5\uFF1A"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["\u627E\u5230 ",(0,n.jsx)(o.code,{children:"@storybook/core-server/dist/cjs/dev-server.js"})]}),"\n",(0,n.jsxs)(o.li,{children:["\u627E\u5230 ",(0,n.jsx)(o.code,{children:"var _await$Promise$all = await Promise.all([preview, manager"})," \u8FD9\u9644\u8FD1\u7684\u4EE3\u7801\u3002"]}),"\n",(0,n.jsx)(o.li,{children:"\u4FEE\u6539\u6210\uFF1A"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"var _await$Promise$all = await Promise.all([\n preview.catch(e => console.info(e)),\n manager // TODO #13083 Restore this when compiling the preview is fast enough\n // .then((result) => {\n // if (!options.ci && !options.smokeTest) openInBrowser(address);\n // return result;\n // })\n .catch(previewBuilder.bail)]),\n _await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),\n previewResult = _await$Promise$all2[0],\n managerResult = _await$Promise$all2[1]; // TODO #13083 Remove this when compiling the preview is fast enough\n"})}),"\n",(0,n.jsxs)(o.h2,{id:"couldnt-find-any-stories-is-your-storybook",children:["Couldn't find any stories is your Storybook",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#couldnt-find-any-stories-is-your-storybook",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/shylnyhaeh7uldvivhn/screenshot-20230703-162111.png",alt:"storybook-error"})}),"\n",(0,n.jsx)(o.p,{children:"\u5F53\u5728\u9884\u89C8\u533A\u57DF\u770B\u5230\u7C7B\u4F3C\u8FD9\u6837\u7684\u62A5\u9519\u63D0\u793A\u7684\u65F6\u5019\uFF0C\u9996\u5148\u53EF\u4EE5\u6253\u5F00\u4E00\u4E0B\u6D4F\u89C8\u5668\u7684\u63A7\u5236\u53F0\uFF0C\u5E94\u8BE5\u4F1A\u6709\u4E9B\u62A5\u9519\u4FE1\u606F\u3002\u53EF\u4EE5\u5148\u6839\u636E\u62A5\u9519\u4FE1\u606F\u6765\u63A8\u65AD\u662F\u4E0D\u662F\u7F16\u5199\u4EE3\u7801\u91CC\u51FA\u73B0\u7684\u95EE\u9898\u5BFC\u81F4 Storybook \u65E0\u6CD5\u6B63\u5E38\u8FD0\u884C\u3002\u4FEE\u590D\u540E\uFF0C\u518D\u6B21\u5237\u65B0\u67E5\u770B\u662F\u5426\u6B63\u5E38\u3002"}),"\n",(0,n.jsxs)(o.h2,{id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",children:["Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"Storybook \u6CA1\u6709\u63D0\u4F9B\u76F8\u5173\u65B9\u6848\uFF0C\u4E0D\u8FC7 Storybook Issue \u4E2D\u6709\u627E\u5230\u76F8\u5173\u7684\u89E3\u51B3\u529E\u6CD5\u3002\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\uFF1A"}),"\n",(0,n.jsxs)(o.ol,{children:["\n",(0,n.jsxs)(o.li,{children:["\u6DFB\u52A0 ",(0,n.jsx)(o.code,{children:"config/storybook/middleware.js"})," \u6587\u4EF6\uFF0C\u5E76\u521D\u59CB\u5316\u4E0B\u9762\u7684\u5185\u5BB9\uFF1A"]}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:"/* eslint-disable filenames/match-exported */\nmodule.exports = function expressMiddleware(router) {\n // router is express router\n // import { Router } from 'express'\n // router = new Router();\n};\n"})}),"\n",(0,n.jsxs)(o.ol,{start:"2",children:["\n",(0,n.jsx)(o.li,{children:"\u6DFB\u52A0 http-proxy-middleware \u4F9D\u8D56"}),"\n",(0,n.jsx)(o.li,{children:"\u6DFB\u52A0\u4EE3\u7406\u8DEF\u7531\u76F8\u5173\u914D\u7F6E"}),"\n"]}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:'/* eslint-disable filenames/match-exported */\nconst { createProxyMiddleware } = require("http-proxy-middleware");\n\nmodule.exports = function expressMiddleware (router) {\n router.use(\'/api\', createProxyMiddleware({\n target: "http://localhost:8000",\n changeOrigin: true\n }))\n}\n'})}),"\n",(0,n.jsxs)(o.p,{children:["\u76F8\u5173 issue \u94FE\u63A5\uFF1A",(0,n.jsx)(o.a,{href:"https://github.com/storybookjs/storybook/issues/11551",target:"_blank",rel:"noopener noreferrer",children:"#11551"}),"\u3002"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}o.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fstorybook.mdx"]={toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2}],title:"Storybook \u76F8\u5173\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5110.6bd38ea0.js.LICENSE.txt b/modern-js/module-tools/static/js/async/5898.258bd4d1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5110.6bd38ea0.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/5898.258bd4d1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3253.c0c5fd3c.js b/modern-js/module-tools/static/js/async/6051.9006d708.js similarity index 97% rename from modern-js/module-tools/static/js/async/3253.c0c5fd3c.js rename to modern-js/module-tools/static/js/async/6051.9006d708.js index f25759652a..9ebee0af80 100644 --- a/modern-js/module-tools/static/js/async/3253.c0c5fd3c.js +++ b/modern-js/module-tools/static/js/async/6051.9006d708.js @@ -1,2 +1,2 @@ -/*! For license information please see 3253.c0c5fd3c.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3253"],{98069:function(e,n,l){"use strict";l.r(n);var i=l("39980"),o=l("9580"),s=l("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"polyfill-plugin",children:["Polyfill Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#polyfill-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Normally, we don't need to inject polyfill for npm packages, this step should be done on the web application framework side, but in some scenarios we need to inject polyfill in order to make our library run directly in low version browsers."}),"\n",(0,i.jsxs)(n.p,{children:["Note that this plugin does not transform your code syntax, it only injects polyfill for unsupported functions used in your code, importing them as normal functions instead of polluting the global. You need to install the ",(0,i.jsx)(n.code,{children:"core-js-pure"})," dependency."]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-polyfill -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginPolyfill()],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can also configure registration via hooks, for example,\nif you have multiple build configurations at the same time and only need to inject the polyfill when bundle:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getPolyfillHook } from '@modern-js/plugin-module-polyfill';\n\nconst polyfillHook = getPolyfillHook();\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n buildType: 'bundle',\n hooks: [polyfillHook],\n },\n {\n buildType: 'bundleless',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"config",children:["Config",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"Type"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type options = {\n targets?: Record | string;\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"targets",children:["targets",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#targets",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["See ",(0,i.jsx)(n.a,{href:"https://babeljs.io/docs/options#targets",target:"_blank",rel:"noopener noreferrer",children:"Babel target"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"This is a example."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginPolyfill({\n targets: '> 0.25%, not dead',\n }),\n ],\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-polyfill.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Config",id:"config",depth:2},{text:"targets",id:"targets",depth:3}],title:"Polyfill Plugin",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 6051.9006d708.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6051"],{53692:function(e,n,l){"use strict";l.r(n);var i=l("39980"),o=l("9580"),s=l("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"polyfill-plugin",children:["Polyfill Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#polyfill-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Normally, we don't need to inject polyfill for npm packages, this step should be done on the web application framework side, but in some scenarios we need to inject polyfill in order to make our library run directly in low version browsers."}),"\n",(0,i.jsxs)(n.p,{children:["Note that this plugin does not transform your code syntax, it only injects polyfill for unsupported functions used in your code, importing them as normal functions instead of polluting the global. You need to install the ",(0,i.jsx)(n.code,{children:"core-js-pure"})," dependency."]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-polyfill -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginPolyfill()],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can also configure registration via hooks, for example,\nif you have multiple build configurations at the same time and only need to inject the polyfill when bundle:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getPolyfillHook } from '@modern-js/plugin-module-polyfill';\n\nconst polyfillHook = getPolyfillHook();\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n buildType: 'bundle',\n hooks: [polyfillHook],\n },\n {\n buildType: 'bundleless',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"config",children:["Config",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"Type"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type options = {\n targets?: Record | string;\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"targets",children:["targets",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#targets",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["See ",(0,i.jsx)(n.a,{href:"https://babeljs.io/docs/options#targets",target:"_blank",rel:"noopener noreferrer",children:"Babel target"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"This is a example."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginPolyfill({\n targets: '> 0.25%, not dead',\n }),\n ],\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-polyfill.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Config",id:"config",depth:2},{text:"targets",id:"targets",depth:3}],title:"Polyfill Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8773.66b5f0c8.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6051.9006d708.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8773.66b5f0c8.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6051.9006d708.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6111.89a3f56e.js b/modern-js/module-tools/static/js/async/6111.89a3f56e.js deleted file mode 100644 index 265322131d..0000000000 --- a/modern-js/module-tools/static/js/async/6111.89a3f56e.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 6111.89a3f56e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6111"],{13207:function(e,o,t){"use strict";t.r(o);var n=t("39980"),s=t("9580");function _(e){return(0,n.jsx)(n.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,s.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(_,{...e})}):_(e)}o.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Frelease-module-doc.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6844.b821cee1.js b/modern-js/module-tools/static/js/async/6167.59abe9e8.js similarity index 97% rename from modern-js/module-tools/static/js/async/6844.b821cee1.js rename to modern-js/module-tools/static/js/async/6167.59abe9e8.js index c2b0805dff..3579e68dc4 100644 --- a/modern-js/module-tools/static/js/async/6844.b821cee1.js +++ b/modern-js/module-tools/static/js/async/6167.59abe9e8.js @@ -1,2 +1,2 @@ -/*! For license information please see 6844.b821cee1.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6844"],{75534:function(e,o,n){"use strict";n.r(o);var r=n("39980"),t=n("9580");function s(e){let o=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",strong:"strong",code:"code"},(0,t.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.h1,{id:"welcome-to-modernjs-module",children:["Welcome to Modern.js Module",(0,r.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#welcome-to-modernjs-module",children:"#"})]}),"\n",(0,r.jsx)(o.p,{children:"Modern.js Module is a modules engineering solution for Modern.js, as well as a core dependency. It allows developers to build, debug, and publish module type project more easily. A module type project can mostly be thought of as an npm package type project, which may be a component, component library or tool library project."}),"\n",(0,r.jsx)(o.p,{children:"If you are planning to develop a project of the npm package type, then you came to the right place! Modern.js provides a professional Modern.js Module. It gives you:"}),"\n",(0,r.jsxs)(o.ul,{children:["\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Simple project initialization"}),": simply execute the ",(0,r.jsx)(o.code,{children:"npx @modern-js/create project-dir"})," command, followed by a few interactive questions, to create a complete module type project. The created project also supports the choice of two package managers, ",(0,r.jsx)(o.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(o.strong,{children:"pnpm"})})," and ",(0,r.jsx)(o.a,{href:"https://classic.yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(o.strong,{children:"Yarn"})}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Code formatting"}),": In Modern.js Module, you can execute ",(0,r.jsx)(o.code,{children:"modern lint"})," to format the code. The initialized module project includes the ",(0,r.jsx)(o.a,{href:"https://eslint.org/docs/latest/user-guide/core-concepts#what-is-eslint",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," ruleset for Modern.js for most scenarios."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Comprehensive build capabilities and faster builds"}),": Modern.js Module provides high-performance build capabilities based on ",(0,r.jsx)(o.a,{href:"https://esbuild.github.io/getting-started/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," and ",(0,r.jsx)(o.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"}),", and provides rich configurations for different build scenarios."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Storybook debugging tools"}),": Modern.js Module provides ",(0,r.jsx)(o.a,{href:"https://storybook.js.org/",target:"_blank",rel:"noopener noreferrer",children:"Storybook"})," debugging tools for debugging module projects. After installing the Storybook plugin for Modern.js Module, you can start it with the ",(0,r.jsx)(o.code,{children:"storybook dev"})," command. You can use Storybook not only for debugging components, but also for other types of modules."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Testing capabilities with Jest"}),": When you need to test a module, you can use the ",(0,r.jsx)(o.code,{children:"modern test"})," command of Modern.js Module, which not only integrates with ",(0,r.jsx)(o.a,{href:"https://jestjs.io/",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),", but also provides an API for configuring ",(0,r.jsx)(o.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Versioning based on Changesets"}),": When you need to record changes to a project, you can use the ",(0,r.jsx)(o.code,{children:"modern change"})," command to generate a Markdown file containing the changes; when you need to upgrade a project, you can use the ",(0,r.jsx)(o.code,{children:"modern bump"})," command to analyze and upgrade the version through the Markdown file; when you need to release a project, you can use the ",(0,r.jsx)(o.code,{children:"modern release"})," command to release the project; Modern.js Module implements these commands based on ",(0,r.jsx)(o.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"Changesets"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Extensible plugin mechanism"}),": Want to integrate additional debugging tools for your project? Or maybe you want to do some extra processing during the build process, Modern.js Module provides a plugin mechanism and plugin hooks that cover both the ",(0,r.jsx)(o.code,{children:"dev"})," command and the ",(0,r.jsx)(o.code,{children:"build"})," command process. You can use them to extend the capabilities of your project."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Lots more!"})," Modern.js Module will continue to optimize its build and debug features in the future. If there are important issues to be solved in module project building, or if a mainstream module project debugging tool or pattern emerges, then they will probably be supported by Modern.js Module."]}),"\n"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,t.ah)(),e.components);return o?(0,r.jsx)(o,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}o.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fwelcome.md"]={toc:[],title:"Welcome to Modern.js Module",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 6167.59abe9e8.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6167"],{98571:function(e,o,n){"use strict";n.r(o);var r=n("39980"),t=n("9580");function s(e){let o=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",strong:"strong",code:"code"},(0,t.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.h1,{id:"welcome-to-modernjs-module",children:["Welcome to Modern.js Module",(0,r.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#welcome-to-modernjs-module",children:"#"})]}),"\n",(0,r.jsx)(o.p,{children:"Modern.js Module is a modules engineering solution for Modern.js, as well as a core dependency. It allows developers to build, debug, and publish module type project more easily. A module type project can mostly be thought of as an npm package type project, which may be a component, component library or tool library project."}),"\n",(0,r.jsx)(o.p,{children:"If you are planning to develop a project of the npm package type, then you came to the right place! Modern.js provides a professional Modern.js Module. It gives you:"}),"\n",(0,r.jsxs)(o.ul,{children:["\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Simple project initialization"}),": simply execute the ",(0,r.jsx)(o.code,{children:"npx @modern-js/create project-dir"})," command, followed by a few interactive questions, to create a complete module type project. The created project also supports the choice of two package managers, ",(0,r.jsx)(o.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(o.strong,{children:"pnpm"})})," and ",(0,r.jsx)(o.a,{href:"https://classic.yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(o.strong,{children:"Yarn"})}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Code formatting"}),": In Modern.js Module, you can execute ",(0,r.jsx)(o.code,{children:"modern lint"})," to format the code. The initialized module project includes the ",(0,r.jsx)(o.a,{href:"https://eslint.org/docs/latest/user-guide/core-concepts#what-is-eslint",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," ruleset for Modern.js for most scenarios."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Comprehensive build capabilities and faster builds"}),": Modern.js Module provides high-performance build capabilities based on ",(0,r.jsx)(o.a,{href:"https://esbuild.github.io/getting-started/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," and ",(0,r.jsx)(o.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"}),", and provides rich configurations for different build scenarios."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Storybook debugging tools"}),": Modern.js Module provides ",(0,r.jsx)(o.a,{href:"https://storybook.js.org/",target:"_blank",rel:"noopener noreferrer",children:"Storybook"})," debugging tools for debugging module projects. After installing the Storybook plugin for Modern.js Module, you can start it with the ",(0,r.jsx)(o.code,{children:"storybook dev"})," command. You can use Storybook not only for debugging components, but also for other types of modules."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Testing capabilities with Jest"}),": When you need to test a module, you can use the ",(0,r.jsx)(o.code,{children:"modern test"})," command of Modern.js Module, which not only integrates with ",(0,r.jsx)(o.a,{href:"https://jestjs.io/",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),", but also provides an API for configuring ",(0,r.jsx)(o.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Versioning based on Changesets"}),": When you need to record changes to a project, you can use the ",(0,r.jsx)(o.code,{children:"modern change"})," command to generate a Markdown file containing the changes; when you need to upgrade a project, you can use the ",(0,r.jsx)(o.code,{children:"modern bump"})," command to analyze and upgrade the version through the Markdown file; when you need to release a project, you can use the ",(0,r.jsx)(o.code,{children:"modern release"})," command to release the project; Modern.js Module implements these commands based on ",(0,r.jsx)(o.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"Changesets"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Extensible plugin mechanism"}),": Want to integrate additional debugging tools for your project? Or maybe you want to do some extra processing during the build process, Modern.js Module provides a plugin mechanism and plugin hooks that cover both the ",(0,r.jsx)(o.code,{children:"dev"})," command and the ",(0,r.jsx)(o.code,{children:"build"})," command process. You can use them to extend the capabilities of your project."]}),"\n",(0,r.jsxs)(o.li,{children:[(0,r.jsx)(o.strong,{children:"Lots more!"})," Modern.js Module will continue to optimize its build and debug features in the future. If there are important issues to be solved in module project building, or if a mainstream module project debugging tool or pattern emerges, then they will probably be supported by Modern.js Module."]}),"\n"]})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,t.ah)(),e.components);return o?(0,r.jsx)(o,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}o.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fwelcome.md"]={toc:[],title:"Welcome to Modern.js Module",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5388.a629059c.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6167.59abe9e8.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5388.a629059c.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6167.59abe9e8.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5037.155e45d9.js b/modern-js/module-tools/static/js/async/6201.18880672.js similarity index 90% rename from modern-js/module-tools/static/js/async/5037.155e45d9.js rename to modern-js/module-tools/static/js/async/6201.18880672.js index 25cfc89230..c381e5dd23 100644 --- a/modern-js/module-tools/static/js/async/5037.155e45d9.js +++ b/modern-js/module-tools/static/js/async/6201.18880672.js @@ -1,2 +1,2 @@ -/*! For license information please see 5037.155e45d9.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5037"],{30867:function(e,n,i){"use strict";i.r(n);var t=i("39980"),s=i("9580");function o(e){let n=Object.assign({pre:"pre",code:"code",p:"p"},(0,s.ah)(),e.components);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(o,{...e})}):o(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Fregister-esbuild-plugin.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 6201.18880672.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6201"],{20728:function(e,n,i){"use strict";i.r(n);var t=i("39980"),s=i("9580");function o(e){let n=Object.assign({pre:"pre",code:"code",p:"p"},(0,s.ah)(),e.components);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(o,{...e})}):o(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Fregister-esbuild-plugin.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5562.ad6aae96.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6201.18880672.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5562.ad6aae96.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6201.18880672.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6275.ceb5ba13.js b/modern-js/module-tools/static/js/async/6275.ceb5ba13.js new file mode 100644 index 0000000000..8d7b73708a --- /dev/null +++ b/modern-js/module-tools/static/js/async/6275.ceb5ba13.js @@ -0,0 +1,2 @@ +/*! For license information please see 6275.ceb5ba13.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6275"],{54075:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u5E38\u89C1\u95EE\u9898",children:["\u5E38\u89C1\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5E38\u89C1\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u8FD9\u91CC\u662F Modern.js Module \u5E38\u89C1\u95EE\u9898\u5206\u7C7B\u5217\u8868\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/basic",children:"\u901A\u7528\u7C7B\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/build",children:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/storybook",children:"Storybook \u76F8\u5173\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/test",children:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898"})}),"\n"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Findex.md"]={toc:[],title:"\u5E38\u89C1\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5567.90015958.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6275.ceb5ba13.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5567.90015958.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6275.ceb5ba13.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/638.36ecfdbd.js b/modern-js/module-tools/static/js/async/638.36ecfdbd.js deleted file mode 100644 index f884d8bfe1..0000000000 --- a/modern-js/module-tools/static/js/async/638.36ecfdbd.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 638.36ecfdbd.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["638"],{89769:function(e,n,i){"use strict";i.r(n);var l=i("39980"),s=i("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul"},(0,s.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"quick-start",children:["Quick Start",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"Modern.js Module not only provides a rich set of features, but also supports extending the capabilities of the current project by way of plugins."}),"\n",(0,l.jsx)(n.p,{children:"We can quickly see how to write a Modern.js Module plugin by using the following example."}),"\n",(0,l.jsxs)(n.ol,{children:["\n",(0,l.jsxs)(n.li,{children:["First we create ",(0,l.jsx)(n.code,{children:". /plugins/example.ts"})," file under the initialized project."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-md",meta:'title=". /project"',children:". /project .\n\u251C\u2500\u2500 plugins\n\u2502 \u2514\u2500\u2500 example.ts\n\u251C\u2500\u2500 src/\n\u2514\u2500\u2500 modern.config.ts\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"2",children:["\n",(0,l.jsxs)(n.li,{children:["Next add the code for the plugin to the ",(0,l.jsx)(n.code,{children:"example.ts"})," file."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nexport const ExamplePlugin = (): CliPlugin => {\n return {\n name: 'example',\n setup() {\n console.info('this is example plugin');\n return {\n // use hooks\n afterBuild() {\n console.info('build over');\n },\n };\n },\n };\n};\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"3",children:["\n",(0,l.jsxs)(n.li,{children:["Then we register the plugin we just wrote via the ",(0,l.jsx)(n.a,{href:"/en/api/config/plugins",children:(0,l.jsx)(n.code,{children:"plugins"})})," API."]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",meta:'title=". /modern.config.ts"',children:"import { examplePlugin } from '. /plugins/example';\nexport default defineConfig({\n plugins: [examplePlugin()],\n});\n"})}),"\n",(0,l.jsxs)(n.ol,{start:"4",children:["\n",(0,l.jsxs)(n.li,{children:["Finally, run ",(0,l.jsx)(n.code,{children:"modern build"})," and you will see:"]}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-bash",meta:'title="terminal"',children:"This is example plugin\nBuild succeed: 510.684ms\nbuild over\n"})}),"\n",(0,l.jsx)(n.p,{children:"With the above example, we learned the following things."}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"The recommended plugin directory structure"}),"\n",(0,l.jsx)(n.li,{children:"The initialization code of the plugin"}),"\n",(0,l.jsx)(n.li,{children:"Plugin registration"}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:"In addition to the above, we also need to understand."}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.a,{href:"/en/plugins/guide/plugin-object",children:"plugin objects, type definitions and recommended configuration options"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsxs)(n.a,{href:"/en/plugins/guide/setup-function",children:["setup functions, ",(0,l.jsx)(n.code,{children:"api"})," object parameters, lifecycle hooks"]})}),"\n"]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(t,{...e})}):t(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fgetting-started.mdx"]={toc:[],title:"Quick Start",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6408.2dffc699.js b/modern-js/module-tools/static/js/async/6408.2dffc699.js deleted file mode 100644 index ead84663f9..0000000000 --- a/modern-js/module-tools/static/js/async/6408.2dffc699.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 6408.2dffc699.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6408"],{930:function(e,n,r){"use strict";r.r(n);var s=r("39980"),i=r("9580"),d=r("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",div:"div",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"banner-\u63D2\u4EF6",children:["Banner \u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS \u548C CSS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE ",(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," 2.36.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BE5\u63D2\u4EF6\u529F\u80FD\u5185\u7F6E\u5728 Modern.js Module \u4E2D\uFF0C\u7531 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#banner",children:(0,s.jsx)(n.code,{children:"banner"})})," \u548C ",(0,s.jsx)(n.a,{href:"/api/config/build-config#footer",children:(0,s.jsx)(n.code,{children:"footer"})}),"\n\u914D\u7F6E\u63D0\u4F9B\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(d.SU,{command:"add @modern-js/plugin-module-banner -D"}),"\n",(0,s.jsxs)(n.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBanner } from '@modern-js/plugin-module-banner';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: '//comment',\n css: '/*comment*/',\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u6CE8\u610F\uFF1ACSS \u7684\u6CE8\u91CA\u4E0D\u652F\u6301 ",(0,s.jsx)(n.code,{children:"//comment"})," \u8FD9\u6837\u7684\u5199\u6CD5\u3002\u8BE6\u89C1",(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/zh-CN/docs/Web/CSS/Comments",target:"_blank",rel:"noopener noreferrer",children:"\u300CCSS \u6CE8\u91CA\u300D"}),"\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",children:["\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { modulePluginBanner } from '@modern-js/plugin-module-banner';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: copyRight,\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type BannerOptions = {\n banner: {\n js?: string;\n css?: string;\n };\n footer?: {\n js?: string;\n css?: string;\n };\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"banner",children:["banner",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"banner.js"}),"\uFF1A\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"banner.css"}),"\uFF1A\u5728 CSS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"footer",children:["footer",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"footer.js"}),"\uFF1A\u5728 JS \u6587\u4EF6\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"footer.css"}),"\uFF1A\u5728 CSS \u6587\u4EF6\u5E95\u90E8\u589E\u52A0\u5185\u5BB9\u3002"]}),"\n"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-banner.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"banner",id:"banner",depth:3},{text:"footer",id:"footer",depth:3}],title:"Banner \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8842.64147a1b.js b/modern-js/module-tools/static/js/async/6512.35d7bc4d.js similarity index 98% rename from modern-js/module-tools/static/js/async/8842.64147a1b.js rename to modern-js/module-tools/static/js/async/6512.35d7bc4d.js index 100b520736..ad6aa2d121 100644 --- a/modern-js/module-tools/static/js/async/8842.64147a1b.js +++ b/modern-js/module-tools/static/js/async/6512.35d7bc4d.js @@ -1,2 +1,2 @@ -/*! For license information please see 8842.64147a1b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8842"],{44746:function(e,n,i){"use strict";i.r(n);var o=i("39980"),t=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",pre:"pre",h3:"h3",div:"div",ul:"ul",li:"li"},(0,t.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"setup-function",children:["Setup function",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#setup-function",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["In the ",(0,o.jsx)(n.a,{href:"/plugins/guide/plugin-object",children:'"Plugin object"'})," section we know that the plugin object contains a ",(0,o.jsx)(n.code,{children:"setup"})," function that not only contains an ",(0,o.jsx)(n.code,{children:"api"})," object parameter, but also returns a Hooks object."]}),"\n",(0,o.jsxs)(n.h2,{id:"plugin-api-objects",children:["Plugin API objects",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-api-objects",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"setup"})," function of the plugin will provide an ",(0,o.jsx)(n.code,{children:"api"})," object parameter, and you can call some of the methods provided on this object to get information about the configuration, project context, etc."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup(api) {\n // Get the original configuration of the application\n const config = api.useConfigContext();\n // Get the application runtime context\n const appContext = api.useAppContext();\n // Get the final configuration after resolving\n const resolvedConfig = api.useResolvedConfigContext();\n },\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"apiuseappcontext",children:[(0,o.jsx)(n.code,{children:"api.useAppContext"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseappcontext",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get project context information."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const useAppContext: () => IAppContext;\n\ninterface IAppContext {\n appDirectory: string;\n configFile: string | false;\n packageName: string;\n nodeModulesDirectory: string;\n internalDirectory: string;\n plugins: {\n cli?: any;\n server?: any;\n }[];\n}\n"})}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive info",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:["Through the actual type file, we can see that there are some additional fields. However, for Modern.js Module, the fields mentioned above are the only ones that are meaningful. The same applies to other methods of the ",(0,o.jsx)(n.code,{children:"api"})," object.\n"]})})]}),"\n",(0,o.jsxs)(n.h3,{id:"apiuseresolvedconfigcontext",children:[(0,o.jsx)(n.code,{children:"api.useResolvedConfigContext"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseresolvedconfigcontext",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get the final configuration after parsing."}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive info",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:["If you need to get the build-related final configuration, you need to use the ",(0,o.jsx)(n.code,{children:"beforeBuild"})," Hook.\n"]})})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const useResolvedConfigContext: () => NormalizedConfig;\n\ninterface NormalizedConfig {\n buildConfig: PartialBuildConfig;\n buildPreset: BuildPreset;\n dev: Dev;\n plugins: PluginConfig;\n runtime: RuntimeConfig;\n runtimeByEntries?: RuntimeByEntriesConfig;\n _raw: UserConfig;\n}\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"apiusehookrunners",children:[(0,o.jsx)(n.code,{children:"api.useHookRunners"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiusehookrunners",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get the executors of Hooks and trigger the execution of a specific Hook."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin } from '@modern-js/core';\n\nexport const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n const hookRunners = api.useHookRunners();\n // trigger the afterBuild Hook\n await hookRunners.afterBuild();\n },\n});\n"})}),"\n",(0,o.jsxs)(n.h2,{id:"asynchronous-setup",children:["Asynchronous setup",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asynchronous-setup",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"The setup of a CLI plugin can be an asynchronous function that performs asynchronous logic during the initialization process."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n await doSomething();\n },\n});\n"})}),"\n",(0,o.jsx)(n.p,{children:"Note that the setup function of the next plugin is not executed until the async setup function of the current plugin has finished. Therefore, you should avoid performing time-consuming asynchronous operations in the setup function to avoid slowing down the startup performance of the CLI."}),"\n",(0,o.jsxs)(n.h2,{id:"life-cycle-hooks",children:["Life cycle hooks",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#life-cycle-hooks",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["We know that the ",(0,o.jsx)(n.code,{children:"setup"})," function returns a Hooks object, which can also be understood as an object with Modern.js Module lifecycle hooks."]}),"\n",(0,o.jsx)(n.p,{children:"Currently there are two main types of hooks."}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["build hooks: triggered only when the ",(0,o.jsx)(n.code,{children:"build"})," command is executed to build the source code product."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"buildPlatform"})," hook: triggered only when the ",(0,o.jsx)(n.code,{children:"build --platform"})," command is executed to generate other build artifacts."]}),"\n",(0,o.jsxs)(n.li,{children:["debug hooks: hooks that are triggered when running the ",(0,o.jsx)(n.code,{children:"dev"})," command."]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["See the ",(0,o.jsx)(n.a,{href:"/en/api/plugin-api/plugin-hooks",children:"API documentation"})," for a full list of lifecycle hooks."]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fsetup-function.mdx"]={toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2}],title:"Setup function",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 6512.35d7bc4d.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6512"],{61919:function(e,n,i){"use strict";i.r(n);var o=i("39980"),t=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",pre:"pre",h3:"h3",div:"div",ul:"ul",li:"li"},(0,t.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"setup-function",children:["Setup function",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#setup-function",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["In the ",(0,o.jsx)(n.a,{href:"/plugins/guide/plugin-object",children:'"Plugin object"'})," section we know that the plugin object contains a ",(0,o.jsx)(n.code,{children:"setup"})," function that not only contains an ",(0,o.jsx)(n.code,{children:"api"})," object parameter, but also returns a Hooks object."]}),"\n",(0,o.jsxs)(n.h2,{id:"plugin-api-objects",children:["Plugin API objects",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-api-objects",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"setup"})," function of the plugin will provide an ",(0,o.jsx)(n.code,{children:"api"})," object parameter, and you can call some of the methods provided on this object to get information about the configuration, project context, etc."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup(api) {\n // Get the original configuration of the application\n const config = api.useConfigContext();\n // Get the application runtime context\n const appContext = api.useAppContext();\n // Get the final configuration after resolving\n const resolvedConfig = api.useResolvedConfigContext();\n },\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"apiuseappcontext",children:[(0,o.jsx)(n.code,{children:"api.useAppContext"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseappcontext",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get project context information."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const useAppContext: () => IAppContext;\n\ninterface IAppContext {\n appDirectory: string;\n configFile: string | false;\n packageName: string;\n nodeModulesDirectory: string;\n internalDirectory: string;\n plugins: {\n cli?: any;\n server?: any;\n }[];\n}\n"})}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive info",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:["Through the actual type file, we can see that there are some additional fields. However, for Modern.js Module, the fields mentioned above are the only ones that are meaningful. The same applies to other methods of the ",(0,o.jsx)(n.code,{children:"api"})," object.\n"]})})]}),"\n",(0,o.jsxs)(n.h3,{id:"apiuseresolvedconfigcontext",children:[(0,o.jsx)(n.code,{children:"api.useResolvedConfigContext"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiuseresolvedconfigcontext",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get the final configuration after parsing."}),"\n",(0,o.jsxs)(n.div,{className:"rspress-directive info",children:[(0,o.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,o.jsx)(n.div,{className:"rspress-directive-content",children:(0,o.jsxs)(n.p,{children:["If you need to get the build-related final configuration, you need to use the ",(0,o.jsx)(n.code,{children:"beforeBuild"})," Hook.\n"]})})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const useResolvedConfigContext: () => NormalizedConfig;\n\ninterface NormalizedConfig {\n buildConfig: PartialBuildConfig;\n buildPreset: BuildPreset;\n dev: Dev;\n plugins: PluginConfig;\n runtime: RuntimeConfig;\n runtimeByEntries?: RuntimeByEntriesConfig;\n _raw: UserConfig;\n}\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"apiusehookrunners",children:[(0,o.jsx)(n.code,{children:"api.useHookRunners"}),(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiusehookrunners",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Used to get the executors of Hooks and trigger the execution of a specific Hook."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"import type { CliPlugin } from '@modern-js/core';\n\nexport const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n const hookRunners = api.useHookRunners();\n // trigger the afterBuild Hook\n await hookRunners.afterBuild();\n },\n});\n"})}),"\n",(0,o.jsxs)(n.h2,{id:"asynchronous-setup",children:["Asynchronous setup",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asynchronous-setup",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"The setup of a CLI plugin can be an asynchronous function that performs asynchronous logic during the initialization process."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n async setup(api) {\n await doSomething();\n },\n});\n"})}),"\n",(0,o.jsx)(n.p,{children:"Note that the setup function of the next plugin is not executed until the async setup function of the current plugin has finished. Therefore, you should avoid performing time-consuming asynchronous operations in the setup function to avoid slowing down the startup performance of the CLI."}),"\n",(0,o.jsxs)(n.h2,{id:"life-cycle-hooks",children:["Life cycle hooks",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#life-cycle-hooks",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["We know that the ",(0,o.jsx)(n.code,{children:"setup"})," function returns a Hooks object, which can also be understood as an object with Modern.js Module lifecycle hooks."]}),"\n",(0,o.jsx)(n.p,{children:"Currently there are two main types of hooks."}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["build hooks: triggered only when the ",(0,o.jsx)(n.code,{children:"build"})," command is executed to build the source code product."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"buildPlatform"})," hook: triggered only when the ",(0,o.jsx)(n.code,{children:"build --platform"})," command is executed to generate other build artifacts."]}),"\n",(0,o.jsxs)(n.li,{children:["debug hooks: hooks that are triggered when running the ",(0,o.jsx)(n.code,{children:"dev"})," command."]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["See the ",(0,o.jsx)(n.a,{href:"/en/api/plugin-api/plugin-hooks",children:"API documentation"})," for a full list of lifecycle hooks."]})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fsetup-function.mdx"]={toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2}],title:"Setup function",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5575.ce4d4add.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6512.35d7bc4d.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5575.ce4d4add.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6512.35d7bc4d.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/2458.bd7972f4.js b/modern-js/module-tools/static/js/async/6566.3ab6b5d9.js similarity index 96% rename from modern-js/module-tools/static/js/async/2458.bd7972f4.js rename to modern-js/module-tools/static/js/async/6566.3ab6b5d9.js index 307020f995..2d6da53049 100644 --- a/modern-js/module-tools/static/js/async/2458.bd7972f4.js +++ b/modern-js/module-tools/static/js/async/6566.3ab6b5d9.js @@ -1,2 +1,2 @@ -/*! For license information please see 2458.bd7972f4.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2458"],{46859:function(e,o,t){"use strict";t.r(o);var n=t("39980"),r=t("9580");function i(e){let o=Object.assign({h1:"h1",a:"a",p:"p",img:"img",strong:"strong"},(0,r.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"why-you-need-modernjs-module",children:["Why you need Modern.js Module",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#why-you-need-modernjs-module",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"You've probably all experienced it: when developing a component library or tool library from scratch, we have to consider not only how to write the code logic of the project itself, but also how to build, debug, test, format the code, and other things that have nothing to do with the code logic."}),"\n",(0,n.jsxs)(o.p,{children:["For example, when we consider which builder is used to build the code for a module project, we might previously consider ",(0,n.jsx)(o.a,{href:"https://webpack.js.org/",target:"_blank",rel:"noopener noreferrer",children:"webpack"})," or ",(0,n.jsx)(o.a,{href:"https://rollupjs.org/guide/en/",target:"_blank",rel:"noopener noreferrer",children:"Rollup"}),", but now we might also consider ",(0,n.jsx)(o.a,{href:"https://esbuild.github.io/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," or ",(0,n.jsx)(o.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"}),"."]}),"\n",(0,n.jsx)(o.p,{children:"Regardless of which builder is chosen, this is going to be a costly learning curve for developers who are not skilled in the use of these build tools. Even if you want to use them quickly, it will take a lot of time and effort."}),"\n",(0,n.jsx)(o.p,{children:"In addition to the build, things like providing debugging tools for projects, supporting testing capabilities, adding code format validation, etc. can take a long time and effort for a novice to understand or master them and actually serve the current project."}),"\n",(0,n.jsx)(o.p,{children:"To ensure the quality of the code and the integrity of the project, we often need to do these things that are not related to the logical implementation of the code. However, these things are likely to affect the overall project development progress, reduce the developer's development experience, and make the developer feel that the development threshold of the module project is very high."}),"\n",(0,n.jsx)(o.p,{children:"If you have to go through all this work every time you develop a module type project, you will spend most of your development time in the beginning on these things that are not related to code implementation. If we could provide a module engineering solution that would help developers to solve the project engineering issues and allow them to focus more on code implementation, it would greatly improve the module type project development experience."}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/module-tools/why-module-solution.png",alt:"Not using engineering solution vs. using engineering solution"})}),"\n",(0,n.jsxs)(o.p,{children:["Modern.js, in order to make developing module type projects easier, provides a module engineering solution in order to solve the above mentioned problems and provides the main features using Modern.js Module. ",(0,n.jsx)(o.strong,{children:"Modern.js Module can be understood as a tool dedicated to the development of module type projects"}),"."]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,r.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(i,{...e})}):i(e)}o.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fwhy-module-engineering-solution.md"]={toc:[],title:"Why you need Modern.js Module",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 6566.3ab6b5d9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6566"],{31517:function(e,o,t){"use strict";t.r(o);var n=t("39980"),r=t("9580");function i(e){let o=Object.assign({h1:"h1",a:"a",p:"p",img:"img",strong:"strong"},(0,r.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.h1,{id:"why-you-need-modernjs-module",children:["Why you need Modern.js Module",(0,n.jsx)(o.a,{className:"header-anchor","aria-hidden":"true",href:"#why-you-need-modernjs-module",children:"#"})]}),"\n",(0,n.jsx)(o.p,{children:"You've probably all experienced it: when developing a component library or tool library from scratch, we have to consider not only how to write the code logic of the project itself, but also how to build, debug, test, format the code, and other things that have nothing to do with the code logic."}),"\n",(0,n.jsxs)(o.p,{children:["For example, when we consider which builder is used to build the code for a module project, we might previously consider ",(0,n.jsx)(o.a,{href:"https://webpack.js.org/",target:"_blank",rel:"noopener noreferrer",children:"webpack"})," or ",(0,n.jsx)(o.a,{href:"https://rollupjs.org/guide/en/",target:"_blank",rel:"noopener noreferrer",children:"Rollup"}),", but now we might also consider ",(0,n.jsx)(o.a,{href:"https://esbuild.github.io/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," or ",(0,n.jsx)(o.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"}),"."]}),"\n",(0,n.jsx)(o.p,{children:"Regardless of which builder is chosen, this is going to be a costly learning curve for developers who are not skilled in the use of these build tools. Even if you want to use them quickly, it will take a lot of time and effort."}),"\n",(0,n.jsx)(o.p,{children:"In addition to the build, things like providing debugging tools for projects, supporting testing capabilities, adding code format validation, etc. can take a long time and effort for a novice to understand or master them and actually serve the current project."}),"\n",(0,n.jsx)(o.p,{children:"To ensure the quality of the code and the integrity of the project, we often need to do these things that are not related to the logical implementation of the code. However, these things are likely to affect the overall project development progress, reduce the developer's development experience, and make the developer feel that the development threshold of the module project is very high."}),"\n",(0,n.jsx)(o.p,{children:"If you have to go through all this work every time you develop a module type project, you will spend most of your development time in the beginning on these things that are not related to code implementation. If we could provide a module engineering solution that would help developers to solve the project engineering issues and allow them to focus more on code implementation, it would greatly improve the module type project development experience."}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.img,{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/module-tools/why-module-solution.png",alt:"Not using engineering solution vs. using engineering solution"})}),"\n",(0,n.jsxs)(o.p,{children:["Modern.js, in order to make developing module type projects easier, provides a module engineering solution in order to solve the above mentioned problems and provides the main features using Modern.js Module. ",(0,n.jsx)(o.strong,{children:"Modern.js Module can be understood as a tool dedicated to the development of module type projects"}),"."]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:o}=Object.assign({},(0,r.ah)(),e.components);return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(i,{...e})}):i(e)}o.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fguide%2Fintro%2Fwhy-module-engineering-solution.md"]={toc:[],title:"Why you need Modern.js Module",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5605.f19af8e6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6566.3ab6b5d9.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5605.f19af8e6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6566.3ab6b5d9.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9343.2fa74d1e.js b/modern-js/module-tools/static/js/async/6573.8c6b5e09.js similarity index 99% rename from modern-js/module-tools/static/js/async/9343.2fa74d1e.js rename to modern-js/module-tools/static/js/async/6573.8c6b5e09.js index 3238ae2a5c..194f9288d6 100644 --- a/modern-js/module-tools/static/js/async/9343.2fa74d1e.js +++ b/modern-js/module-tools/static/js/async/6573.8c6b5e09.js @@ -1,2 +1,2 @@ -/*! For license information please see 9343.2fa74d1e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9343"],{33082:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",strong:"strong",ul:"ul",li:"li",pre:"pre",h3:"h3",h4:"h4"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"in-depth-understanding-of-build",children:["In-depth understanding of build",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#in-depth-understanding-of-build",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:['In the "Basic Usage" section, we already knew that you can modify the output files of a project through the ',(0,i.jsx)(n.code,{children:"buildConfig"})," configuration. ",(0,i.jsx)(n.code,{children:"buildConfig"})," not only describes some of the features of the product, but also provides some functionality for building the product."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["If you are not familiar with ",(0,i.jsx)(n.code,{children:"buildConfig"}),", please read ",(0,i.jsx)(n.a,{href:"/en/guide/basic/modify-output-product",children:"modify-output-product"}),".\n"]})})]}),"\n",(0,i.jsxs)(n.p,{children:["In this chapter we'll dive into the use of certain build configurations and understand what happens when the ",(0,i.jsx)(n.code,{children:"modern build"})," command is executed."]}),"\n",(0,i.jsxs)(n.h2,{id:"bundle--bundleless",children:[(0,i.jsx)(n.code,{children:"bundle"})," / ",(0,i.jsx)(n.code,{children:"bundleless"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle--bundleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"So first let's understand bundle and bundleless."}),"\n",(0,i.jsxs)(n.p,{children:["A bundle is a package of build artifacts, which may be a single file or multiple files based on a certain ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"code splitting strategy"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["bundleless, on the other hand, means that each source file is compiled and built separately, but not bundled together. Each output file can be found with its corresponding source code file. The process of ",(0,i.jsx)(n.strong,{children:"bundleless build can also be understood as the process of code conversion of source files only"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"They have their own benefits."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"bundle can reduce the size of build artifacts and also pre-package dependencies to reduce the size of installed dependencies. Packaging libraries in advance can speed up application project builds."}),"\n",(0,i.jsx)(n.li,{children:"bundleless maintains the original file structure and is more conducive to debugging and tree shaking."}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["bundleless is a single-file compilation mode, so for referencing and exporting types, you need to add the ",(0,i.jsx)(n.code,{children:"type"})," keyword. For example, ",(0,i.jsx)(n.code,{children:"import type { A } from './types'"}),". Please refer to the ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/content-types/#isolated-modules",target:"_blank",rel:"noopener noreferrer",children:"esbuild documentation"})," for more information.\n"]})})]}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"buildConfig"})," you can specify whether the current build task is bundle or bundleless by using ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#buildtype",children:(0,i.jsx)(n.code,{children:"buildConfig.buildType"})}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"input--sourcedir",children:[(0,i.jsx)(n.code,{children:"input"})," / ",(0,i.jsx)(n.code,{children:"sourceDir"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input--sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,i.jsx)(n.code,{children:"buildConfig.input"})})," is used to specify the path to a file or directory from which to read the source code, the default value of which varies between bundle and bundleless builds:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["When ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"}),", ",(0,i.jsx)(n.code,{children:"input"})," defaults to ",(0,i.jsx)(n.code,{children:"src/index.(j|t)sx?"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["When ",(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"}),", ",(0,i.jsx)(n.code,{children:"input"})," defaults to ",(0,i.jsx)(n.code,{children:"['src']"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["From the default value, we know that ",(0,i.jsx)(n.strong,{children:"building in bundle mode usually specifies one or more files as the entry point for the build, while building in bundleless mode specifies a directory and uses all the files in that directory as the entry point"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,i.jsx)(n.code,{children:"sourceDir"})})," is used to specify the source directory, which is ",(0,i.jsx)(n.strong,{children:"only"})," related to the following two elements:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Type file generation"}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"outbase"})})," for specifying the build process"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"So we can get its best practices:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsxs)(n.strong,{children:["Only specify ",(0,i.jsx)(n.code,{children:"input"})," during the bundle build."]})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsxs)(n.strong,{children:["In general, bundleless only needs to specify ",(0,i.jsx)(n.code,{children:"sourceDir"})," (where ",(0,i.jsx)(n.code,{children:"input"})," will be aligned with ",(0,i.jsx)(n.code,{children:"sourceDir"}),")."]})," If we want to use the ",(0,i.jsx)(n.code,{children:"input"})," in bundleless, we only need to specify ",(0,i.jsx)(n.code,{children:"sourceDir"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If you want to convert only some of the files in bundleless, e.g. only the files in the ",(0,i.jsx)(n.code,{children:"src/runtime"})," directory, you need to configure ",(0,i.jsx)(n.code,{children:"input"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n input: ['src/runtime'],\n sourceDir: 'src',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"use-swc",children:["use swc",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#use-swc",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In some scenarios, esbuild is not enough to meet our needs, and we will use swc to do the code conversion."}),"\n",(0,i.jsxs)(n.p,{children:["Starting from version ",(0,i.jsx)(n.strong,{children:"2.36.0"}),", the Modern.js Module will use swc by default when it comes to the following functionality, but that doesn't mean we don't use esbuild any more, the rest of the functionality will still use esbuild."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:"transformImport"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#transformlodash",children:"transformLodash"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#externalhelpers",children:"externalHelpers"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#format-umd",children:"format: umd"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#target",children:"target: es5"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata",target:"_blank",rel:"noopener noreferrer",children:"emitDecoratorMetadata: true"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["In fact, we've been using swc for full code conversion since version ",(0,i.jsx)(n.strong,{children:"2.16.0"}),". However, swc also has some limitations, so we added ",(0,i.jsx)(n.a,{href:"/api/config/build-config#sourcetype",children:"sourceType"})," to turn off swc when the source is formatted as 'commonjs', which isn't really user-intuitive, and the cjs mode of the swc formatted outputs don't have annotate each export name, which can cause problems in node.\nSo we deprecated this behaviour and went back to the original design - ",(0,i.jsx)(n.strong,{children:"using swc as a supplement only in situations where it was needed"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"using-hooks-to-intervene-in-the-build-process",children:["Using Hooks to Intervene in the Build Process",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-hooks-to-intervene-in-the-build-process",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Modern.js Module provides a Hook mechanism that allows us to inject custom logic at different stages of the build process.\nThe Modern.js Module Hook is implemented using ",(0,i.jsx)(n.a,{href:"https://github.com/webpack/tapable",target:"_blank",rel:"noopener noreferrer",children:"tapable"}),", which extends esbuild's plugin mechanism, and is recommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:"]}),"\n",(0,i.jsxs)(n.h3,{id:"hook-type",children:["Hook type",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-type",children:"#"})]}),"\n",(0,i.jsxs)(n.h4,{id:"asyncseriesbailhook",children:["AsyncSeriesBailHook",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncseriesbailhook",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Serial hooks that stop the execution of other tapped functions if a tapped function returns a non-undefined result."}),"\n",(0,i.jsxs)(n.h4,{id:"asyncserieswaterfallhooks",children:["AsyncSeriesWaterFallHooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncserieswaterfallhooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Serial hooks whose results are passed to the next tapped function."}),"\n",(0,i.jsxs)(n.h3,{id:"hook-api",children:["Hook API",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-api",children:"#"})]}),"\n",(0,i.jsxs)(n.h4,{id:"load",children:["load",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#load",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesBailHook"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," to fetch module content based on the module path"]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface LoadArgs {\n path: string;\n namespace: string;\n suffix: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Return parameters"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type LoadResult =\n | {\n contents: string; // module contents\n map?: SourceMap; // https://esbuild.github.io/api/#sourcemap\n loader?: Loader; // https://esbuild.github.io/api/#loader\n resolveDir?: string;\n }\n | undefined;\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Example"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.load.tapPromise('load content from memfs', async args => {\n const contents = memfs.readFileSync(args.path);\n return {\n contents: contents,\n loader: 'js',\n };\n});\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"transform",children:["transform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transform",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"}),".\nTransforms the contents of the module fetched during the load phase"]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters (return parameters)"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export type Source = {\n code: string;\n map?: SourceMap;\n path: string;\n loader?: string;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Example"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.transform.tapPromise('6to5', async args => {\n const result = babelTransform(args.code, { presets: ['@babel/preset-env'] });\n return {\n code: result.code,\n map: result.map,\n };\n});\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"renderchunk",children:["renderChunk",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#renderchunk",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-end",target:"_blank",rel:"noopener noreferrer",children:"onEnd callbacks"}),".\nThis is similar to the transform hook, but works on the artifacts generated by esbuild."]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters (return parameters)"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export type AssetChunk = {\n type: 'asset';\n contents: string | Buffer;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n originalFileName?: string;\n};\n\nexport type JsChunk = {\n type: 'chunk';\n contents: string;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n map?: SourceMap;\n modules?: Record;\n originalFileName?: string;\n};\n\nexport type Chunk = AssetChunk | JsChunk;\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Examples"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.renderChunk.tapPromise('minify', async chunk => {\n if (chunk.type === 'chunk') {\n const code = chunk.contents.toString();\n const result = await minify.call(compiler, code);\n return {\n ...chunk,\n contents: result.code,\n map: result.map,\n };\n }\n return chunk;\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#dts",children:(0,i.jsx)(n.code,{children:"buildConfig.dts"})})," configuration is mainly used for type file generation."]}),"\n",(0,i.jsxs)(n.h3,{id:"turn-off-type-generation",children:["Turn off type generation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#turn-off-type-generation",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Type generation is turned on by default, if you need to turn it off, you can configure it as follows:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n dts: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"The build speed is generally improved by closing the type file."})})]}),"\n",(0,i.jsxs)(n.h3,{id:"build-type-files",children:["Build type files",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-type-files",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["With ",(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"}),", type files are generated using the project's ",(0,i.jsx)(n.code,{children:"tsc"})," command to complete production."]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.strong,{children:"Modern.js Module also supports bundling of type files"}),", although care needs to be taken when using this feature."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Bundle type files does not enable type checking."}),"\n",(0,i.jsxs)(n.li,{children:["Some third-party dependencies have incorrect syntax that can cause the bundling process to fail. So in this case, you need to exclude such third-party packages manually with ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"buildConfig.externals"})})," or close ",(0,i.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:"dts.respectExternal"})," to external all third-party packages types."]}),"\n",(0,i.jsxs)(n.li,{children:["It is not possible to handle the case where the type file of a third-party dependency points to a ",(0,i.jsx)(n.code,{children:".ts"})," file. For example, the ",(0,i.jsx)(n.code,{children:"package.json"})," of a third-party dependency contains something like this: ",(0,i.jsx)(n.code,{children:'{"types": ". /src/index.ts"}'}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For the above problems, our recommended approach is to first use ",(0,i.jsx)(n.code,{children:"tsc"})," to generate d.ts files, then package the index.d.ts as the entry and close ",(0,i.jsx)(n.code,{children:"dts.respectExternal"}),". In the future evolution, we will gradually move towards this handling approach."]}),"\n",(0,i.jsxs)(n.h3,{id:"alias-conversion",children:["Alias Conversion",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias-conversion",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"During the bundleless build process, if an alias appears in the source code, e.g."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./src/index.ts"',children:"import utils from '@common/utils';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The type files generated with ",(0,i.jsx)(n.code,{children:"tsc"})," will also contain these aliases. However, Modern.js Module will convert the aliases in the type file generated by ",(0,i.jsx)(n.code,{children:"tsc"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"some-examples-of-the-use-of-dts",children:["Some examples of the use of ",(0,i.jsx)(n.code,{children:"dts"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#some-examples-of-the-use-of-dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"General usage:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // The output path of the bundled type file at this point is `./dist/types`\n buildConfig: {\n buildType: 'bundle',\n dts: {\n tsconfigPath: './other-tsconfig.json',\n distPath: './types',\n },\n outDir: './dist',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the use of ",(0,i.jsx)(n.code,{children:"dts.only"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // At this moment the type file is not bundled and the output path is `./dist/types`\n buildConfig: [\n {\n buildType: 'bundle',\n dts: false,\n outDir: './dist',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"build-process",children:["Build process",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-process",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When the ",(0,i.jsx)(n.code,{children:"modern build"})," command is executed, the"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Clear the output directory according to ",(0,i.jsx)(n.code,{children:"buildConfig.outDir"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Compile ",(0,i.jsx)(n.code,{children:"js/ts"})," source code to generate the JS build artifacts for bundle/bundleless."]}),"\n",(0,i.jsxs)(n.li,{children:["Generate bundle/bundleless type files using ",(0,i.jsx)(n.code,{children:"tsc"}),"."]}),"\n",(0,i.jsx)(n.li,{children:"Handle Copy tasks."}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"build-errors",children:["Build errors",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-errors",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When a build error occurs, based on the information learned above, it is easy to understand what error appears in the terminal."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Errors reported for js or ts builds:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'error ModuleBuildError:\n\n\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 bundle failed: \u2502\n\u2502 - format is "cjs" \u2502\n\u2502 - target is "esnext" \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n\nDetailed Information:\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Errors reported for the type file generation process:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"error ModuleBuildError:\n\nbundle DTS failed:\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For ",(0,i.jsx)(n.code,{children:"js/ts"})," build errors, we can tell from the error message."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["By ",(0,i.jsx)(n.code,{children:"'bundle failed:'"})," to determine if the error is reported for a bundle build or a bundleless build"]}),"\n",(0,i.jsxs)(n.li,{children:["What is the ",(0,i.jsx)(n.code,{children:"format"})," of the build process"]}),"\n",(0,i.jsxs)(n.li,{children:["What is the ",(0,i.jsx)(n.code,{children:"target"})," of the build process"]}),"\n",(0,i.jsx)(n.li,{children:"The specific error message"}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"debug-mode",children:["Debug mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#debug-mode",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["From ",(0,i.jsx)(n.strong,{children:"2.36.0"}),", For troubleshooting purposes, the Modern.js Module provides a debug mode, which you can enable by adding the DEBUG=module environment variable when executing a build."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"DEBUG=module modern build\n"})}),"\n",(0,i.jsx)(n.p,{children:"In debug mode, you'll see more detailed build logs output in Shell, which are mainly process logs:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"module run beforeBuildTask hooks +6ms\nmodule run beforeBuildTask hooks done +0ms\nmodule [DTS] Build Start +139ms\nmodule [CJS] Build Start +1ms\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In addition, Module provides the ability to debug internal workflows. You can enable more detailed debugging logging by setting the ",(0,i.jsx)(n.code,{children:"DEBUG=module:*"})," environment variable."]}),"\n",(0,i.jsxs)(n.p,{children:["Currently, only ",(0,i.jsx)(n.code,{children:"DEBUG=module:resolve"})," is supported, which allows you to see a detailed log of module resolution within the Module."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:" module:resolve onResolve args: {\n path: './src/hooks/misc.ts',\n importer: '',\n namespace: 'file',\n resolveDir: '/Users/bytedance/modern.js/packages/solutions/module-tools',\n kind: 'entry-point',\n pluginData: undefined\n} +0ms\n module:resolve onResolve result: {\n path: '/Users/bytedance/modern.js/packages/solutions/module-tools/src/hooks/misc.ts',\n external: false,\n namespace: 'file',\n sideEffects: undefined,\n suffix: ''\n} +0ms\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fin-depth-about-build.md"]={toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2},{text:"use swc",id:"use-swc",depth:2},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2},{text:"Hook type",id:"hook-type",depth:3},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4},{text:"Hook API",id:"hook-api",depth:3},{text:"load",id:"load",depth:4},{text:"transform",id:"transform",depth:4},{text:"renderChunk",id:"renderchunk",depth:4},{text:"dts",id:"dts",depth:2},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3},{text:"Build type files",id:"build-type-files",depth:3},{text:"Alias Conversion",id:"alias-conversion",depth:3},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3},{text:"Build process",id:"build-process",depth:2},{text:"Build errors",id:"build-errors",depth:2},{text:"Debug mode",id:"debug-mode",depth:2}],title:"In-depth understanding of build",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 6573.8c6b5e09.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6573"],{46850:function(e,n,s){"use strict";s.r(n);var i=s("39980"),r=s("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",strong:"strong",ul:"ul",li:"li",pre:"pre",h3:"h3",h4:"h4"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"in-depth-understanding-of-build",children:["In-depth understanding of build",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#in-depth-understanding-of-build",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:['In the "Basic Usage" section, we already knew that you can modify the output files of a project through the ',(0,i.jsx)(n.code,{children:"buildConfig"})," configuration. ",(0,i.jsx)(n.code,{children:"buildConfig"})," not only describes some of the features of the product, but also provides some functionality for building the product."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["If you are not familiar with ",(0,i.jsx)(n.code,{children:"buildConfig"}),", please read ",(0,i.jsx)(n.a,{href:"/en/guide/basic/modify-output-product",children:"modify-output-product"}),".\n"]})})]}),"\n",(0,i.jsxs)(n.p,{children:["In this chapter we'll dive into the use of certain build configurations and understand what happens when the ",(0,i.jsx)(n.code,{children:"modern build"})," command is executed."]}),"\n",(0,i.jsxs)(n.h2,{id:"bundle--bundleless",children:[(0,i.jsx)(n.code,{children:"bundle"})," / ",(0,i.jsx)(n.code,{children:"bundleless"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#bundle--bundleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"So first let's understand bundle and bundleless."}),"\n",(0,i.jsxs)(n.p,{children:["A bundle is a package of build artifacts, which may be a single file or multiple files based on a certain ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"code splitting strategy"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["bundleless, on the other hand, means that each source file is compiled and built separately, but not bundled together. Each output file can be found with its corresponding source code file. The process of ",(0,i.jsx)(n.strong,{children:"bundleless build can also be understood as the process of code conversion of source files only"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"They have their own benefits."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"bundle can reduce the size of build artifacts and also pre-package dependencies to reduce the size of installed dependencies. Packaging libraries in advance can speed up application project builds."}),"\n",(0,i.jsx)(n.li,{children:"bundleless maintains the original file structure and is more conducive to debugging and tree shaking."}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["bundleless is a single-file compilation mode, so for referencing and exporting types, you need to add the ",(0,i.jsx)(n.code,{children:"type"})," keyword. For example, ",(0,i.jsx)(n.code,{children:"import type { A } from './types'"}),". Please refer to the ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/content-types/#isolated-modules",target:"_blank",rel:"noopener noreferrer",children:"esbuild documentation"})," for more information.\n"]})})]}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"buildConfig"})," you can specify whether the current build task is bundle or bundleless by using ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#buildtype",children:(0,i.jsx)(n.code,{children:"buildConfig.buildType"})}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"input--sourcedir",children:[(0,i.jsx)(n.code,{children:"input"})," / ",(0,i.jsx)(n.code,{children:"sourceDir"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input--sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,i.jsx)(n.code,{children:"buildConfig.input"})})," is used to specify the path to a file or directory from which to read the source code, the default value of which varies between bundle and bundleless builds:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["When ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"}),", ",(0,i.jsx)(n.code,{children:"input"})," defaults to ",(0,i.jsx)(n.code,{children:"src/index.(j|t)sx?"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["When ",(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"}),", ",(0,i.jsx)(n.code,{children:"input"})," defaults to ",(0,i.jsx)(n.code,{children:"['src']"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["From the default value, we know that ",(0,i.jsx)(n.strong,{children:"building in bundle mode usually specifies one or more files as the entry point for the build, while building in bundleless mode specifies a directory and uses all the files in that directory as the entry point"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,i.jsx)(n.code,{children:"sourceDir"})})," is used to specify the source directory, which is ",(0,i.jsx)(n.strong,{children:"only"})," related to the following two elements:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Type file generation"}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"outbase"})})," for specifying the build process"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"So we can get its best practices:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsxs)(n.strong,{children:["Only specify ",(0,i.jsx)(n.code,{children:"input"})," during the bundle build."]})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsxs)(n.strong,{children:["In general, bundleless only needs to specify ",(0,i.jsx)(n.code,{children:"sourceDir"})," (where ",(0,i.jsx)(n.code,{children:"input"})," will be aligned with ",(0,i.jsx)(n.code,{children:"sourceDir"}),")."]})," If we want to use the ",(0,i.jsx)(n.code,{children:"input"})," in bundleless, we only need to specify ",(0,i.jsx)(n.code,{children:"sourceDir"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If you want to convert only some of the files in bundleless, e.g. only the files in the ",(0,i.jsx)(n.code,{children:"src/runtime"})," directory, you need to configure ",(0,i.jsx)(n.code,{children:"input"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n input: ['src/runtime'],\n sourceDir: 'src',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"use-swc",children:["use swc",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#use-swc",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In some scenarios, esbuild is not enough to meet our needs, and we will use swc to do the code conversion."}),"\n",(0,i.jsxs)(n.p,{children:["Starting from version ",(0,i.jsx)(n.strong,{children:"2.36.0"}),", the Modern.js Module will use swc by default when it comes to the following functionality, but that doesn't mean we don't use esbuild any more, the rest of the functionality will still use esbuild."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:"transformImport"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#transformlodash",children:"transformLodash"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#externalhelpers",children:"externalHelpers"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#format-umd",children:"format: umd"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/api/config/build-config#target",children:"target: es5"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata",target:"_blank",rel:"noopener noreferrer",children:"emitDecoratorMetadata: true"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["In fact, we've been using swc for full code conversion since version ",(0,i.jsx)(n.strong,{children:"2.16.0"}),". However, swc also has some limitations, so we added ",(0,i.jsx)(n.a,{href:"/api/config/build-config#sourcetype",children:"sourceType"})," to turn off swc when the source is formatted as 'commonjs', which isn't really user-intuitive, and the cjs mode of the swc formatted outputs don't have annotate each export name, which can cause problems in node.\nSo we deprecated this behaviour and went back to the original design - ",(0,i.jsx)(n.strong,{children:"using swc as a supplement only in situations where it was needed"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"using-hooks-to-intervene-in-the-build-process",children:["Using Hooks to Intervene in the Build Process",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-hooks-to-intervene-in-the-build-process",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Modern.js Module provides a Hook mechanism that allows us to inject custom logic at different stages of the build process.\nThe Modern.js Module Hook is implemented using ",(0,i.jsx)(n.a,{href:"https://github.com/webpack/tapable",target:"_blank",rel:"noopener noreferrer",children:"tapable"}),", which extends esbuild's plugin mechanism, and is recommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:"]}),"\n",(0,i.jsxs)(n.h3,{id:"hook-type",children:["Hook type",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-type",children:"#"})]}),"\n",(0,i.jsxs)(n.h4,{id:"asyncseriesbailhook",children:["AsyncSeriesBailHook",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncseriesbailhook",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Serial hooks that stop the execution of other tapped functions if a tapped function returns a non-undefined result."}),"\n",(0,i.jsxs)(n.h4,{id:"asyncserieswaterfallhooks",children:["AsyncSeriesWaterFallHooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asyncserieswaterfallhooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Serial hooks whose results are passed to the next tapped function."}),"\n",(0,i.jsxs)(n.h3,{id:"hook-api",children:["Hook API",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hook-api",children:"#"})]}),"\n",(0,i.jsxs)(n.h4,{id:"load",children:["load",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#load",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesBailHook"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"})," to fetch module content based on the module path"]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface LoadArgs {\n path: string;\n namespace: string;\n suffix: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Return parameters"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type LoadResult =\n | {\n contents: string; // module contents\n map?: SourceMap; // https://esbuild.github.io/api/#sourcemap\n loader?: Loader; // https://esbuild.github.io/api/#loader\n resolveDir?: string;\n }\n | undefined;\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Example"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.load.tapPromise('load content from memfs', async args => {\n const contents = memfs.readFileSync(args.path);\n return {\n contents: contents,\n loader: 'js',\n };\n});\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"transform",children:["transform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transform",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-load",target:"_blank",rel:"noopener noreferrer",children:"onLoad callbacks"}),".\nTransforms the contents of the module fetched during the load phase"]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters (return parameters)"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export type Source = {\n code: string;\n map?: SourceMap;\n path: string;\n loader?: string;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Example"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.transform.tapPromise('6to5', async args => {\n const result = babelTransform(args.code, { presets: ['@babel/preset-env'] });\n return {\n code: result.code,\n map: result.map,\n };\n});\n"})}),"\n",(0,i.jsxs)(n.h4,{id:"renderchunk",children:["renderChunk",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#renderchunk",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"AsyncSeriesWaterFallHooks"}),"\n",(0,i.jsxs)(n.li,{children:["Triggered at esbuild ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/plugins/#on-end",target:"_blank",rel:"noopener noreferrer",children:"onEnd callbacks"}),".\nThis is similar to the transform hook, but works on the artifacts generated by esbuild."]}),"\n",(0,i.jsx)(n.li,{children:"Input parameters (return parameters)"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export type AssetChunk = {\n type: 'asset';\n contents: string | Buffer;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n originalFileName?: string;\n};\n\nexport type JsChunk = {\n type: 'chunk';\n contents: string;\n entryPoint?: string;\n /**\n * absolute file path\n */\n fileName: string;\n map?: SourceMap;\n modules?: Record;\n originalFileName?: string;\n};\n\nexport type Chunk = AssetChunk | JsChunk;\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Examples"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"compiler.hooks.renderChunk.tapPromise('minify', async chunk => {\n if (chunk.type === 'chunk') {\n const code = chunk.contents.toString();\n const result = await minify.call(compiler, code);\n return {\n ...chunk,\n contents: result.code,\n map: result.map,\n };\n }\n return chunk;\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#dts",children:(0,i.jsx)(n.code,{children:"buildConfig.dts"})})," configuration is mainly used for type file generation."]}),"\n",(0,i.jsxs)(n.h3,{id:"turn-off-type-generation",children:["Turn off type generation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#turn-off-type-generation",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Type generation is turned on by default, if you need to turn it off, you can configure it as follows:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n buildConfig: {\n dts: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"The build speed is generally improved by closing the type file."})})]}),"\n",(0,i.jsxs)(n.h3,{id:"build-type-files",children:["Build type files",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-type-files",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["With ",(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"}),", type files are generated using the project's ",(0,i.jsx)(n.code,{children:"tsc"})," command to complete production."]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.strong,{children:"Modern.js Module also supports bundling of type files"}),", although care needs to be taken when using this feature."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Bundle type files does not enable type checking."}),"\n",(0,i.jsxs)(n.li,{children:["Some third-party dependencies have incorrect syntax that can cause the bundling process to fail. So in this case, you need to exclude such third-party packages manually with ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"buildConfig.externals"})})," or close ",(0,i.jsx)(n.a,{href:"/api/config/build-config#dtsrespectexternal",children:"dts.respectExternal"})," to external all third-party packages types."]}),"\n",(0,i.jsxs)(n.li,{children:["It is not possible to handle the case where the type file of a third-party dependency points to a ",(0,i.jsx)(n.code,{children:".ts"})," file. For example, the ",(0,i.jsx)(n.code,{children:"package.json"})," of a third-party dependency contains something like this: ",(0,i.jsx)(n.code,{children:'{"types": ". /src/index.ts"}'}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For the above problems, our recommended approach is to first use ",(0,i.jsx)(n.code,{children:"tsc"})," to generate d.ts files, then package the index.d.ts as the entry and close ",(0,i.jsx)(n.code,{children:"dts.respectExternal"}),". In the future evolution, we will gradually move towards this handling approach."]}),"\n",(0,i.jsxs)(n.h3,{id:"alias-conversion",children:["Alias Conversion",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias-conversion",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"During the bundleless build process, if an alias appears in the source code, e.g."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./src/index.ts"',children:"import utils from '@common/utils';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The type files generated with ",(0,i.jsx)(n.code,{children:"tsc"})," will also contain these aliases. However, Modern.js Module will convert the aliases in the type file generated by ",(0,i.jsx)(n.code,{children:"tsc"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"some-examples-of-the-use-of-dts",children:["Some examples of the use of ",(0,i.jsx)(n.code,{children:"dts"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#some-examples-of-the-use-of-dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"General usage:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // The output path of the bundled type file at this point is `./dist/types`\n buildConfig: {\n buildType: 'bundle',\n dts: {\n tsconfigPath: './other-tsconfig.json',\n distPath: './types',\n },\n outDir: './dist',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the use of ",(0,i.jsx)(n.code,{children:"dts.only"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // At this moment the type file is not bundled and the output path is `./dist/types`\n buildConfig: [\n {\n buildType: 'bundle',\n dts: false,\n outDir: './dist',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"build-process",children:["Build process",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-process",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When the ",(0,i.jsx)(n.code,{children:"modern build"})," command is executed, the"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Clear the output directory according to ",(0,i.jsx)(n.code,{children:"buildConfig.outDir"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Compile ",(0,i.jsx)(n.code,{children:"js/ts"})," source code to generate the JS build artifacts for bundle/bundleless."]}),"\n",(0,i.jsxs)(n.li,{children:["Generate bundle/bundleless type files using ",(0,i.jsx)(n.code,{children:"tsc"}),"."]}),"\n",(0,i.jsx)(n.li,{children:"Handle Copy tasks."}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"build-errors",children:["Build errors",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-errors",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When a build error occurs, based on the information learned above, it is easy to understand what error appears in the terminal."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Errors reported for js or ts builds:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'error ModuleBuildError:\n\n\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 bundle failed: \u2502\n\u2502 - format is "cjs" \u2502\n\u2502 - target is "esnext" \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n\nDetailed Information:\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Errors reported for the type file generation process:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"error ModuleBuildError:\n\nbundle DTS failed:\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For ",(0,i.jsx)(n.code,{children:"js/ts"})," build errors, we can tell from the error message."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["By ",(0,i.jsx)(n.code,{children:"'bundle failed:'"})," to determine if the error is reported for a bundle build or a bundleless build"]}),"\n",(0,i.jsxs)(n.li,{children:["What is the ",(0,i.jsx)(n.code,{children:"format"})," of the build process"]}),"\n",(0,i.jsxs)(n.li,{children:["What is the ",(0,i.jsx)(n.code,{children:"target"})," of the build process"]}),"\n",(0,i.jsx)(n.li,{children:"The specific error message"}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"debug-mode",children:["Debug mode",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#debug-mode",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["From ",(0,i.jsx)(n.strong,{children:"2.36.0"}),", For troubleshooting purposes, the Modern.js Module provides a debug mode, which you can enable by adding the DEBUG=module environment variable when executing a build."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"DEBUG=module modern build\n"})}),"\n",(0,i.jsx)(n.p,{children:"In debug mode, you'll see more detailed build logs output in Shell, which are mainly process logs:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"module run beforeBuildTask hooks +6ms\nmodule run beforeBuildTask hooks done +0ms\nmodule [DTS] Build Start +139ms\nmodule [CJS] Build Start +1ms\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In addition, Module provides the ability to debug internal workflows. You can enable more detailed debugging logging by setting the ",(0,i.jsx)(n.code,{children:"DEBUG=module:*"})," environment variable."]}),"\n",(0,i.jsxs)(n.p,{children:["Currently, only ",(0,i.jsx)(n.code,{children:"DEBUG=module:resolve"})," is supported, which allows you to see a detailed log of module resolution within the Module."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:" module:resolve onResolve args: {\n path: './src/hooks/misc.ts',\n importer: '',\n namespace: 'file',\n resolveDir: '/Users/bytedance/modern.js/packages/solutions/module-tools',\n kind: 'entry-point',\n pluginData: undefined\n} +0ms\n module:resolve onResolve result: {\n path: '/Users/bytedance/modern.js/packages/solutions/module-tools/src/hooks/misc.ts',\n external: false,\n namespace: 'file',\n sideEffects: undefined,\n suffix: ''\n} +0ms\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fin-depth-about-build.md"]={toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2},{text:"use swc",id:"use-swc",depth:2},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2},{text:"Hook type",id:"hook-type",depth:3},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4},{text:"Hook API",id:"hook-api",depth:3},{text:"load",id:"load",depth:4},{text:"transform",id:"transform",depth:4},{text:"renderChunk",id:"renderchunk",depth:4},{text:"dts",id:"dts",depth:2},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3},{text:"Build type files",id:"build-type-files",depth:3},{text:"Alias Conversion",id:"alias-conversion",depth:3},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3},{text:"Build process",id:"build-process",depth:2},{text:"Build errors",id:"build-errors",depth:2},{text:"Debug mode",id:"debug-mode",depth:2}],title:"In-depth understanding of build",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/840.17ce598b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6573.8c6b5e09.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/840.17ce598b.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6573.8c6b5e09.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/6658.aeef8790.js b/modern-js/module-tools/static/js/async/6658.aeef8790.js new file mode 100644 index 0000000000..f0dee2b724 --- /dev/null +++ b/modern-js/module-tools/static/js/async/6658.aeef8790.js @@ -0,0 +1,2 @@ +/*! For license information please see 6658.aeef8790.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6658"],{15722:function(e,n,a){"use strict";a.r(n);var i=a("39980"),t=a("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",ul:"ul",li:"li",pre:"pre",code:"code",h2:"h2",h3:"h3"},(0,t.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"build-umd-artifacts",children:["Build umd artifacts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#build-umd-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The full name of umd is ",(0,i.jsx)(n.strong,{children:"Universal Module Definition"}),", and JS files in this format can run in multiple runtime environments: the"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Browser environment: module loading based on AMD specification"}),"\n",(0,i.jsx)(n.li,{children:"Node.js environment: module loading based on CommonJS"}),"\n",(0,i.jsx)(n.li,{children:"Other cases: mount the module on a global object."}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"We can therefore specify the build artifacts of the project as an umd artifact in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"third-party-dependency-handling-for-umd-artifacts",children:["Third-party dependency handling for umd artifacts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#third-party-dependency-handling-for-umd-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In the ",(0,i.jsx)(n.a,{href:"/en/guide/advance/external-dependency",children:'"How to handle third-party dependencies"'})," chapter, we know that we can control whether or not the project packages third-party dependencies via the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"autoExternals"})})," and ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"externals"})})," APIs.\nSo when building umd artifacts, we can also use it like this:"]}),"\n",(0,i.jsxs)(n.h3,{id:"example",children:["Example",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If the project depends on ",(0,i.jsx)(n.code,{children:"react"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n autoExternal: false,\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"react"})," code is not bundled into the artifact at this point:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports, require('react'));\n else if (typeof define === 'function' && define.amd)\n define(['exports', 'react'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}), global.react);\n})(this, function (exports, _react) {\n 'use strict';\n Object.defineProperty(exports, '__esModule', {\n value: true,\n });\n _react = /*#__PURE__*/ _interopRequireDefault(_react);\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule\n ? obj\n : {\n default: obj,\n };\n }\n console.info(_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["We know from the above example that when using the ",(0,i.jsx)(n.code,{children:"autoExternal"})," and ",(0,i.jsx)(n.code,{children:"externals"})," APIs."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["In a Node.js environment, you can get the react dependency with ",(0,i.jsx)(n.code,{children:"require('react')"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["In a browser environment, you can get the react dependency via ",(0,i.jsx)(n.code,{children:"global.react"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"global-variable-names-of-third-party-dependencies",children:["Global variable names of third-party dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#global-variable-names-of-third-party-dependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["However, in the browser environment, when getting third-party dependencies, ",(0,i.jsx)(n.strong,{children:"global variable names are not necessarily identical to the dependency names"}),", so you have to use the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#umdglobals",children:(0,i.jsx)(n.code,{children:"buildConfig.umdGlobals"})})," API."]}),"\n",(0,i.jsxs)(n.p,{children:["Again using the previous example, when the ",(0,i.jsx)(n.code,{children:"react"})," dependency exists in the browser environment as a ",(0,i.jsx)(n.code,{children:"windows.React"})," or ",(0,i.jsx)(n.code,{children:"global.React"})," global variable, then:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," config file:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdGlobals: {\n react: 'React',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["When a ",(0,i.jsx)(n.code,{children:"react"})," dependency is used in the source code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsx)(n.p,{children:"At this point we will see the output code like this:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory();\n else if (typeof define === 'function' && define.amd) define([], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory();\n})(this, function () {\n // ...\n // libuild:globals:react\n var require_react = __commonJS({\n 'libuild:globals:react'(exports, module1) {\n module1.exports = Function('return this')()['React'];\n },\n });\n // src/index.ts\n var import_react = __toESM(require_react());\n console.info(import_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The project can then run in the browser and use the ",(0,i.jsx)(n.code,{children:"React"})," variables that exist on the global object."]}),"\n",(0,i.jsxs)(n.h2,{id:"changing-the-name-of-a-global-variable-in-a-project",children:["Changing the name of a global variable in a project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#changing-the-name-of-a-global-variable-in-a-project",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When we package the following code into an umd artifact and run it in the browser, we can use the module via ",(0,i.jsx)(n.code,{children:"window.index"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="./src/index.ts"',children:"export default () => {\n console.info('hello world');\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"** By default, the name of the source file is used as the name of the module's global variable in the browser. **For the above example, the artifact would read as follows:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}));\n})(this, function (exports) {\n //...\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If you need to modify it, you need to use the ",(0,i.jsx)(n.a,{href:"/en/api/config/build-config#umdmodulename",children:(0,i.jsx)(n.code,{children:"buildConfig.umdModuleName"})})," API."]}),"\n",(0,i.jsx)(n.p,{children:"When this API is used:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"The build artifact at this point are:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.myLib = {}));\n})(this, function (exports) {\n //...\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fbuild-umd.mdx"]={toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2},{text:"Example",id:"example",depth:3},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2}],title:"Build umd artifacts",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5608.806e6a1b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6658.aeef8790.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5608.806e6a1b.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6658.aeef8790.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/679.dad5d5aa.js b/modern-js/module-tools/static/js/async/679.dad5d5aa.js deleted file mode 100644 index e2aee7e824..0000000000 --- a/modern-js/module-tools/static/js/async/679.dad5d5aa.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 679.dad5d5aa.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["679"],{29868:function(e,n,o){"use strict";o.r(n);var r=o("39980"),d=o("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",strong:"strong",h2:"h2",div:"div",pre:"pre"},(0,d.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"using-the-microgenerator",children:["Using the Microgenerator",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-the-microgenerator",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module provides the Microgenerator tool, which allows for the current project to."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"add new directories and files"}),"\n",(0,r.jsxs)(n.li,{children:["Modify the contents of the ",(0,r.jsx)(n.code,{children:"package.json"})," file"]}),"\n",(0,r.jsx)(n.li,{children:"Execute commands"}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Thus with these capabilities, ",(0,r.jsx)(n.strong,{children:"Microgenerator can enable additional feature functionality for the project"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["The microgenerator can be started via ",(0,r.jsx)(n.a,{href:"/guide/basic/command-preview",children:(0,r.jsx)(n.code,{children:"modern new"})}),". The current Microgenerator features supported by the Modern.js Module are:"]}),"\n",(0,r.jsxs)(n.h2,{id:"develop-module-doc",children:["Develop Module Doc",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#develop-module-doc",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["When we want to write documentation for out module project, we can enable the module doc feature. ",(0,r.jsxs)(n.strong,{children:["will create ",(0,r.jsx)(n.code,{children:"docs"})," directory and related files in the project directory, and add ",(0,r.jsx)(n.code,{children:'"@modern-js/plugin-rspress"'})," dependency"]})," in package.json.\nUse ",(0,r.jsx)(n.code,{children:"modern dev"})," and ",(0,r.jsx)(n.code,{children:"modern build --platform"})," to debug and build your doc site."]}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,r.jsx)(n.p,{children:"After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginDoc()],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"storybook",children:["Storybook",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#storybook",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.strong,{children:"Storybook feature"})," can be enabled when we want to debug a component or a common module. When this feature is enabled, ",(0,r.jsxs)(n.strong,{children:["the ",(0,r.jsx)(n.code,{children:"stories"})," directory and ",(0,r.jsx)(n.code,{children:".storybook"})," directory are created in the project directory, and a new ",(0,r.jsx)(n.code,{children:'"@modern-js/storybook"'})," dependency is added to package.json"]}),". Use ",(0,r.jsx)(n.code,{children:"storybook dev"})," and ",(0,r.jsx)(n.code,{children:"storybook build"})," to debug and build."]}),"\n",(0,r.jsxs)(n.h2,{id:"tailwind-css-support",children:["Tailwind CSS Support",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css-support",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"https://tailwindcss.com/",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," is a CSS framework and design system based on Utility Class, which can quickly add common styles to components, and support flexible extension of theme styles."]}),"\n",(0,r.jsxs)(n.p,{children:["If you want to use Tailwind CSS for a project, you can refer to ",(0,r.jsx)(n.a,{href:"https://modernjs.dev/module-tools/guide/best-practices/components.html#tailwind-css",target:"_blank",rel:"noopener noreferrer",children:'"Using Tailwind CSS"'}),"."]}),"\n",(0,r.jsxs)(n.h2,{id:"modernjs-runtime-api",children:["Modern.js Runtime API",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-runtime-api",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Modern.js provides Runtime API capabilities that can only be used in the Modern.js application project environment"}),". If you need to develop a component for use in a Modern.js application environment, then you can turn on this feature and the microgenerator will add the ",(0,r.jsx)(n.code,{children:'"@modern-js/runtime"'})," dependency."]}),"\n",(0,r.jsx)(n.p,{children:"Also, the Storybook debugging tool will determine if the project needs to use the Runtime API by checking the project's dependencies and providing the same Runtime API runtime environment as the Modern.js application project."}),"\n",(0,r.jsx)(n.p,{children:":::tip\nAfter successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport runtime from '@modern-js/runtime/cli';\n\nexport default defineConfig({\n plugins: [moduleTools(), runtime()],\n});\n"})}),"\n"]})]})]})}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fuse-micro-generator.md"]={toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2},{text:"Storybook",id:"storybook",depth:2},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2}],title:"Using the Microgenerator",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4888.aefed6d6.js b/modern-js/module-tools/static/js/async/6800.b1b81661.js similarity index 97% rename from modern-js/module-tools/static/js/async/4888.aefed6d6.js rename to modern-js/module-tools/static/js/async/6800.b1b81661.js index 2cf815afab..3ca5313484 100644 --- a/modern-js/module-tools/static/js/async/4888.aefed6d6.js +++ b/modern-js/module-tools/static/js/async/6800.b1b81661.js @@ -1,2 +1,2 @@ -/*! For license information please see 4888.aefed6d6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4888"],{58682:function(e,s,n){"use strict";n.r(s);var i=n("39980"),d=n("9580");function l(e){let s=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ul:"ul",li:"li",strong:"strong",pre:"pre"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h1,{id:"handle-static-assets",children:["Handle static assets",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#handle-static-assets",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Modern.js Module will handle static assets used in the code. If configuration is required, then the ",(0,i.jsx)(s.a,{href:"/en/api/config/build-config#asset",children:(0,i.jsx)(s.code,{children:"buildConfig.asset"})})," API can be used."]}),"\n",(0,i.jsxs)(s.h2,{id:"default-behavior",children:["Default behavior",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#default-behavior",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"By default, Modern.js Module handles the following static assets:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.svg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.png'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.jpg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.jpeg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.gif'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.webp'"})]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.ttf'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.otf'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.woff'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.woff2'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.eot'"})]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.mp3'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.mp4'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.webm'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.ogg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.wav'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.flac'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.aac'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.mov'"})]}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"For the handling of static files, Modern.js Module currently supports the following functions."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["Set the static asset path to ",(0,i.jsx)(s.code,{children:". /assets"}),"."]}),"\n",(0,i.jsxs)(s.li,{children:["Files less than ",(0,i.jsx)(s.strong,{children:"10kb"})," will be inlined into the code."]}),"\n"]}),"\n",(0,i.jsxs)(s.h2,{id:"example",children:["Example",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Let us look at the following example:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Project source code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",meta:'title="./src/asset.ts"',children:"import img from './bg.png';\n//...\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["If the size of ",(0,i.jsx)(s.code,{children:"bg.png"})," is less than 10 kb, then the output directory structure and file content are."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:"./dist\n\u2514\u2500\u2500 asset.js\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"var bg_default = 'data:image/png;base64,';\nconsole.info(bg_default);\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["If the size of ",(0,i.jsx)(s.code,{children:"bg.png"})," is larger than 10 kb, then the output directory structure and file content are."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:"./dist\n\u251C\u2500\u2500 asset.js\n\u2514\u2500\u2500 assets\n \u2514\u2500\u2500 bg.13e2aba2.png\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"import img from './assets/bg.13e2aba2.png';\nconsole.info(img);\n"})}),"\n",(0,i.jsx)(s.p,{children:"When wanting to modify the default behavior, the following API can be used:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"asset.path"}),": modify the output path of the static assets."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"asset.limit"}),": modify the threshold value for inline assets."]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,d.ah)(),e.components);return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}s.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fasset.mdx"]={toc:[{text:"Default behavior",id:"default-behavior",depth:2},{text:"Example",id:"example",depth:2}],title:"Handle static assets",frontmatter:{sidebar_position:6}}}}]); \ No newline at end of file +/*! For license information please see 6800.b1b81661.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6800"],{68182:function(e,s,n){"use strict";n.r(s);var i=n("39980"),d=n("9580");function l(e){let s=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ul:"ul",li:"li",strong:"strong",pre:"pre"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h1,{id:"handle-static-assets",children:["Handle static assets",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#handle-static-assets",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Modern.js Module will handle static assets used in the code. If configuration is required, then the ",(0,i.jsx)(s.a,{href:"/en/api/config/build-config#asset",children:(0,i.jsx)(s.code,{children:"buildConfig.asset"})})," API can be used."]}),"\n",(0,i.jsxs)(s.h2,{id:"default-behavior",children:["Default behavior",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#default-behavior",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"By default, Modern.js Module handles the following static assets:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.svg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.png'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.jpg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.jpeg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.gif'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.webp'"})]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.ttf'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.otf'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.woff'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.woff2'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.eot'"})]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"'.mp3'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.mp4'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.webm'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.ogg'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.wav'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.flac'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.aac'"}),"\u3001",(0,i.jsx)(s.code,{children:"'.mov'"})]}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"For the handling of static files, Modern.js Module currently supports the following functions."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["Set the static asset path to ",(0,i.jsx)(s.code,{children:". /assets"}),"."]}),"\n",(0,i.jsxs)(s.li,{children:["Files less than ",(0,i.jsx)(s.strong,{children:"10kb"})," will be inlined into the code."]}),"\n"]}),"\n",(0,i.jsxs)(s.h2,{id:"example",children:["Example",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Let us look at the following example:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Project source code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",meta:'title="./src/asset.ts"',children:"import img from './bg.png';\n//...\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["If the size of ",(0,i.jsx)(s.code,{children:"bg.png"})," is less than 10 kb, then the output directory structure and file content are."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:"./dist\n\u2514\u2500\u2500 asset.js\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"var bg_default = 'data:image/png;base64,';\nconsole.info(bg_default);\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["If the size of ",(0,i.jsx)(s.code,{children:"bg.png"})," is larger than 10 kb, then the output directory structure and file content are."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:"./dist\n\u251C\u2500\u2500 asset.js\n\u2514\u2500\u2500 assets\n \u2514\u2500\u2500 bg.13e2aba2.png\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",meta:'title="./dist/asset.js"',children:"import img from './assets/bg.13e2aba2.png';\nconsole.info(img);\n"})}),"\n",(0,i.jsx)(s.p,{children:"When wanting to modify the default behavior, the following API can be used:"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"asset.path"}),": modify the output path of the static assets."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"asset.limit"}),": modify the threshold value for inline assets."]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,d.ah)(),e.components);return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}s.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fasset.mdx"]={toc:[{text:"Default behavior",id:"default-behavior",depth:2},{text:"Example",id:"example",depth:2}],title:"Handle static assets",frontmatter:{sidebar_position:6}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5977.c60808b6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/6800.b1b81661.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5977.c60808b6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/6800.b1b81661.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/7836.7593d13f.js b/modern-js/module-tools/static/js/async/705.8b38f041.js similarity index 98% rename from modern-js/module-tools/static/js/async/7836.7593d13f.js rename to modern-js/module-tools/static/js/async/705.8b38f041.js index f8a95098e9..26149a00d1 100644 --- a/modern-js/module-tools/static/js/async/7836.7593d13f.js +++ b/modern-js/module-tools/static/js/async/705.8b38f041.js @@ -1,2 +1,2 @@ -/*! For license information please see 7836.7593d13f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7836"],{6129:function(e,r,n){"use strict";n.r(r);var s=n("39980"),o=n("9580");function d(e){let r=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",strong:"strong",code:"code"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r.h1,{id:"\u6B22\u8FCE\u4F7F\u7528",children:["\u6B22\u8FCE\u4F7F\u7528",(0,s.jsx)(r.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6B22\u8FCE\u4F7F\u7528",children:"#"})]}),"\n",(0,s.jsx)(r.p,{children:"Modern.js Module \u662F Modern.js \u7684\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848\uFF0C\u540C\u65F6\u4E5F\u662F\u6838\u5FC3\u4F9D\u8D56\u3002\u5B83\u53EF\u4EE5\u8BA9\u5F00\u53D1\u8005\u66F4\u8F7B\u677E\u5730\u6784\u5EFA\u3001\u8C03\u8BD5\u3001\u53D1\u5E03\u6A21\u5757\u7C7B\u578B\u7684\u9879\u76EE\u3002\u6A21\u5757\u7C7B\u578B\u7684\u9879\u76EE\u5927\u591A\u6570\u60C5\u51B5\u53EF\u4EE5\u8BA4\u4E3A\u662F npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u5B83\u53EF\u80FD\u662F\u4E00\u4E2A\u7EC4\u4EF6\u3001\u7EC4\u4EF6\u5E93\u6216\u8005\u5DE5\u5177\u5E93\u9879\u76EE\u3002"}),"\n",(0,s.jsx)(r.p,{children:"\u5982\u679C\u4F60\u6B63\u6253\u7B97\u5F00\u53D1\u4E00\u4E2A npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u5C31\u6765\u5BF9\u5730\u65B9\u4E86\uFF01Modern.js \u63D0\u4F9B\u4E86\u4E13\u4E1A\u7684\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848\u3002\u5B83\u5E26\u6765\u4E86\uFF1A"}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u7B80\u5355\u7684\u9879\u76EE\u521D\u59CB\u5316"}),"\uFF1A\u4EC5\u9700\u6267\u884C ",(0,s.jsx)(r.code,{children:"npx @modern-js/create project-dir"})," \u547D\u4EE4\uFF0C\u7136\u540E\u8FDB\u884C\u51E0\u4E2A\u4EA4\u4E92\u95EE\u9898\uFF0C\u5C31\u53EF\u4EE5\u521B\u5EFA\u4E00\u4E2A\u5B8C\u6574\u7684\u6A21\u5757\u7C7B\u578B\u9879\u76EE\u3002\u521B\u5EFA\u7684\u9879\u76EE\u8FD8\u652F\u6301\u9009\u62E9 ",(0,s.jsx)(r.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(r.strong,{children:"pnpm"})}),"\u3001",(0,s.jsx)(r.a,{href:"https://classic.yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(r.strong,{children:"Yarn"})})," \u4E24\u79CD\u5305\u7BA1\u7406\u5668\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u4EE3\u7801\u683C\u5F0F\u5316"}),"\uFF1A\u5728\u6A21\u5757\u5DE5\u7A0B\u9879\u76EE\u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(r.code,{children:"modern lint"})," \u6765\u5BF9\u4EE3\u7801\u8FDB\u884C\u683C\u5F0F\u5316\u3002\u540C\u65F6\u521D\u59CB\u5316\u7684\u6A21\u5757\u5DE5\u7A0B\u9879\u76EE\u91CC\u5305\u542B\u4E86 Modern.js \u7684 ",(0,s.jsx)(r.a,{href:"https://eslint.org/docs/latest/user-guide/core-concepts#what-is-eslint",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," \u89C4\u5219\u96C6\uFF0C\u53EF\u4EE5\u6EE1\u8DB3\u5927\u90E8\u5206\u573A\u666F\u4E0B\u7684\u9700\u6C42\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u5168\u9762\u7684\u6784\u5EFA\u80FD\u529B\u548C\u66F4\u5FEB\u7684\u6784\u5EFA\u901F\u5EA6"}),"\uFF1AModern.js Module \u57FA\u4E8E ",(0,s.jsx)(r.a,{href:"https://esbuild.github.io/getting-started/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," \u548C ",(0,s.jsx)(r.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," \u63D0\u4F9B\u4E86\u9AD8\u6027\u80FD\u7684\u6784\u5EFA\u80FD\u529B\uFF0C\u5E76\u4E14\u4E3A\u4E0D\u540C\u6784\u5EFA\u6A21\u5757\u7684\u573A\u666F\u63D0\u4F9B\u4E86\u4E30\u5BCC\u7684\u914D\u7F6E\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"Storybook \u8C03\u8BD5\u5DE5\u5177"}),"\uFF1AModern.js Module \u4E3A\u8C03\u8BD5\u6A21\u5757\u9879\u76EE\u63D0\u4F9B\u4E86 ",(0,s.jsx)(r.a,{href:"https://storybook.js.org/",target:"_blank",rel:"noopener noreferrer",children:"Storybook"})," \u8C03\u8BD5\u5DE5\u5177\u3002\u5728\u5B89\u88C5\u4E86 Modern.js Module \u7684 Storybook \u63D2\u4EF6\u540E\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"storybook dev"})," \u547D\u4EE4\u6765\u542F\u52A8\u5B83\u3002\u4F60\u4E0D\u4EC5\u53EF\u4EE5\u4F7F\u7528 Storybook \u5BF9\u7EC4\u4EF6\u8FDB\u884C\u8C03\u8BD5\uFF0C\u4E5F\u53EF\u4EE5\u4F7F\u7528\u5728\u5176\u4ED6\u7C7B\u578B\u7684\u6A21\u5757\u4E0A\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u96C6\u6210 Jest \u7684\u6D4B\u8BD5\u80FD\u529B"}),"\uFF1A\u5728\u9700\u8981\u5BF9\u6A21\u5757\u6D4B\u8BD5\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 Modern.js Module \u7684 ",(0,s.jsx)(r.code,{children:"modern test"})," \u547D\u4EE4\u3002Modern.js Module \u4E0D\u4EC5\u96C6\u6210\u4E86 ",(0,s.jsx)(r.a,{href:"https://jestjs.io/",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),"\uFF0C\u540C\u65F6\u4E5F\u63D0\u4F9B\u4E86\u914D\u7F6E ",(0,s.jsx)(r.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"})," \u7684 API\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u57FA\u4E8E Changesets \u5B9E\u73B0\u7684\u7248\u672C\u7BA1\u7406"}),"\uFF1A\u5F53\u9700\u8981\u5BF9\u9879\u76EE\u8BB0\u5F55\u53D8\u66F4\u5185\u5BB9\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern change"})," \u547D\u4EE4\u751F\u6210\u5305\u542B\u53D8\u66F4\u5185\u5BB9\u7684 Markdown \u6587\u4EF6\uFF1B\u5F53\u9700\u8981\u5BF9\u9879\u76EE\u8FDB\u884C\u7248\u672C\u5347\u7EA7\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern bump"})," \u547D\u4EE4\u901A\u8FC7 Markdown \u6587\u4EF6\u5206\u6790\u5E76\u5347\u7EA7\u7248\u672C\uFF1B\u5F53\u9700\u8981\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern release"})," \u547D\u4EE4\u5BF9\u9879\u76EE\u8FDB\u884C\u53D1\u5E03\u3002Modern.js Module \u57FA\u4E8E ",(0,s.jsx)(r.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"Changesets"})," \u5B9E\u73B0\u4E86\u8FD9\u4E9B\u547D\u4EE4\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u53EF\u6269\u5C55\u6027\u7684\u63D2\u4EF6\u673A\u5236"}),"\uFF1A\u60F3\u8981\u4E3A\u9879\u76EE\u96C6\u6210\u5176\u4ED6\u7684\u8C03\u8BD5\u5DE5\u5177\uFF1F\u53C8\u6216\u8005\u662F\u60F3\u8981\u5728\u6784\u5EFA\u8FC7\u7A0B\u4E2D\u505A\u4E00\u4E9B\u989D\u5916\u5904\u7406\uFF1FModern.js Module \u63D0\u4F9B\u4E86\u63D2\u4EF6\u673A\u5236\u548C\u63D2\u4EF6\u94A9\u5B50\uFF0C\u63D2\u4EF6\u94A9\u5B50\u8986\u76D6\u4E86 ",(0,s.jsx)(r.code,{children:"dev"})," \u547D\u4EE4\u548C ",(0,s.jsx)(r.code,{children:"build"})," \u547D\u4EE4\u4E24\u4E2A\u6D41\u7A0B\u3002\u4F60\u53EF\u4EE5\u901A\u8FC7\u5B83\u4EEC\u4E3A\u9879\u76EE\u8FDB\u884C\u80FD\u529B\u7684\u6269\u5C55\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u8FD8\u6709\u66F4\u591A"}),"\uFF1AModern.js Module \u5728\u672A\u6765\u8FD8\u4F1A\u4E0D\u65AD\u5730\u5728\u6784\u5EFA\u3001\u8C03\u8BD5\u529F\u80FD\u4E0A\u8FDB\u884C\u4F18\u5316\u3002\u5982\u679C\u5728\u6A21\u5757\u9879\u76EE\u6784\u5EFA\u4E0A\u5B58\u5728\u9700\u8981\u89E3\u51B3\u7684\u91CD\u8981\u95EE\u9898\uFF0C\u53C8\u6216\u8005\u662F\u67D0\u4E2A\u4E3B\u6D41\u7684\u6A21\u5757\u9879\u76EE\u8C03\u8BD5\u5DE5\u5177\u3001\u6A21\u5F0F\u51FA\u73B0\u7684\u65F6\u5019\uFF0C\u90A3\u4E48\u5B83\u4EEC\u5F88\u53EF\u80FD\u6210\u4E3A Modern.js Module \u5C06\u8981\u652F\u6301\u529F\u80FD\u3002"]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:r}=Object.assign({},(0,o.ah)(),e.components);return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}r.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fintro%2Fwelcome.md"]={toc:[],title:"\u6B22\u8FCE\u4F7F\u7528",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 705.8b38f041.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["705"],{67530:function(e,r,n){"use strict";n.r(r);var s=n("39980"),o=n("9580");function d(e){let r=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",strong:"strong",code:"code"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r.h1,{id:"\u6B22\u8FCE\u4F7F\u7528",children:["\u6B22\u8FCE\u4F7F\u7528",(0,s.jsx)(r.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6B22\u8FCE\u4F7F\u7528",children:"#"})]}),"\n",(0,s.jsx)(r.p,{children:"Modern.js Module \u662F Modern.js \u7684\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848\uFF0C\u540C\u65F6\u4E5F\u662F\u6838\u5FC3\u4F9D\u8D56\u3002\u5B83\u53EF\u4EE5\u8BA9\u5F00\u53D1\u8005\u66F4\u8F7B\u677E\u5730\u6784\u5EFA\u3001\u8C03\u8BD5\u3001\u53D1\u5E03\u6A21\u5757\u7C7B\u578B\u7684\u9879\u76EE\u3002\u6A21\u5757\u7C7B\u578B\u7684\u9879\u76EE\u5927\u591A\u6570\u60C5\u51B5\u53EF\u4EE5\u8BA4\u4E3A\u662F npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u5B83\u53EF\u80FD\u662F\u4E00\u4E2A\u7EC4\u4EF6\u3001\u7EC4\u4EF6\u5E93\u6216\u8005\u5DE5\u5177\u5E93\u9879\u76EE\u3002"}),"\n",(0,s.jsx)(r.p,{children:"\u5982\u679C\u4F60\u6B63\u6253\u7B97\u5F00\u53D1\u4E00\u4E2A npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u5C31\u6765\u5BF9\u5730\u65B9\u4E86\uFF01Modern.js \u63D0\u4F9B\u4E86\u4E13\u4E1A\u7684\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848\u3002\u5B83\u5E26\u6765\u4E86\uFF1A"}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u7B80\u5355\u7684\u9879\u76EE\u521D\u59CB\u5316"}),"\uFF1A\u4EC5\u9700\u6267\u884C ",(0,s.jsx)(r.code,{children:"npx @modern-js/create project-dir"})," \u547D\u4EE4\uFF0C\u7136\u540E\u8FDB\u884C\u51E0\u4E2A\u4EA4\u4E92\u95EE\u9898\uFF0C\u5C31\u53EF\u4EE5\u521B\u5EFA\u4E00\u4E2A\u5B8C\u6574\u7684\u6A21\u5757\u7C7B\u578B\u9879\u76EE\u3002\u521B\u5EFA\u7684\u9879\u76EE\u8FD8\u652F\u6301\u9009\u62E9 ",(0,s.jsx)(r.a,{href:"https://pnpm.io/",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(r.strong,{children:"pnpm"})}),"\u3001",(0,s.jsx)(r.a,{href:"https://classic.yarnpkg.com/",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(r.strong,{children:"Yarn"})})," \u4E24\u79CD\u5305\u7BA1\u7406\u5668\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u4EE3\u7801\u683C\u5F0F\u5316"}),"\uFF1A\u5728\u6A21\u5757\u5DE5\u7A0B\u9879\u76EE\u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(r.code,{children:"modern lint"})," \u6765\u5BF9\u4EE3\u7801\u8FDB\u884C\u683C\u5F0F\u5316\u3002\u540C\u65F6\u521D\u59CB\u5316\u7684\u6A21\u5757\u5DE5\u7A0B\u9879\u76EE\u91CC\u5305\u542B\u4E86 Modern.js \u7684 ",(0,s.jsx)(r.a,{href:"https://eslint.org/docs/latest/user-guide/core-concepts#what-is-eslint",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," \u89C4\u5219\u96C6\uFF0C\u53EF\u4EE5\u6EE1\u8DB3\u5927\u90E8\u5206\u573A\u666F\u4E0B\u7684\u9700\u6C42\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u5168\u9762\u7684\u6784\u5EFA\u80FD\u529B\u548C\u66F4\u5FEB\u7684\u6784\u5EFA\u901F\u5EA6"}),"\uFF1AModern.js Module \u57FA\u4E8E ",(0,s.jsx)(r.a,{href:"https://esbuild.github.io/getting-started/",target:"_blank",rel:"noopener noreferrer",children:"esbuild"})," \u548C ",(0,s.jsx)(r.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," \u63D0\u4F9B\u4E86\u9AD8\u6027\u80FD\u7684\u6784\u5EFA\u80FD\u529B\uFF0C\u5E76\u4E14\u4E3A\u4E0D\u540C\u6784\u5EFA\u6A21\u5757\u7684\u573A\u666F\u63D0\u4F9B\u4E86\u4E30\u5BCC\u7684\u914D\u7F6E\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"Storybook \u8C03\u8BD5\u5DE5\u5177"}),"\uFF1AModern.js Module \u4E3A\u8C03\u8BD5\u6A21\u5757\u9879\u76EE\u63D0\u4F9B\u4E86 ",(0,s.jsx)(r.a,{href:"https://storybook.js.org/",target:"_blank",rel:"noopener noreferrer",children:"Storybook"})," \u8C03\u8BD5\u5DE5\u5177\u3002\u5728\u5B89\u88C5\u4E86 Modern.js Module \u7684 Storybook \u63D2\u4EF6\u540E\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"storybook dev"})," \u547D\u4EE4\u6765\u542F\u52A8\u5B83\u3002\u4F60\u4E0D\u4EC5\u53EF\u4EE5\u4F7F\u7528 Storybook \u5BF9\u7EC4\u4EF6\u8FDB\u884C\u8C03\u8BD5\uFF0C\u4E5F\u53EF\u4EE5\u4F7F\u7528\u5728\u5176\u4ED6\u7C7B\u578B\u7684\u6A21\u5757\u4E0A\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u96C6\u6210 Jest \u7684\u6D4B\u8BD5\u80FD\u529B"}),"\uFF1A\u5728\u9700\u8981\u5BF9\u6A21\u5757\u6D4B\u8BD5\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 Modern.js Module \u7684 ",(0,s.jsx)(r.code,{children:"modern test"})," \u547D\u4EE4\u3002Modern.js Module \u4E0D\u4EC5\u96C6\u6210\u4E86 ",(0,s.jsx)(r.a,{href:"https://jestjs.io/",target:"_blank",rel:"noopener noreferrer",children:"Jest"}),"\uFF0C\u540C\u65F6\u4E5F\u63D0\u4F9B\u4E86\u914D\u7F6E ",(0,s.jsx)(r.a,{href:"https://jestjs.io/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Jest"})," \u7684 API\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u57FA\u4E8E Changesets \u5B9E\u73B0\u7684\u7248\u672C\u7BA1\u7406"}),"\uFF1A\u5F53\u9700\u8981\u5BF9\u9879\u76EE\u8BB0\u5F55\u53D8\u66F4\u5185\u5BB9\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern change"})," \u547D\u4EE4\u751F\u6210\u5305\u542B\u53D8\u66F4\u5185\u5BB9\u7684 Markdown \u6587\u4EF6\uFF1B\u5F53\u9700\u8981\u5BF9\u9879\u76EE\u8FDB\u884C\u7248\u672C\u5347\u7EA7\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern bump"})," \u547D\u4EE4\u901A\u8FC7 Markdown \u6587\u4EF6\u5206\u6790\u5E76\u5347\u7EA7\u7248\u672C\uFF1B\u5F53\u9700\u8981\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(r.code,{children:"modern release"})," \u547D\u4EE4\u5BF9\u9879\u76EE\u8FDB\u884C\u53D1\u5E03\u3002Modern.js Module \u57FA\u4E8E ",(0,s.jsx)(r.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"Changesets"})," \u5B9E\u73B0\u4E86\u8FD9\u4E9B\u547D\u4EE4\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u53EF\u6269\u5C55\u6027\u7684\u63D2\u4EF6\u673A\u5236"}),"\uFF1A\u60F3\u8981\u4E3A\u9879\u76EE\u96C6\u6210\u5176\u4ED6\u7684\u8C03\u8BD5\u5DE5\u5177\uFF1F\u53C8\u6216\u8005\u662F\u60F3\u8981\u5728\u6784\u5EFA\u8FC7\u7A0B\u4E2D\u505A\u4E00\u4E9B\u989D\u5916\u5904\u7406\uFF1FModern.js Module \u63D0\u4F9B\u4E86\u63D2\u4EF6\u673A\u5236\u548C\u63D2\u4EF6\u94A9\u5B50\uFF0C\u63D2\u4EF6\u94A9\u5B50\u8986\u76D6\u4E86 ",(0,s.jsx)(r.code,{children:"dev"})," \u547D\u4EE4\u548C ",(0,s.jsx)(r.code,{children:"build"})," \u547D\u4EE4\u4E24\u4E2A\u6D41\u7A0B\u3002\u4F60\u53EF\u4EE5\u901A\u8FC7\u5B83\u4EEC\u4E3A\u9879\u76EE\u8FDB\u884C\u80FD\u529B\u7684\u6269\u5C55\u3002"]}),"\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.strong,{children:"\u8FD8\u6709\u66F4\u591A"}),"\uFF1AModern.js Module \u5728\u672A\u6765\u8FD8\u4F1A\u4E0D\u65AD\u5730\u5728\u6784\u5EFA\u3001\u8C03\u8BD5\u529F\u80FD\u4E0A\u8FDB\u884C\u4F18\u5316\u3002\u5982\u679C\u5728\u6A21\u5757\u9879\u76EE\u6784\u5EFA\u4E0A\u5B58\u5728\u9700\u8981\u89E3\u51B3\u7684\u91CD\u8981\u95EE\u9898\uFF0C\u53C8\u6216\u8005\u662F\u67D0\u4E2A\u4E3B\u6D41\u7684\u6A21\u5757\u9879\u76EE\u8C03\u8BD5\u5DE5\u5177\u3001\u6A21\u5F0F\u51FA\u73B0\u7684\u65F6\u5019\uFF0C\u90A3\u4E48\u5B83\u4EEC\u5F88\u53EF\u80FD\u6210\u4E3A Modern.js Module \u5C06\u8981\u652F\u6301\u529F\u80FD\u3002"]}),"\n"]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:r}=Object.assign({},(0,o.ah)(),e.components);return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}r.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fintro%2Fwelcome.md"]={toc:[],title:"\u6B22\u8FCE\u4F7F\u7528",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5994.b1a304bb.js.LICENSE.txt b/modern-js/module-tools/static/js/async/705.8b38f041.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/5994.b1a304bb.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/705.8b38f041.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/1980.79b63473.js b/modern-js/module-tools/static/js/async/7115.001bfea1.js similarity index 79% rename from modern-js/module-tools/static/js/async/1980.79b63473.js rename to modern-js/module-tools/static/js/async/7115.001bfea1.js index 1cdebe2989..b70ed862b9 100644 --- a/modern-js/module-tools/static/js/async/1980.79b63473.js +++ b/modern-js/module-tools/static/js/async/7115.001bfea1.js @@ -1,2 +1,2 @@ -/*! For license information please see 1980.79b63473.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["1980"],{42137:function(t,e,n){"use strict";n.r(e);var o=n("39980"),s=n("9580");function _(t){return(0,o.jsx)(o.Fragment,{})}function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),t.components);return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(_,{...t})}):_(t)}e.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-product.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 7115.001bfea1.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7115"],{91882:function(t,e,n){"use strict";n.r(e);var o=n("39980"),s=n("9580");function _(t){return(0,o.jsx)(o.Fragment,{})}function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),t.components);return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(_,{...t})}):_(t)}e.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-product.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6111.89a3f56e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/7115.001bfea1.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6111.89a3f56e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/7115.001bfea1.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/721.4493e1c6.js b/modern-js/module-tools/static/js/async/721.4493e1c6.js deleted file mode 100644 index 7bd5338176..0000000000 --- a/modern-js/module-tools/static/js/async/721.4493e1c6.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 721.4493e1c6.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["721"],{14078:function(e,t,n){"use strict";n.r(t);var i=n("39980"),o=n("9580");function s(e){let t=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,i.jsxs)(t.h1,{id:"index",children:["index",(0,i.jsx)(t.a,{className:"header-anchor","aria-hidden":"true",href:"#index",children:"#"})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,o.ah)(),e.components);return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(s,{...e})}):s(e)}t.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Findex.md"]={toc:[],title:"index",frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Jest: \u4EE4\u4EBA\u6109\u5FEB\u7684\u6D4B\u8BD5\u6846\u67B6",details:"\u96C6\u6210\u4E86 Jest\uFF0C\u4F7F\u5F97\u4EE3\u7801\u6D4B\u8BD5\u66F4\u52A0\u5BB9\u6613\u3002",icon:"\uD83D\uDCD0"}]}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7227.47916665.js b/modern-js/module-tools/static/js/async/7227.47916665.js deleted file mode 100644 index 7bee0a88ea..0000000000 --- a/modern-js/module-tools/static/js/async/7227.47916665.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 7227.47916665.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7227"],{53336:function(n,e,d){"use strict";d.r(e);var i=d("39980"),s=d("9580");function l(n){let e=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ol:"ol",li:"li",ul:"ul",pre:"pre"},(0,s.ah)(),n.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e.h1,{id:"\u6DF1\u5165\u7406\u89E3-dev-\u547D\u4EE4",children:["\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6DF1\u5165\u7406\u89E3-dev-\u547D\u4EE4",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:["Modern.js Module \u63D0\u4F9B\u7684 ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u4E3B\u8981\u7528\u4E8E\u4EE3\u7801\u7684\u8C03\u8BD5\u3002"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",children:["\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",children:"#"})]}),"\n",(0,i.jsxs)(e.ol,{children:["\n",(0,i.jsxs)(e.li,{children:["\u5F53\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0CModern.js Module \u5F00\u59CB\u5BFB\u627E\u662F\u5426\u5B58\u5728\u53EF\u4EE5\u6267\u884C\u7684\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u3002\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u5C31\u662F\u7C7B\u4F3C doc \u8FD9\u6837\u7684 Modern.js Module \u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\u3002"]}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u53D1\u73B0\u5B58\u5728\u4E00\u4E2A\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u4F1A\u7ACB\u5373\u6267\u884C\u5B83\u3002"}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u53D1\u73B0\u591A\u4E2A\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u663E\u793A\u8C03\u8BD5\u5DE5\u5177\u5217\u8868\u83DC\u5355\u3002\u53EF\u4EE5\u901A\u8FC7\u9009\u62E9\u67D0\u4E2A\u8C03\u8BD5\u5DE5\u5177\u5BF9\u5E94\u7684\u540D\u79F0\u9009\u9879\u542F\u52A8\u5B83\u3002"}),"\n",(0,i.jsx)(e.li,{children:"\u5F53\u6CA1\u6709\u53D1\u73B0\u8C03\u8BD5\u5DE5\u5177\u7684\u65F6\u5019\uFF0C\u5219\u544A\u8BC9\u7528\u6237\u6CA1\u6709\u53EF\u7528\u7684\u8C03\u8BD5\u5DE5\u5177\u3002"}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:["\u6211\u4EEC\u9664\u4E86\u53EF\u4EE5\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u547D\u4EE4\u4EE5\u5916\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(e.code,{children:"dev [\u8C03\u8BD5\u5DE5\u5177\u540D\u79F0]"})," \u7684\u65B9\u5F0F\u6765\u76F4\u63A5\u542F\u52A8\u8C03\u8BD5\u5DE5\u5177\u6216\u8005\u4EFB\u52A1\u3002"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u6269\u5C55-dev-\u547D\u4EE4",children:["\u6269\u5C55 dev \u547D\u4EE4",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6269\u5C55-dev-\u547D\u4EE4",children:"#"})]}),"\n",(0,i.jsx)(e.p,{children:"\u5982\u679C\u9700\u8981\u6269\u5C55 dev \u547D\u4EE4\u6216\u8005\u8BF4\u63D0\u4F9B\u81EA\u5DF1\u7684 Modern.js Module \u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5148\u4E86\u89E3\u4EE5\u4E0B\u5185\u5BB9\uFF1A"}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/plugins/guide/getting-started",children:"\u5F00\u53D1\u63D2\u4EF6"})}),"\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/plugin-api/plugin-hooks#%E8%B0%83%E8%AF%95%E9%92%A9%E5%AD%90",children:"\u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6 API"})}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:"\u4E00\u822C\u6765\u8BF4\uFF0C\u5B9E\u73B0\u4E00\u4E2A\u4EC0\u4E48\u90FD\u4E0D\u505A\u7684\u8C03\u8BD5\u5DE5\u5177\uFF0C\u5176\u5B9E\u73B0\u4EE3\u7801\u4EE5\u53CA\u76F8\u5173\u914D\u7F6E\u5982\u4E0B\uFF1A"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",meta:"do-nothing.ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'do-nothing',\n setup() {\n return {\n registerDev() {\n return {\n // \u8C03\u8BD5\u5DE5\u5177\u540D\u79F0\n name: 'do-nothing',\n // \u83DC\u5355\u663E\u793A\u5185\u5BB9\n menuItem: {\n name: 'DoNothing',\n value: 'do-nothing',\n },\n // \u5B9A\u4E49\u7684 dev \u5B50\u547D\u4EE4\n subCommands: ['donothing', 'dn'],\n async action() {\n // dev logic\n console.info('Run build --watch, and do nothing.');\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,i.jsx)(e.p,{children:"\u5982\u679C\u9700\u8981\u4F7F\u7528\u8BE5\u8C03\u8BD5\u5DE5\u5177\u63D2\u4EF6\uFF0C\u5219\u9700\u8981\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u589E\u52A0\u5B83\uFF1A"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"import doNothingPlugin from './plugins/do-nothing';\n\nexport default defineConfig({\n plugins: [\n //..\n doNothingPlugin()\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u6B64\u65F6\u6211\u4EEC\u6267\u884C ",(0,i.jsx)(e.code,{children:"dev"})," \u6216\u8005 ",(0,i.jsx)(e.code,{children:"dev do-nothing"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C\u5B83\u4E86\u3002\u5728\u6267\u884C\u540E\uFF0C\u5B83\u4F1A\u5148\u6267\u884C\u76D1\u542C\u6A21\u5F0F\u7684\u6E90\u7801\u6784\u5EFA\u4EFB\u52A1\uFF0C\u5E76\u7D27\u63A5\u7740\u6253\u5370\u65E5\u5FD7\u4FE1\u606F\u3002"]}),"\n",(0,i.jsxs)(e.p,{children:["\u5BF9\u4E8E\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\u548C\u7B2C\u4E09\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\uFF0C\u53EF\u4EE5\u5728",(0,i.jsx)(e.a,{href:"/plugins/official-list/overview",children:"\u63D2\u4EF6\u5217\u8868"}),"\u4E2D\u67E5\u770B\u3002"]})]})}function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,s.ah)(),n.components);return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(l,{...n})}):l(n)}e.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fin-depth-about-dev-command.md"]={toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2}],title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/4465.3480ef34.js b/modern-js/module-tools/static/js/async/7287.f2f905cd.js similarity index 99% rename from modern-js/module-tools/static/js/async/4465.3480ef34.js rename to modern-js/module-tools/static/js/async/7287.f2f905cd.js index 194b4ef30e..01f4906321 100644 --- a/modern-js/module-tools/static/js/async/4465.3480ef34.js +++ b/modern-js/module-tools/static/js/async/7287.f2f905cd.js @@ -1,2 +1,2 @@ -/*! For license information please see 4465.3480ef34.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4465"],{41060:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",pre:"pre",ul:"ul",li:"li",em:"em",div:"div"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"cli-commands",children:["CLI Commands",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cli-commands",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"CLI Commands available for Modern.js Module projects are as follows:"}),"\n",(0,s.jsxs)(n.h2,{id:"modern-build",children:[(0,s.jsx)(n.code,{children:"modern build"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-build",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern build [options]\n\nBuild module command\n\nOptions:\n -w, --watch Enable watch mode to listen for changes on the fs and automatically rebuild\n --tsconfig [tsconfig] Specify the path to the tsconfig.json file (default:\n ". /tsconfig.json")\n --platform [platform] Build artifacts for all or specified platforms\n --no-dts disables DTS type file generation and type checking\n --no-clear disables automatic clearing of output directories\n -c, --config Specify the path to the config file (default: "modern.config.j(t)s")\n -h, --help Show information about the current command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Modern.js Module supports the ",(0,s.jsx)(n.code,{children:"platform"})," build mode, which can be used to execute build tasks of other tools. Currently, the official support includes ",(0,s.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),". For example, you can start the doc build task to generate doc products by executing the ",(0,s.jsx)(n.code,{children:"modern build --platform"})," commands."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-new",children:[(0,s.jsx)(n.code,{children:"modern new"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-new",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern new [options]\n\nExecute the generator in a modular project scenario\n\nOptions:\n -d, --debug Enable Debug mode, print debug log messages (default: false)\n -c, --config Generators run default configuration (JSON string)\n --dist-tag Generator uses a special version of npm Tag\n --registry customize npm Registry during generator runtime\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern new"})," command is used to start the microgenerator functionality, which enables features for the project that are not provided by default."]}),"\n",(0,s.jsx)(n.p,{children:"The following features can currently be enabled."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Testing support"}),"\n",(0,s.jsx)(n.li,{children:"Storybook V7"}),"\n",(0,s.jsx)(n.li,{children:"Tailwind CSS support"}),"\n",(0,s.jsx)(n.li,{children:"Modern.js Runtime API"}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["You can learn more about these features in the ",(0,s.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"Using the micro generator"})," section."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-dev",children:[(0,s.jsx)(n.code,{children:"modern dev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-dev",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern dev [options]\n\nLocal development commands\n\nOptions:\n -h, --help display help for command\n\nCommands:\n[dev-tools-subCommand]\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The Modern.js Module provides the ability to use debugging tools, which can be started with the ",(0,s.jsx)(n.code,{children:"modern dev"})," command. Note, however, that no debugging-related plugins are provided by default, so executing ",(0,s.jsx)(n.code,{children:"modern dev"})," will prompt: ",(0,s.jsx)(n.em,{children:'"No dev tools found available "'}),"."]}),"\n",(0,s.jsxs)(n.p,{children:["The officially supported debugging tool is ",(0,s.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),", so you can run ",(0,s.jsx)(n.code,{children:"modern dev"})," or ",(0,s.jsx)(n.code,{children:"modern dev doc"})," to execute it after you run ",(0,s.jsx)(n.code,{children:"modern new"})," to enable it."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-test",children:[(0,s.jsx)(n.code,{children:"modern test"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-test",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern test [options]\n\nOptions:\n -u --updateSnapshot use this flag to re-record snapshots.\n --watch watch files for changes and rerun tests related to changed files.\n -h, --help show command help\n"})}),"\n",(0,s.jsxs)(n.p,{children:["You need to execute ",(0,s.jsx)(n.code,{children:"modern new"})," to turn on the test function before you can execute the ",(0,s.jsx)(n.code,{children:"modern test"})," command.\nThe ",(0,s.jsx)(n.code,{children:"modern test"})," command will automatically run the ",(0,s.jsx)(n.code,{children:"src/tests/*.test.(js|ts|jsx|tsx)"})," file as a test case."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-lint",children:[(0,s.jsx)(n.code,{children:"modern lint"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-lint",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern lint [options] [. .files]\n\nlint and fix source files\n\nOptions:\n --no-fix disable auto fix source file\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Run ",(0,s.jsx)(n.a,{href:"https://eslint.org/",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," to check the syntax of the code. Usually, we only need to check the part of the code that was changed in this commit with ",(0,s.jsx)(n.a,{href:"https://github.com/okonet/lint-staged",target:"_blank",rel:"noopener noreferrer",children:"lint-staged"})," during the ",(0,s.jsx)(n.code,{children:"-git commit"})," phase."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["The ",(0,s.jsx)(n.code,{children:"-no-fix"})," argument turns off the ability to automatically fix lint error code."]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-change",children:[(0,s.jsx)(n.code,{children:"modern change"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-change",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern change [options]\n\nCreate a changeset\n\nOptions:\n --empty Create an empty changeset (default: false)\n --open Open the created changeset in the editor (default: false)\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern change"})," command is used to generate the required Markdown file for ",(0,s.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"}),"."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-pre",children:[(0,s.jsx)(n.code,{children:"modern pre"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-pre",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern pre [options] [tag]\n\nEntering and exiting pre-publishing mode\n\nOptions:\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["You can use the ",(0,s.jsx)(n.code,{children:"modern pre"})," command to ",(0,s.jsx)(n.a,{href:"https://github.com/atlassian/changesets/blob/main/docs/prereleases.md",target:"_blank",rel:"noopener noreferrer",children:"pre-release"})," a version before the official release."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-bump",children:[(0,s.jsx)(n.code,{children:"modern bump"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-bump",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern bump [options]\n\nUse changesets to automatically update releases and changelogs\n\nOptions:\n --canary Create a pre-release for testing (default: false)\n --preid Specify an identifier when versioning a pre-release (default: "next")\n --snapshot Create a special version for testing (default: false)\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Modify the version number in ",(0,s.jsx)(n.code,{children:"package.json"})," according to the Markdown file of the changelog generated by ",(0,s.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"}),", and generate the ",(0,s.jsx)(n.code,{children:"CHANGELOG.md"})," file."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-release",children:[(0,s.jsx)(n.code,{children:"modern release"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-release",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern release [options]\n\nRelease npm packages\n\nOptions:\n --tag Release npm packages with a specific tag (default: "")\n --ignore-scripts release ignores the scripts command in package.json, only supported in pnpm monorepo\n (default: "")\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"-modern release"})," command releases the module to the ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["The ",(0,s.jsx)(n.code,{children:"-tag"})," argument specifies the specific ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/adding-dist-tags-to-packages",target:"_blank",rel:"noopener noreferrer",children:"dist tags"})," to be used for the release."]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-gen-release-note",children:[(0,s.jsx)(n.code,{children:"modern gen-release-note"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-gen-release-note",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern gen-release-note [options]\n\nGenerate Release Note based on current repository changeset information\n\nOptions:\n --repo The name of the repository to generate the Pull Request link, e.g.: web-infra-dev/modern.js\n --custom Custom Release Note generation function\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Automatically generate ",(0,s.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Release_notes",target:"_blank",rel:"noopener noreferrer",children:"Release Note"})," based on the changeset information of the current repository."]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["needs to be executed before the ",(0,s.jsx)(n.code,{children:"bump"})," command.\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-upgrade",children:[(0,s.jsx)(n.code,{children:"modern upgrade"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-upgrade",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern upgrade [options]\n\nUpgrade Modern.js to the latest version\n\nOptions:\n --registry customize npm registry (default: "")\n -d,--debug Enable Debug mode to print debug log messages (default: false)\n --cwd project path (default: "")\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern upgrade"})," command is used to upgrade the project Modern.js related dependencies to the latest version."]}),"\n",(0,s.jsxs)(n.p,{children:["Executing the command ",(0,s.jsx)(n.code,{children:"npx modern upgrade"})," in the project root directory will update the Modern.js dependencies in ",(0,s.jsx)(n.code,{children:"package.json"})," of the currently executing project to the latest version by default."]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fcommand-preview.md"]={toc:[{text:"`modern build`",id:"modern-build",depth:2},{text:"`modern new`",id:"modern-new",depth:2},{text:"`modern dev`",id:"modern-dev",depth:2},{text:"`modern test`",id:"modern-test",depth:2},{text:"`modern lint`",id:"modern-lint",depth:2},{text:"`modern change`",id:"modern-change",depth:2},{text:"`modern pre`",id:"modern-pre",depth:2},{text:"`modern bump`",id:"modern-bump",depth:2},{text:"`modern release`",id:"modern-release",depth:2},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2},{text:"`modern upgrade`",id:"modern-upgrade",depth:2}],title:"CLI Commands",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 7287.f2f905cd.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7287"],{82632:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",pre:"pre",ul:"ul",li:"li",em:"em",div:"div"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"cli-commands",children:["CLI Commands",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cli-commands",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"CLI Commands available for Modern.js Module projects are as follows:"}),"\n",(0,s.jsxs)(n.h2,{id:"modern-build",children:[(0,s.jsx)(n.code,{children:"modern build"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-build",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern build [options]\n\nBuild module command\n\nOptions:\n -w, --watch Enable watch mode to listen for changes on the fs and automatically rebuild\n --tsconfig [tsconfig] Specify the path to the tsconfig.json file (default:\n ". /tsconfig.json")\n --platform [platform] Build artifacts for all or specified platforms\n --no-dts disables DTS type file generation and type checking\n --no-clear disables automatic clearing of output directories\n -c, --config Specify the path to the config file (default: "modern.config.j(t)s")\n -h, --help Show information about the current command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Modern.js Module supports the ",(0,s.jsx)(n.code,{children:"platform"})," build mode, which can be used to execute build tasks of other tools. Currently, the official support includes ",(0,s.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),". For example, you can start the doc build task to generate doc products by executing the ",(0,s.jsx)(n.code,{children:"modern build --platform"})," commands."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-new",children:[(0,s.jsx)(n.code,{children:"modern new"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-new",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern new [options]\n\nExecute the generator in a modular project scenario\n\nOptions:\n -d, --debug Enable Debug mode, print debug log messages (default: false)\n -c, --config Generators run default configuration (JSON string)\n --dist-tag Generator uses a special version of npm Tag\n --registry customize npm Registry during generator runtime\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern new"})," command is used to start the microgenerator functionality, which enables features for the project that are not provided by default."]}),"\n",(0,s.jsx)(n.p,{children:"The following features can currently be enabled."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Testing support"}),"\n",(0,s.jsx)(n.li,{children:"Storybook V7"}),"\n",(0,s.jsx)(n.li,{children:"Tailwind CSS support"}),"\n",(0,s.jsx)(n.li,{children:"Modern.js Runtime API"}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["You can learn more about these features in the ",(0,s.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"Using the micro generator"})," section."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-dev",children:[(0,s.jsx)(n.code,{children:"modern dev"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-dev",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern dev [options]\n\nLocal development commands\n\nOptions:\n -h, --help display help for command\n\nCommands:\n[dev-tools-subCommand]\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The Modern.js Module provides the ability to use debugging tools, which can be started with the ",(0,s.jsx)(n.code,{children:"modern dev"})," command. Note, however, that no debugging-related plugins are provided by default, so executing ",(0,s.jsx)(n.code,{children:"modern dev"})," will prompt: ",(0,s.jsx)(n.em,{children:'"No dev tools found available "'}),"."]}),"\n",(0,s.jsxs)(n.p,{children:["The officially supported debugging tool is ",(0,s.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),", so you can run ",(0,s.jsx)(n.code,{children:"modern dev"})," or ",(0,s.jsx)(n.code,{children:"modern dev doc"})," to execute it after you run ",(0,s.jsx)(n.code,{children:"modern new"})," to enable it."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-test",children:[(0,s.jsx)(n.code,{children:"modern test"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-test",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern test [options]\n\nOptions:\n -u --updateSnapshot use this flag to re-record snapshots.\n --watch watch files for changes and rerun tests related to changed files.\n -h, --help show command help\n"})}),"\n",(0,s.jsxs)(n.p,{children:["You need to execute ",(0,s.jsx)(n.code,{children:"modern new"})," to turn on the test function before you can execute the ",(0,s.jsx)(n.code,{children:"modern test"})," command.\nThe ",(0,s.jsx)(n.code,{children:"modern test"})," command will automatically run the ",(0,s.jsx)(n.code,{children:"src/tests/*.test.(js|ts|jsx|tsx)"})," file as a test case."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-lint",children:[(0,s.jsx)(n.code,{children:"modern lint"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-lint",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern lint [options] [. .files]\n\nlint and fix source files\n\nOptions:\n --no-fix disable auto fix source file\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Run ",(0,s.jsx)(n.a,{href:"https://eslint.org/",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," to check the syntax of the code. Usually, we only need to check the part of the code that was changed in this commit with ",(0,s.jsx)(n.a,{href:"https://github.com/okonet/lint-staged",target:"_blank",rel:"noopener noreferrer",children:"lint-staged"})," during the ",(0,s.jsx)(n.code,{children:"-git commit"})," phase."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["The ",(0,s.jsx)(n.code,{children:"-no-fix"})," argument turns off the ability to automatically fix lint error code."]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-change",children:[(0,s.jsx)(n.code,{children:"modern change"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-change",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern change [options]\n\nCreate a changeset\n\nOptions:\n --empty Create an empty changeset (default: false)\n --open Open the created changeset in the editor (default: false)\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern change"})," command is used to generate the required Markdown file for ",(0,s.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"}),"."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-pre",children:[(0,s.jsx)(n.code,{children:"modern pre"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-pre",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern pre [options] [tag]\n\nEntering and exiting pre-publishing mode\n\nOptions:\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["You can use the ",(0,s.jsx)(n.code,{children:"modern pre"})," command to ",(0,s.jsx)(n.a,{href:"https://github.com/atlassian/changesets/blob/main/docs/prereleases.md",target:"_blank",rel:"noopener noreferrer",children:"pre-release"})," a version before the official release."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-bump",children:[(0,s.jsx)(n.code,{children:"modern bump"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-bump",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern bump [options]\n\nUse changesets to automatically update releases and changelogs\n\nOptions:\n --canary Create a pre-release for testing (default: false)\n --preid Specify an identifier when versioning a pre-release (default: "next")\n --snapshot Create a special version for testing (default: false)\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Modify the version number in ",(0,s.jsx)(n.code,{children:"package.json"})," according to the Markdown file of the changelog generated by ",(0,s.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"}),", and generate the ",(0,s.jsx)(n.code,{children:"CHANGELOG.md"})," file."]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-release",children:[(0,s.jsx)(n.code,{children:"modern release"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-release",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern release [options]\n\nRelease npm packages\n\nOptions:\n --tag Release npm packages with a specific tag (default: "")\n --ignore-scripts release ignores the scripts command in package.json, only supported in pnpm monorepo\n (default: "")\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"-modern release"})," command releases the module to the ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["The ",(0,s.jsx)(n.code,{children:"-tag"})," argument specifies the specific ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/adding-dist-tags-to-packages",target:"_blank",rel:"noopener noreferrer",children:"dist tags"})," to be used for the release."]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-gen-release-note",children:[(0,s.jsx)(n.code,{children:"modern gen-release-note"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-gen-release-note",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"Usage: modern gen-release-note [options]\n\nGenerate Release Note based on current repository changeset information\n\nOptions:\n --repo The name of the repository to generate the Pull Request link, e.g.: web-infra-dev/modern.js\n --custom Custom Release Note generation function\n -h, --help display help for command\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Automatically generate ",(0,s.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Release_notes",target:"_blank",rel:"noopener noreferrer",children:"Release Note"})," based on the changeset information of the current repository."]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["needs to be executed before the ",(0,s.jsx)(n.code,{children:"bump"})," command.\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"modern-upgrade",children:[(0,s.jsx)(n.code,{children:"modern upgrade"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-upgrade",children:"#"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'Usage: modern upgrade [options]\n\nUpgrade Modern.js to the latest version\n\nOptions:\n --registry customize npm registry (default: "")\n -d,--debug Enable Debug mode to print debug log messages (default: false)\n --cwd project path (default: "")\n -h, --help display help for command\n'})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"modern upgrade"})," command is used to upgrade the project Modern.js related dependencies to the latest version."]}),"\n",(0,s.jsxs)(n.p,{children:["Executing the command ",(0,s.jsx)(n.code,{children:"npx modern upgrade"})," in the project root directory will update the Modern.js dependencies in ",(0,s.jsx)(n.code,{children:"package.json"})," of the currently executing project to the latest version by default."]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fcommand-preview.md"]={toc:[{text:"`modern build`",id:"modern-build",depth:2},{text:"`modern new`",id:"modern-new",depth:2},{text:"`modern dev`",id:"modern-dev",depth:2},{text:"`modern test`",id:"modern-test",depth:2},{text:"`modern lint`",id:"modern-lint",depth:2},{text:"`modern change`",id:"modern-change",depth:2},{text:"`modern pre`",id:"modern-pre",depth:2},{text:"`modern bump`",id:"modern-bump",depth:2},{text:"`modern release`",id:"modern-release",depth:2},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2},{text:"`modern upgrade`",id:"modern-upgrade",depth:2}],title:"CLI Commands",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6356.53c422e3.js.LICENSE.txt b/modern-js/module-tools/static/js/async/7287.f2f905cd.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6356.53c422e3.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/7287.f2f905cd.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/7321.63e4af77.js b/modern-js/module-tools/static/js/async/7321.63e4af77.js new file mode 100644 index 0000000000..9dbcab8331 --- /dev/null +++ b/modern-js/module-tools/static/js/async/7321.63e4af77.js @@ -0,0 +1,2 @@ +/*! For license information please see 7321.63e4af77.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7321"],{85572:function(n,e,i){"use strict";i.r(e);var o=i("39980"),t=i("9580");function l(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",pre:"pre",h2:"h2",strong:"strong"},(0,t.ah)(),n.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.h1,{id:"plugin-object",children:["Plugin Object",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-object",children:"#"})]}),"\n",(0,o.jsx)(e.p,{children:"The Modern.js Module plugin is an object, and the object contains the following properties."}),"\n",(0,o.jsxs)(e.ul,{children:["\n",(0,o.jsxs)(e.li,{children:[(0,o.jsx)(e.code,{children:"name"}),": The name of the plugin, a unique identifier."]}),"\n",(0,o.jsxs)(e.li,{children:[(0,o.jsx)(e.code,{children:"setup"}),": plugin initialization function, which will be executed only once. setup function can return a Hooks object, and Modern.js Module will execute the function corresponding to the Hook defined on the Hooks object at a specific time."]}),"\n"]}),"\n",(0,o.jsxs)(e.p,{children:["For example, in the following plugin code example, the ",(0,o.jsx)(e.code,{children:"beforeBuild"})," function is triggered before the project starts the build task and the ",(0,o.jsx)(e.code,{children:"build start"})," log is printed."]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",meta:'title=". /plugins/demo.tsx"',children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n return {\n // this is hook\n beforeBuild: () => {\n console.info('build start');\n },\n };\n },\n};\n"})}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { myPlugin } from '. /plugins/demo';\nexport default {\n plugins: [myPlugin()],\n};\n"})}),"\n",(0,o.jsxs)(e.h2,{id:"plugin-type-definitions",children:["Plugin type definitions",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-type-definitions",children:"#"})]}),"\n",(0,o.jsxs)(e.p,{children:["When using TypeScript, you can introduce the built-in ",(0,o.jsx)(e.code,{children:"CliPlugin"})," and ",(0,o.jsx)(e.code,{children:"ModuleTools"})," types to provide the correct type derivation for plugins: ``"]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n const foo = '1';\n\n return {\n // this is hook\n afterBuild: () => {\n //...\n },\n };\n },\n};\n"})}),"\n",(0,o.jsxs)(e.h2,{id:"plugin-configuration-options",children:["Plugin configuration options",(0,o.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-configuration-options",children:"#"})]}),"\n",(0,o.jsxs)(e.p,{children:[(0,o.jsx)(e.strong,{children:"It is recommended to write the plugin as a function"}),", so that the plugin can receive configuration options via function entry."]}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\ntype MyPluginOptions = {\n foo: string;\n};\n\nconst myPlugin = (options: MyPluginOptions): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n console.log(options.foo);\n },\n});\n"})})]})}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,t.ah)(),n.components);return e?(0,o.jsx)(e,{...n,children:(0,o.jsx)(l,{...n})}):l(n)}e.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fplugins%2Fguide%2Fplugin-object.mdx"]={toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2}],title:"Plugin Object",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6458.2d6a7f4e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/7321.63e4af77.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6458.2d6a7f4e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/7321.63e4af77.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/8738.736ed031.js b/modern-js/module-tools/static/js/async/7334.2b4d109f.js similarity index 97% rename from modern-js/module-tools/static/js/async/8738.736ed031.js rename to modern-js/module-tools/static/js/async/7334.2b4d109f.js index e371d29d38..0dce422ff6 100644 --- a/modern-js/module-tools/static/js/async/8738.736ed031.js +++ b/modern-js/module-tools/static/js/async/7334.2b4d109f.js @@ -1,2 +1,2 @@ -/*! For license information please see 8738.736ed031.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8738"],{60701:function(e,n,o){"use strict";o.r(n);var d=o("39980"),i=o("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ol:"ol",li:"li",ul:"ul",pre:"pre"},(0,i.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"in-depth-understanding-of-the-dev-command",children:["In-depth understanding of the dev command",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#in-depth-understanding-of-the-dev-command",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["The ",(0,d.jsx)(n.code,{children:"dev"})," command provided by the Modern.js Module is mainly used for debugging the code."]}),"\n",(0,d.jsxs)(n.h2,{id:"the-overall-flow-of-the-command-run",children:["The overall flow of the command run",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#the-overall-flow-of-the-command-run",children:"#"})]}),"\n",(0,d.jsxs)(n.ol,{children:["\n",(0,d.jsxs)(n.li,{children:["When the ",(0,d.jsx)(n.code,{children:"dev"})," command is executed, Modern.js Module starts looking for debugging tools or tasks that can be executed. A debugging tool or task is a Modern.js Module debugging tool plugin like module doc."]}),"\n",(0,d.jsx)(n.li,{children:"When a debugging tool is found, it is executed immediately."}),"\n",(0,d.jsx)(n.li,{children:"When multiple debugging tools are found, the debugging tools list menu is displayed. A debug tool can be started by selecting the name option corresponding to it."}),"\n",(0,d.jsx)(n.li,{children:"When no debug tool is found, the user is informed that no debug tool is available."}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["In addition to the ",(0,d.jsx)(n.code,{children:"dev"})," command, you can also start a debugging tool or task directly by using the ",(0,d.jsx)(n.code,{children:"dev [debug tool name]"})," option."]}),"\n",(0,d.jsxs)(n.h2,{id:"extending-the-dev-command",children:["Extending the dev command",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#extending-the-dev-command",children:"#"})]}),"\n",(0,d.jsx)(n.p,{children:"If you need to extend the dev command, or rather provide your own Modern.js Module debugging tool plugin, then you will need to know the following first."}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"Development of plugins"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/api/plugin-api/plugin-hooks#dev-hooks",children:"Debugging Tools Plugin API"})}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"In general, the code to implement a debugging tool that does nothing and the associated configuration is as follows."}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:"do-nothing.ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'do-nothing',\n setup() {\n return {\n registerDev() {\n return {\n // Debugging tool name\n name: 'do-nothing',\n // Menu display content\n menuItem: {\n name: 'DoNothing',\n value: 'do-nothing',\n },\n // The defined dev subcommand\n subCommands: ['donothing', 'dn'],\n async action() {\n // dev logic\n console.info('Run build --watch, and do nothing.');\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,d.jsx)(n.p,{children:"If this debugging tool plugin is required, it needs to be added to the configuration file."}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",children:"import doNothingPlugin from './plugins/do-nothing';\n\nexport default defineConfig({\n plugins: [\n //..\n doNothingPlugin()\n ],\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:["At this point we can execute it when we execute the ",(0,d.jsx)(n.code,{children:"dev"})," or ",(0,d.jsx)(n.code,{children:"dev do-nothing"})," command. After execution, it will first execute the source build task in listening mode and print the log messages immediately afterwards."]}),"\n",(0,d.jsxs)(n.p,{children:["For currently officially supported debugging tools and third-party supported debugging tools, you can view them in ",(0,d.jsx)(n.a,{href:"/plugins/official-list/overview",children:"plugins list"}),"."]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(t,{...e})}):t(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fin-depth-about-dev-command.md"]={toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2}],title:"In-depth understanding of the dev command",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 7334.2b4d109f.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7334"],{37705:function(e,n,o){"use strict";o.r(n);var d=o("39980"),i=o("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",h2:"h2",ol:"ol",li:"li",ul:"ul",pre:"pre"},(0,i.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"in-depth-understanding-of-the-dev-command",children:["In-depth understanding of the dev command",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#in-depth-understanding-of-the-dev-command",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["The ",(0,d.jsx)(n.code,{children:"dev"})," command provided by the Modern.js Module is mainly used for debugging the code."]}),"\n",(0,d.jsxs)(n.h2,{id:"the-overall-flow-of-the-command-run",children:["The overall flow of the command run",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#the-overall-flow-of-the-command-run",children:"#"})]}),"\n",(0,d.jsxs)(n.ol,{children:["\n",(0,d.jsxs)(n.li,{children:["When the ",(0,d.jsx)(n.code,{children:"dev"})," command is executed, Modern.js Module starts looking for debugging tools or tasks that can be executed. A debugging tool or task is a Modern.js Module debugging tool plugin like module doc."]}),"\n",(0,d.jsx)(n.li,{children:"When a debugging tool is found, it is executed immediately."}),"\n",(0,d.jsx)(n.li,{children:"When multiple debugging tools are found, the debugging tools list menu is displayed. A debug tool can be started by selecting the name option corresponding to it."}),"\n",(0,d.jsx)(n.li,{children:"When no debug tool is found, the user is informed that no debug tool is available."}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["In addition to the ",(0,d.jsx)(n.code,{children:"dev"})," command, you can also start a debugging tool or task directly by using the ",(0,d.jsx)(n.code,{children:"dev [debug tool name]"})," option."]}),"\n",(0,d.jsxs)(n.h2,{id:"extending-the-dev-command",children:["Extending the dev command",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#extending-the-dev-command",children:"#"})]}),"\n",(0,d.jsx)(n.p,{children:"If you need to extend the dev command, or rather provide your own Modern.js Module debugging tool plugin, then you will need to know the following first."}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"Development of plugins"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/api/plugin-api/plugin-hooks#dev-hooks",children:"Debugging Tools Plugin API"})}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"In general, the code to implement a debugging tool that does nothing and the associated configuration is as follows."}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:"do-nothing.ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'do-nothing',\n setup() {\n return {\n registerDev() {\n return {\n // Debugging tool name\n name: 'do-nothing',\n // Menu display content\n menuItem: {\n name: 'DoNothing',\n value: 'do-nothing',\n },\n // The defined dev subcommand\n subCommands: ['donothing', 'dn'],\n async action() {\n // dev logic\n console.info('Run build --watch, and do nothing.');\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,d.jsx)(n.p,{children:"If this debugging tool plugin is required, it needs to be added to the configuration file."}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",children:"import doNothingPlugin from './plugins/do-nothing';\n\nexport default defineConfig({\n plugins: [\n //..\n doNothingPlugin()\n ],\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:["At this point we can execute it when we execute the ",(0,d.jsx)(n.code,{children:"dev"})," or ",(0,d.jsx)(n.code,{children:"dev do-nothing"})," command. After execution, it will first execute the source build task in listening mode and print the log messages immediately afterwards."]}),"\n",(0,d.jsxs)(n.p,{children:["For currently officially supported debugging tools and third-party supported debugging tools, you can view them in ",(0,d.jsx)(n.a,{href:"/plugins/official-list/overview",children:"plugins list"}),"."]})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(t,{...e})}):t(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fin-depth-about-dev-command.md"]={toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2}],title:"In-depth understanding of the dev command",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6760.5df82a32.js.LICENSE.txt b/modern-js/module-tools/static/js/async/7334.2b4d109f.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6760.5df82a32.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/7334.2b4d109f.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/978.a32834bd.js b/modern-js/module-tools/static/js/async/737.8eedae12.js similarity index 99% rename from modern-js/module-tools/static/js/async/978.a32834bd.js rename to modern-js/module-tools/static/js/async/737.8eedae12.js index d40181293c..1aefe7a395 100644 --- a/modern-js/module-tools/static/js/async/978.a32834bd.js +++ b/modern-js/module-tools/static/js/async/737.8eedae12.js @@ -1,2 +1,2 @@ -/*! For license information please see 978.a32834bd.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["978"],{35423:function(e,n,r){"use strict";r.r(n);var i=r("39980"),s=r("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",code:"code",em:"em",pre:"pre",ul:"ul",li:"li",blockquote:"blockquote",div:"div",h3:"h3",h4:"h4"},(0,s.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"before-you-start",children:["Before you start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#before-you-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h2,{id:"environment-preparation",children:["Environment preparation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#environment-preparation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In order to use the Modern.js Module, you first need ",(0,i.jsx)(n.a,{href:"https://nodejs.org/zh/",target:"_blank",rel:"noopener noreferrer",children:"NodeJS"})," engine, we recommend the latest ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"LTS version"}),", and make sure the Node version is ",(0,i.jsx)(n.strong,{children:">=16.0.0"}),". because non-stable NodeJS releases frequently have bugs. You might consider installing via ",(0,i.jsx)(n.a,{href:"https://github.com/coreybutler/nvm-windows",target:"_blank",rel:"noopener noreferrer",children:"nvm-windows"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",target:"_blank",rel:"noopener noreferrer",children:"nvm"})," (Mac / Linux), so you can easily switch to different NodeJS versions that might be required for different projects that you work on."]}),"\n",(0,i.jsxs)(n.h2,{id:"getting-started-with-npm",children:["Getting Started with npm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#getting-started-with-npm",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Once NodeJS is installed, not only can you access the ",(0,i.jsx)(n.code,{children:"node"})," executable from the command line, but you can also execute the ",(0,i.jsx)(n.code,{children:"npm"})," command."]}),"\n",(0,i.jsx)(n.p,{children:"Npm is the standard package manager for NodeJS. It started out as a tool for downloading and managing NodeJS package dependencies, but it has since evolved into a tool for front-end JavaScript."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["If you already know something about usage of npm and npm packages, then you can directly see ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started#npm-package-manager",children:"npm package manager"})," section."]})}),"\n",(0,i.jsxs)(n.h2,{id:"npm-package-type-project",children:["npm package type project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-package-type-project",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["So what is an npm package type project? When we execute the ",(0,i.jsx)(n.code,{children:"npm init"})," command in an empty project directory, it creates a JSON file with the file name ",(0,i.jsx)(n.code,{children:"package.json"})," under the current directory. During the creation process, we will need to fill in information including but not limited to the ",(0,i.jsx)(n.em,{children:"name"}),", ",(0,i.jsx)(n.em,{children:"version"})," ",(0,i.jsx)(n.em,{children:"number"}),", ",(0,i.jsx)(n.em,{children:"description"}),", etc. of the npm package, which will be found in the resulting ",(0,i.jsx)(n.code,{children:"package.json"})," file as follows"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "npm-demo",\n "version": "1.0.0",\n "description": "",\n "main": "index.js",\n "scripts": {\n "test": "echo \\"Error: no test specified\\" && exit 1"\n },\n "author": "",\n "license": "ISC"\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At this point the project containing the initialized ",(0,i.jsx)(n.code,{children:"package.json"})," file is an npm package type project, and you can execute the ",(0,i.jsx)(n.code,{children:"npm publish"})," command to publish the project to the ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The npm Registry is a ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-the-public-npm-registry",target:"_blank",rel:"noopener noreferrer",children:"npm package store"})," where developers can not only publish their own npm packages to the npm Registry, but also use npm packages published by other developers through the npm Registry."]}),"\n",(0,i.jsx)(n.p,{children:"A quality npm package will be used by more people because it not only saves a lot of code implementation work, but is also less likely to cause problems with the project."}),"\n",(0,i.jsxs)(n.h2,{id:"using-third-party-npm-packages",children:["Using third-party npm packages",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-third-party-npm-packages",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:['When adding a third-party npm package to an initial project, we can call this process "installing dependencies for the project" or "adding dependencies to the project". Before adding dependencies, we need to know one thing in particular -- ',(0,i.jsx)(n.strong,{children:"the types of packages npm depends on"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"dependencies"'}),": a type of package that your application will need in a production environment."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"devDependencies"'}),": another type of package that is only needed for local development and testing.","\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsx)(n.p,{children:"packages can be understood as third-party npm packages."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["You can install the packages you need in a ",(0,i.jsx)(n.strong,{children:"production environment"})," by running ",(0,i.jsx)(n.code,{children:"npm install npm-package-name"})," or ",(0,i.jsx)(n.code,{children:"npm add npm-package-name"}),", or you can manually write the packages you need to install and the corresponding ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"semantic version"})," in ",(0,i.jsx)(n.code,{children:'"dependencies"'})," in the ",(0,i.jsx)(n.code,{children:"package.json"})," file, and run the ",(0,i.jsx)(n.code,{children:"npm install"})," command to."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "dependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Similarly, you can install ",(0,i.jsx)(n.strong,{children:"only packages needed for local development and testing"})," by running ",(0,i.jsx)(n.code,{children:"npm install npm-package-name --save-dev"})," or ",(0,i.jsx)(n.code,{children:"npm add npm-package-name --save-dev"}),", or you can manually write the packages to be installed and the corresponding ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"semantic version"})," in ",(0,i.jsx)(n.code,{children:'"devDependencies"'})," in the ",(0,i.jsx)(n.code,{children:"package.json"})," file, and run the ",(0,i.jsx)(n.code,{children:"npm install"})," command as follows"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "devDependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["When installing or using third-party npm packages be sure to determine what they are for and whether they should be placed in ",(0,i.jsx)(n.code,{children:'"dependencies"'})," or ",(0,i.jsx)(n.code,{children:'"devDependencies"'})," by distinguishing between their types."]})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["In general, packages that need to be used in source code are ",(0,i.jsx)(n.code,{children:"dependencies"})," dependencies. Unless you are exporting dependent code locally via packaging, in which case it can be treated as a ",(0,i.jsx)(n.code,{children:"devDependencies"})," dependency.\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"other-npm-bits-and-pieces-to-know",children:["Other npm bits and pieces to know",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#other-npm-bits-and-pieces-to-know",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"program-entry-for-npm-packages",children:["Program entry for npm packages",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#program-entry-for-npm-packages",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["There is a ",(0,i.jsx)(n.code,{children:'"main"'})," attribute in ",(0,i.jsx)(n.code,{children:"package.json"})," that corresponds to a module ID or, more intuitively, a NodeJS file path, which is the main entry point for your application."]}),"\n",(0,i.jsxs)(n.p,{children:["For example, if your package is named ",(0,i.jsx)(n.code,{children:"foo"})," and the user installs it, and then executes the ",(0,i.jsx)(n.code,{children:'require("foo")'})," code, then the file corresponding to the ",(0,i.jsx)(n.code,{children:'"main"'})," field of the npm package ",(0,i.jsx)(n.code,{children:"foo"})," will be exported."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsxs)(n.strong,{children:["It is recommended to set the ",(0,i.jsx)(n.code,{children:'"main"'})," field in your npm package"]}),". If ",(0,i.jsx)(n.code,{children:'"main"'})," is not set, the default entry will be the ",(0,i.jsx)(n.code,{children:"index.js"})," file in the root of the package."]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to the ",(0,i.jsx)(n.code,{children:'"main"'})," attribute, the ",(0,i.jsx)(n.code,{children:'"module"'})," attribute is usually set. It is similar to the ",(0,i.jsx)(n.code,{children:'"main"'})," attribute in that it is mainly used in webpack scenarios. webpack reads the npm package entry (file) in most cases in the order ",(0,i.jsx)(n.strong,{children:'"module" -> "main "'}),"."]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["To learn more about how webpack does this, check out this ",(0,i.jsx)(n.a,{href:"https://webpack.js.org/configuration/resolve/#resolvemainfields",target:"_blank",rel:"noopener noreferrer",children:"link"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"scripts",children:[(0,i.jsx)(n.code,{children:"scripts"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:'"scripts"'})," attribute of the ",(0,i.jsx)(n.code,{children:"package.json"})," file supports a number of built-in scripts and npm-preset lifecycle events, as well as arbitrary scripts."]}),"\n",(0,i.jsxs)(n.p,{children:["These can be executed by running ",(0,i.jsx)(n.code,{children:"npm run-script "})," or simply ",(0,i.jsx)(n.code,{children:"npm run "}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Name matching ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts",target:"_blank",rel:"noopener noreferrer",children:"pre and post commands"})," will also be run (e.g. ",(0,i.jsx)(n.code,{children:"premyscript"}),", ",(0,i.jsx)(n.code,{children:"myscript"}),", ",(0,i.jsx)(n.code,{children:"postmyscript"})," )."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "premyscript": "",\n "myscript": "",\n "postmyscript": ""\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When ",(0,i.jsx)(n.code,{children:"npm run myscripts"})," is executed, the script corresponding to ",(0,i.jsx)(n.code,{children:"premyscripts"})," will be executed before it, and the script corresponding to ",(0,i.jsx)(n.code,{children:"postmyscripts"})," will be executed after it."]}),"\n",(0,i.jsxs)(n.p,{children:["Script commands from dependencies can be run with ",(0,i.jsx)(n.code,{children:"npm explore -- npm run "}),"."]}),"\n",(0,i.jsx)(n.p,{children:"There are also special lifecycle scripts that occur only under certain circumstances. Here are a few that are usually necessary to know."}),"\n",(0,i.jsxs)(n.h4,{id:"npm-install",children:[(0,i.jsx)(n.code,{children:"npm install"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-install",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When you run ",(0,i.jsx)(n.code,{children:"npm install -g "}),", the following scripts will run."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"preinstall"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"install"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postinstall"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepublish"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"preprepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postprepare"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If your package root has a ",(0,i.jsx)(n.code,{children:"binding.gyp"})," file and you don't define an ",(0,i.jsx)(n.code,{children:"install"})," or ",(0,i.jsx)(n.code,{children:"preinstall"})," script, then npm will build with ",(0,i.jsx)(n.code,{children:"node-gyp rebuild"})," as the default install command, using ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/node-gyp",target:"_blank",rel:"noopener noreferrer",children:"node-gyp"}),"."]}),"\n",(0,i.jsxs)(n.h4,{id:"npm-publish",children:[(0,i.jsx)(n.code,{children:"npm publish"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-publish",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When publishing a project, executing this command will trigger the following script."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepublishOnly"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepack"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postpack"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"publish"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postpublish"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When running in ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"-dry-run"})})," mode, the script corresponding to ",(0,i.jsx)(n.code,{children:"prepare"})," will not be executed."]}),"\n",(0,i.jsxs)(n.h3,{id:"peerdependencies",children:["peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#peerdependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In some cases, your npm project has a compatibility relationship with its host tool or library (e.g. a webpack plugin project and webpack), and your npm project does not want to use the host as a necessary dependency, which usually means that your project is probably a plugin for that host tool or library. Your npm project will have certain requirements for the version of the host package, as only the APIs required by the npm project will be exposed under a specific version."}),"\n",(0,i.jsxs)(n.p,{children:["For more explanation of ",(0,i.jsx)(n.code,{children:"peerDependencies"}),", you can learn about the different ways npm, pnpm, and Yarn handle it at the following links."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies",target:"_blank",rel:"noopener noreferrer",children:"npm's explanation of peerDependencies"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://pnpm.io/feature-comparison",target:"_blank",rel:"noopener noreferrer",children:"pnpm vs npm vs Yarn"})}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"npm-package-manager",children:["npm package manager",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-package-manager",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to the standard package manager like npm, the mainstream ones are ",(0,i.jsx)(n.strong,{children:"pnpm"})," and ",(0,i.jsx)(n.strong,{children:"Yarn"}),", both of which are good alternatives to npm cli."]}),"\n",(0,i.jsxs)(n.p,{children:["It is recommended to use ",(0,i.jsx)(n.a,{href:"https://pnpm.io/installation",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})," to manage project dependencies, which can be installed as follows."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npm install -g pnpm\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"modernjs-module-configuration-file",children:["Modern.js Module configuration file",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-configuration-file",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Modern.js Module configuration file - ",(0,i.jsx)(n.code,{children:"modern.config.(j|t)s"})," - is provided in the project directory of the module project created with ",(0,i.jsx)(n.code,{children:"@modern-js/create"}),". However, the ",(0,i.jsx)(n.code,{children:"modern.config"})," configuration file is not required to exist."]}),"\n",(0,i.jsx)(n.p,{children:"By default, the contents of the generated configuration file are as follows."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsxs)(n.strong,{children:["We recommend using the ",(0,i.jsx)(n.code,{children:"defineConfig"})," function"]}),", but it is not mandatory to use it. So you can also return an object directly in the config file: the"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools } from '@modern-js/module-tools';\n\nexport default {\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n};\n"})})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fbefore-getting-started.md"]={toc:[{text:"Environment preparation",id:"environment-preparation",depth:2},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2},{text:"npm package type project",id:"npm-package-type-project",depth:2},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3},{text:"`scripts`",id:"scripts",depth:3},{text:"`npm install`",id:"npm-install",depth:4},{text:"`npm publish`",id:"npm-publish",depth:4},{text:"peerDependencies",id:"peerdependencies",depth:3},{text:"npm package manager",id:"npm-package-manager",depth:2},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2}],title:"Before you start",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 737.8eedae12.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["737"],{90072:function(e,n,r){"use strict";r.r(n);var i=r("39980"),s=r("9580");function t(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",code:"code",em:"em",pre:"pre",ul:"ul",li:"li",blockquote:"blockquote",div:"div",h3:"h3",h4:"h4"},(0,s.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"before-you-start",children:["Before you start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#before-you-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h2,{id:"environment-preparation",children:["Environment preparation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#environment-preparation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In order to use the Modern.js Module, you first need ",(0,i.jsx)(n.a,{href:"https://nodejs.org/zh/",target:"_blank",rel:"noopener noreferrer",children:"NodeJS"})," engine, we recommend the latest ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"LTS version"}),", and make sure the Node version is ",(0,i.jsx)(n.strong,{children:">=16.0.0"}),". because non-stable NodeJS releases frequently have bugs. You might consider installing via ",(0,i.jsx)(n.a,{href:"https://github.com/coreybutler/nvm-windows",target:"_blank",rel:"noopener noreferrer",children:"nvm-windows"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",target:"_blank",rel:"noopener noreferrer",children:"nvm"})," (Mac / Linux), so you can easily switch to different NodeJS versions that might be required for different projects that you work on."]}),"\n",(0,i.jsxs)(n.h2,{id:"getting-started-with-npm",children:["Getting Started with npm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#getting-started-with-npm",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Once NodeJS is installed, not only can you access the ",(0,i.jsx)(n.code,{children:"node"})," executable from the command line, but you can also execute the ",(0,i.jsx)(n.code,{children:"npm"})," command."]}),"\n",(0,i.jsx)(n.p,{children:"Npm is the standard package manager for NodeJS. It started out as a tool for downloading and managing NodeJS package dependencies, but it has since evolved into a tool for front-end JavaScript."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["If you already know something about usage of npm and npm packages, then you can directly see ",(0,i.jsx)(n.a,{href:"/en/guide/basic/before-getting-started#npm-package-manager",children:"npm package manager"})," section."]})}),"\n",(0,i.jsxs)(n.h2,{id:"npm-package-type-project",children:["npm package type project",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-package-type-project",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["So what is an npm package type project? When we execute the ",(0,i.jsx)(n.code,{children:"npm init"})," command in an empty project directory, it creates a JSON file with the file name ",(0,i.jsx)(n.code,{children:"package.json"})," under the current directory. During the creation process, we will need to fill in information including but not limited to the ",(0,i.jsx)(n.em,{children:"name"}),", ",(0,i.jsx)(n.em,{children:"version"})," ",(0,i.jsx)(n.em,{children:"number"}),", ",(0,i.jsx)(n.em,{children:"description"}),", etc. of the npm package, which will be found in the resulting ",(0,i.jsx)(n.code,{children:"package.json"})," file as follows"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "npm-demo",\n "version": "1.0.0",\n "description": "",\n "main": "index.js",\n "scripts": {\n "test": "echo \\"Error: no test specified\\" && exit 1"\n },\n "author": "",\n "license": "ISC"\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At this point the project containing the initialized ",(0,i.jsx)(n.code,{children:"package.json"})," file is an npm package type project, and you can execute the ",(0,i.jsx)(n.code,{children:"npm publish"})," command to publish the project to the ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The npm Registry is a ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-the-public-npm-registry",target:"_blank",rel:"noopener noreferrer",children:"npm package store"})," where developers can not only publish their own npm packages to the npm Registry, but also use npm packages published by other developers through the npm Registry."]}),"\n",(0,i.jsx)(n.p,{children:"A quality npm package will be used by more people because it not only saves a lot of code implementation work, but is also less likely to cause problems with the project."}),"\n",(0,i.jsxs)(n.h2,{id:"using-third-party-npm-packages",children:["Using third-party npm packages",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-third-party-npm-packages",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:['When adding a third-party npm package to an initial project, we can call this process "installing dependencies for the project" or "adding dependencies to the project". Before adding dependencies, we need to know one thing in particular -- ',(0,i.jsx)(n.strong,{children:"the types of packages npm depends on"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"dependencies"'}),": a type of package that your application will need in a production environment."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:'"devDependencies"'}),": another type of package that is only needed for local development and testing.","\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsx)(n.p,{children:"packages can be understood as third-party npm packages."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["You can install the packages you need in a ",(0,i.jsx)(n.strong,{children:"production environment"})," by running ",(0,i.jsx)(n.code,{children:"npm install npm-package-name"})," or ",(0,i.jsx)(n.code,{children:"npm add npm-package-name"}),", or you can manually write the packages you need to install and the corresponding ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"semantic version"})," in ",(0,i.jsx)(n.code,{children:'"dependencies"'})," in the ",(0,i.jsx)(n.code,{children:"package.json"})," file, and run the ",(0,i.jsx)(n.code,{children:"npm install"})," command to."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "dependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Similarly, you can install ",(0,i.jsx)(n.strong,{children:"only packages needed for local development and testing"})," by running ",(0,i.jsx)(n.code,{children:"npm install npm-package-name --save-dev"})," or ",(0,i.jsx)(n.code,{children:"npm add npm-package-name --save-dev"}),", or you can manually write the packages to be installed and the corresponding ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"semantic version"})," in ",(0,i.jsx)(n.code,{children:'"devDependencies"'})," in the ",(0,i.jsx)(n.code,{children:"package.json"})," file, and run the ",(0,i.jsx)(n.code,{children:"npm install"})," command as follows"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "devDependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["When installing or using third-party npm packages be sure to determine what they are for and whether they should be placed in ",(0,i.jsx)(n.code,{children:'"dependencies"'})," or ",(0,i.jsx)(n.code,{children:'"devDependencies"'})," by distinguishing between their types."]})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["In general, packages that need to be used in source code are ",(0,i.jsx)(n.code,{children:"dependencies"})," dependencies. Unless you are exporting dependent code locally via packaging, in which case it can be treated as a ",(0,i.jsx)(n.code,{children:"devDependencies"})," dependency.\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"other-npm-bits-and-pieces-to-know",children:["Other npm bits and pieces to know",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#other-npm-bits-and-pieces-to-know",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"program-entry-for-npm-packages",children:["Program entry for npm packages",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#program-entry-for-npm-packages",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["There is a ",(0,i.jsx)(n.code,{children:'"main"'})," attribute in ",(0,i.jsx)(n.code,{children:"package.json"})," that corresponds to a module ID or, more intuitively, a NodeJS file path, which is the main entry point for your application."]}),"\n",(0,i.jsxs)(n.p,{children:["For example, if your package is named ",(0,i.jsx)(n.code,{children:"foo"})," and the user installs it, and then executes the ",(0,i.jsx)(n.code,{children:'require("foo")'})," code, then the file corresponding to the ",(0,i.jsx)(n.code,{children:'"main"'})," field of the npm package ",(0,i.jsx)(n.code,{children:"foo"})," will be exported."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsxs)(n.strong,{children:["It is recommended to set the ",(0,i.jsx)(n.code,{children:'"main"'})," field in your npm package"]}),". If ",(0,i.jsx)(n.code,{children:'"main"'})," is not set, the default entry will be the ",(0,i.jsx)(n.code,{children:"index.js"})," file in the root of the package."]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to the ",(0,i.jsx)(n.code,{children:'"main"'})," attribute, the ",(0,i.jsx)(n.code,{children:'"module"'})," attribute is usually set. It is similar to the ",(0,i.jsx)(n.code,{children:'"main"'})," attribute in that it is mainly used in webpack scenarios. webpack reads the npm package entry (file) in most cases in the order ",(0,i.jsx)(n.strong,{children:'"module" -> "main "'}),"."]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["To learn more about how webpack does this, check out this ",(0,i.jsx)(n.a,{href:"https://webpack.js.org/configuration/resolve/#resolvemainfields",target:"_blank",rel:"noopener noreferrer",children:"link"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"scripts",children:[(0,i.jsx)(n.code,{children:"scripts"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:'"scripts"'})," attribute of the ",(0,i.jsx)(n.code,{children:"package.json"})," file supports a number of built-in scripts and npm-preset lifecycle events, as well as arbitrary scripts."]}),"\n",(0,i.jsxs)(n.p,{children:["These can be executed by running ",(0,i.jsx)(n.code,{children:"npm run-script "})," or simply ",(0,i.jsx)(n.code,{children:"npm run "}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Name matching ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts",target:"_blank",rel:"noopener noreferrer",children:"pre and post commands"})," will also be run (e.g. ",(0,i.jsx)(n.code,{children:"premyscript"}),", ",(0,i.jsx)(n.code,{children:"myscript"}),", ",(0,i.jsx)(n.code,{children:"postmyscript"})," )."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "premyscript": "",\n "myscript": "",\n "postmyscript": ""\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When ",(0,i.jsx)(n.code,{children:"npm run myscripts"})," is executed, the script corresponding to ",(0,i.jsx)(n.code,{children:"premyscripts"})," will be executed before it, and the script corresponding to ",(0,i.jsx)(n.code,{children:"postmyscripts"})," will be executed after it."]}),"\n",(0,i.jsxs)(n.p,{children:["Script commands from dependencies can be run with ",(0,i.jsx)(n.code,{children:"npm explore -- npm run "}),"."]}),"\n",(0,i.jsx)(n.p,{children:"There are also special lifecycle scripts that occur only under certain circumstances. Here are a few that are usually necessary to know."}),"\n",(0,i.jsxs)(n.h4,{id:"npm-install",children:[(0,i.jsx)(n.code,{children:"npm install"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-install",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When you run ",(0,i.jsx)(n.code,{children:"npm install -g "}),", the following scripts will run."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"preinstall"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"install"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postinstall"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepublish"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"preprepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postprepare"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If your package root has a ",(0,i.jsx)(n.code,{children:"binding.gyp"})," file and you don't define an ",(0,i.jsx)(n.code,{children:"install"})," or ",(0,i.jsx)(n.code,{children:"preinstall"})," script, then npm will build with ",(0,i.jsx)(n.code,{children:"node-gyp rebuild"})," as the default install command, using ",(0,i.jsx)(n.a,{href:"https://github.com/nodejs/node-gyp",target:"_blank",rel:"noopener noreferrer",children:"node-gyp"}),"."]}),"\n",(0,i.jsxs)(n.h4,{id:"npm-publish",children:[(0,i.jsx)(n.code,{children:"npm publish"}),(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-publish",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"When publishing a project, executing this command will trigger the following script."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepublishOnly"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepack"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"prepare"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postpack"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"publish"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"postpublish"})}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When running in ",(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"-dry-run"})})," mode, the script corresponding to ",(0,i.jsx)(n.code,{children:"prepare"})," will not be executed."]}),"\n",(0,i.jsxs)(n.h3,{id:"peerdependencies",children:["peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#peerdependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In some cases, your npm project has a compatibility relationship with its host tool or library (e.g. a webpack plugin project and webpack), and your npm project does not want to use the host as a necessary dependency, which usually means that your project is probably a plugin for that host tool or library. Your npm project will have certain requirements for the version of the host package, as only the APIs required by the npm project will be exposed under a specific version."}),"\n",(0,i.jsxs)(n.p,{children:["For more explanation of ",(0,i.jsx)(n.code,{children:"peerDependencies"}),", you can learn about the different ways npm, pnpm, and Yarn handle it at the following links."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies",target:"_blank",rel:"noopener noreferrer",children:"npm's explanation of peerDependencies"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://pnpm.io/feature-comparison",target:"_blank",rel:"noopener noreferrer",children:"pnpm vs npm vs Yarn"})}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"npm-package-manager",children:["npm package manager",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-package-manager",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In addition to the standard package manager like npm, the mainstream ones are ",(0,i.jsx)(n.strong,{children:"pnpm"})," and ",(0,i.jsx)(n.strong,{children:"Yarn"}),", both of which are good alternatives to npm cli."]}),"\n",(0,i.jsxs)(n.p,{children:["It is recommended to use ",(0,i.jsx)(n.a,{href:"https://pnpm.io/installation",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})," to manage project dependencies, which can be installed as follows."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npm install -g pnpm\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"modernjs-module-configuration-file",children:["Modern.js Module configuration file",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-configuration-file",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The Modern.js Module configuration file - ",(0,i.jsx)(n.code,{children:"modern.config.(j|t)s"})," - is provided in the project directory of the module project created with ",(0,i.jsx)(n.code,{children:"@modern-js/create"}),". However, the ",(0,i.jsx)(n.code,{children:"modern.config"})," configuration file is not required to exist."]}),"\n",(0,i.jsx)(n.p,{children:"By default, the contents of the generated configuration file are as follows."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsxs)(n.strong,{children:["We recommend using the ",(0,i.jsx)(n.code,{children:"defineConfig"})," function"]}),", but it is not mandatory to use it. So you can also return an object directly in the config file: the"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools } from '@modern-js/module-tools';\n\nexport default {\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n};\n"})})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fbefore-getting-started.md"]={toc:[{text:"Environment preparation",id:"environment-preparation",depth:2},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2},{text:"npm package type project",id:"npm-package-type-project",depth:2},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3},{text:"`scripts`",id:"scripts",depth:3},{text:"`npm install`",id:"npm-install",depth:4},{text:"`npm publish`",id:"npm-publish",depth:4},{text:"peerDependencies",id:"peerdependencies",depth:3},{text:"npm package manager",id:"npm-package-manager",depth:2},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2}],title:"Before you start",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/865.6bb1555b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/737.8eedae12.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/865.6bb1555b.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/737.8eedae12.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5994.b1a304bb.js b/modern-js/module-tools/static/js/async/7426.32bc11b9.js similarity index 71% rename from modern-js/module-tools/static/js/async/5994.b1a304bb.js rename to modern-js/module-tools/static/js/async/7426.32bc11b9.js index e09143ab5a..d6a3cb60cd 100644 --- a/modern-js/module-tools/static/js/async/5994.b1a304bb.js +++ b/modern-js/module-tools/static/js/async/7426.32bc11b9.js @@ -1,2 +1,2 @@ -/*! For license information please see 5994.b1a304bb.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5994"],{17936:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-exception.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 7426.32bc11b9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7426"],{83757:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-other.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6844.b821cee1.js.LICENSE.txt b/modern-js/module-tools/static/js/async/7426.32bc11b9.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/6844.b821cee1.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/7426.32bc11b9.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5110.6bd38ea0.js b/modern-js/module-tools/static/js/async/7534.4139a31a.js similarity index 99% rename from modern-js/module-tools/static/js/async/5110.6bd38ea0.js rename to modern-js/module-tools/static/js/async/7534.4139a31a.js index c44d415b19..4f510d1269 100644 --- a/modern-js/module-tools/static/js/async/5110.6bd38ea0.js +++ b/modern-js/module-tools/static/js/async/7534.4139a31a.js @@ -1,2 +1,2 @@ -/*! For license information please see 5110.6bd38ea0.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5110"],{77048:function(e,n,r){"use strict";r.r(n);var o=r("39980"),s=r("9580");function d(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",h2:"h2",h3:"h3",pre:"pre",code:"code",div:"div",blockquote:"blockquote",strong:"strong",h4:"h4"},(0,s.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"\u4F7F\u7528-storybook",children:["\u4F7F\u7528 Storybook",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-storybook",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.a,{href:"https://storybook.js.org/",target:"_blank",rel:"noopener noreferrer",children:"Storybook"})," \u662F\u4E00\u4E2A\u4E13\u95E8\u7528\u4E8E\u7EC4\u4EF6\u8C03\u8BD5\u7684\u5DE5\u5177\uFF0C\u5B83\u56F4\u7ED5\u7740\u7EC4\u4EF6\u5F00\u53D1\u63D0\u4F9B\u4E86\uFF1A"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:"\u4E30\u5BCC\u591A\u6837\u7684\u8C03\u8BD5\u80FD\u529B"}),"\n",(0,o.jsx)(n.li,{children:"\u53EF\u4E0E\u4E00\u4E9B\u6D4B\u8BD5\u5DE5\u5177\u7ED3\u5408\u4F7F\u7528"}),"\n",(0,o.jsx)(n.li,{children:"\u53EF\u91CD\u590D\u4F7F\u7528\u7684\u6587\u6863\u5185\u5BB9"}),"\n",(0,o.jsx)(n.li,{children:"\u53EF\u5206\u4EAB\u80FD\u529B"}),"\n",(0,o.jsx)(n.li,{children:"\u5DE5\u4F5C\u6D41\u7A0B\u81EA\u52A8\u5316"}),"\n"]}),"\n",(0,o.jsx)(n.p,{children:"\u5728\u4F7F\u7528 Storybook \u65F6\uFF0C\u96BE\u514D\u4F1A\u9047\u5230\u5404\u79CD\u914D\u7F6E\u95EE\u9898\uFF0C\u9700\u8981\u624B\u52A8\u914D\u7F6E Babel \u63D2\u4EF6\uFF0C\u624B\u52A8\u914D\u7F6E Webpack \u53BB\u652F\u6301 less\uFF0Csass \u7B49\u3002\nModern.js \u96C6\u6210\u4E86 Storybook\uFF0C\u8FD9\u5BF9\u4E8E\u6211\u4EEC\u5F00\u53D1 Storybook \u9879\u76EE\u6765\u8BF4\u6781\u5927\u5730\u7B80\u5316\u4E86\u914D\u7F6E\u5DE5\u4F5C\u3002"}),"\n",(0,o.jsxs)(n.h2,{id:"v7-\u63A8\u8350",children:["V7 (\u63A8\u8350)",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#v7-\u63A8\u8350",children:"#"})]}),"\n",(0,o.jsxs)(n.h3,{id:"\u5F00\u542F-storybook",children:["\u5F00\u542F Storybook",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u542F-storybook",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"\u53EF\u4EE5\u76F4\u63A5\u4F7F\u7528\u5982\u4E0B\u547D\u4EE4\u5F00\u542F Storybook \u529F\u80FD\u3002"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"$ npx modern new\n? \u8BF7\u9009\u62E9\u4F60\u60F3\u8981\u7684\u64CD\u4F5C \u542F\u7528\u53EF\u9009\u529F\u80FD\n? \u8BF7\u9009\u62E9\u529F\u80FD\u540D\u79F0 \u542F\u7528\u300CStorybook\u300DV7\n"})}),"\n",(0,o.jsx)(n.p,{children:"\u8BE5\u547D\u4EE4\u4F1A\u521B\u5EFA\u597D Storybook \u5E38\u7528\u7684\u6A21\u7248\uFF0C\u5305\u62EC"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\u521B\u5EFA\u914D\u7F6E\u6587\u4EF6\u5939 ",(0,o.jsx)(n.code,{children:".storybook"}),"\uFF0C\u4EE5\u53CA\u9ED8\u8BA4\u914D\u7F6E\u6587\u4EF6 ",(0,o.jsx)(n.code,{children:".storybook/main.ts"})]}),"\n",(0,o.jsx)(n.li,{children:"\u521B\u5EFA stories \u7EC4\u4EF6\u793A\u4F8B"}),"\n",(0,o.jsx)(n.li,{children:"\u66F4\u65B0 package.json\uFF0C\u65B0\u589E\u4F9D\u8D56 @storybook/addon-essential \u548C @modern-js/storybook\uFF0C\u4EE5\u53CA\u521B\u5EFA storybook \u76F8\u5173\u811A\u672C\u3002"}),"\n"]}),"\n",(0,o.jsxs)(n.h3,{id:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",children:["\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"\u4E8B\u5B9E\u4E0A\uFF0CModern.js Module \u662F\u57FA\u4E8E esbuild \u5B9E\u73B0\u7684\uFF0C\u800C Storybook \u4F7F\u7528 Webpack \u4F5C\u4E3A\u9ED8\u8BA4\u6784\u5EFA\u5DE5\u5177\uFF0C\u4E8C\u8005\u7684\u914D\u7F6E\u65E0\u6CD5\u5B8C\u5168\u517C\u5BB9\uFF0C\n\u6240\u4EE5\u8FD9\u91CC\u6211\u4EEC\u63A8\u8350\u5148\u5BF9\u7EC4\u4EF6\u8FDB\u884C\u6784\u5EFA\uFF0C\u7136\u540E\u5728 stories \u91CC\u5F15\u5165\u7EC4\u4EF6\u4EA7\u7269\u3002"}),"\n",(0,o.jsx)(n.p,{children:"\u5F15\u5165\u7EC4\u4EF6\u4EA7\u7269\u7684\u65B9\u5F0F\u975E\u5E38\u7B80\u5355\uFF0C\u5047\u8BBE\u4F60\u7684\u6A21\u5757\u5BFC\u51FA\u4E86\u4E00\u4E2A Button \u7EC4\u4EF6\uFF0C\u90A3\u4E48\u5728 stories \u91CC\u53EF\u4EE5\u8FD9\u6837\u4F7F\u7528:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",meta:'filename="stories/index.stories.tsx"',children:"import { Button } from '.';\n\nexport const YourStory = () => ;\n};\n```\n"})}),"\n",(0,t.jsxs)(n.ol,{start:"2",children:["\n",(0,t.jsxs)(n.li,{children:["In the ",(0,t.jsx)(n.code,{children:"tsconfig.json"}),", configure aliases and point the package name to the current project directory, make the way document developers and users use components consistent:"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",meta:'title="tsconfig.json"',children:'{\n "compilerOptions": {\n "paths": {\n "demo": ["."]\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.ol,{start:"3",children:["\n",(0,t.jsxs)(n.li,{children:["In the ",(0,t.jsx)(n.code,{children:".gitignore"}),", add ",(0,t.jsx)(n.code,{children:"doc_build/"}),":"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",meta:'title=".gitignore"',children:"doc_build/\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Congratulations, you have finished writing a component document, execute ",(0,t.jsx)(n.code,{children:"pnpm run dev"})," to see the result, remember to build the component library first to make sure the component product exists."]}),"\n",(0,t.jsxs)(n.h3,{id:"mobile-preview",children:["Mobile Preview",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#mobile-preview",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["Also, we support mobile preview mode, i.e. rendering mobile components using iframe, and set iframe position by ",(0,t.jsx)(n.code,{children:"iframePosition"}),",\nsupport swipe preview and new page opening."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools'.\nimport { modulePluginDoc } from '@modern-js/plugin-rspress'.\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n /**\n * Select the preview method\n * @default internal\n */\n previewMode: 'iframe',\n /**\n * Select iframe position\n * @default 'follow'\n */\n iframePosition: 'fixed',\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,t.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,t.jsxs)(n.p,{children:["If you only want to change the way a particular ",(0,t.jsx)(n.code,{children:"jsx"})," and ",(0,t.jsx)(n.code,{children:"tsx"})," block is previewed, you can use a different modifier to identify it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:"```jsx pure\n// The content here will not be rendered\n```\n\n```jsx internal\n// Used to render components in documentation\n```\n\n```jsx iframe\n// Used to render components in iframe\n```\n"})}),"\n"]})]}),"\n",(0,t.jsxs)(n.h3,{id:"using-external-demos",children:["Using external demos",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-external-demos",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["If our demo is very complex, then it is recommended to write the demo separately and then use the ",(0,t.jsx)(n.code,{children:"code"})," tag in the mdx:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,t.jsx)(n.p,{children:"This also supports setting the preview method for each individual code block, for example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"using-built-in-components",children:["Using built-in components",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-built-in-components",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"The plugin implements some built-in components internally so that you can develop module documentation more easily."}),"\n",(0,t.jsxs)(n.h3,{id:"api",children:["API",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Display the API content of the module."}),"\n",(0,t.jsxs)(n.h4,{id:"parse-file",children:["Parse file",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parse-file",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Before we can use the API component, we first need to specify the files to parse:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n Button: './src/button.tsx',\n },\n apiParseTool: 'react-docgen-typescript',\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"content-generation",children:["Content generation",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#content-generation",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Next, we'll see what kind of markdown content is generated based on the parsed file."}),"\n",(0,t.jsxs)(n.p,{children:["Content can be generated with two different tools, ",(0,t.jsx)(n.a,{href:"https://github.com/styleguidist/react-docgen-typescript",target:"_blank",rel:"noopener noreferrer",children:"react-docgen-typescript"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/documentationjs/documentation",target:"_blank",rel:"noopener noreferrer",children:"documentation"}),":"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"react-docgen-typescript"})," is targeted at component library scenarios and will only parse props to generate tables."]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"export type ButtonProps = {\n /**\n * Whether to disable the button\n */\n disabled?: boolean;\n /* * Whether to disable the button */ disabled?\n * Type of Button\n * @default 'default'\n */\n size?: 'mini' | 'small' | 'default' | 'large';\n}.\nexport const Button = (props?: ButtonProps) => {};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The above is a standard writeup where ",(0,t.jsx)(n.code,{children:"ButtonProps"})," will be extracted into the table and ",(0,t.jsx)(n.code,{children:"Button"})," will be the title of the table.\nIf you use the default export, the filename will be used as the form title."]}),"\n",(0,t.jsx)(n.p,{children:"Notice that export features declared elsewhere are not available."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"const A = () => {};\n\nexport { A }; // wrong\nexport default A; // wrong\nexport const B = () => {}; // right\nexport default () => {}; // right\n"})}),"\n",(0,t.jsx)(n.p,{children:"The generated content is as follows:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'### ButtonTest\n\n| property | description | type | default |\n| :------: | :---------------------------: | :--------------------------------------: | :---------: |\n| disabled | Whether to disable the button | `boolean` | `-` |\n| size | Type of Button | `"mini" \\|"small" \\|"default" \\|"large"` | `\'default\'` |\n'})}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,t.jsx)(n.p,{children:"If React types are used in Props, you need to add the types in tsconfig.json, otherwise the types will not be resolved under the React namespace."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "compilerOptions": {\n "types": ["react"]\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"The best way is that you import the type directly:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { FC } from 'react';\n"})}),"\n"]})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"documentation"})," is used in tool library scenarios to parse JSDoc annotations."]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"/**\n * Greet function that returns a greeting message.\n * @param {string} name - The name of the person to greet.\n * @param {string} [greeting='Hello'] - The greeting to use.\n * @returns {string} The greeting message.\n */\nfunction greet(name: string, greeting = 'Hello') {\n return `${greeting}, ${name}! `;\n}\n"})}),"\n",(0,t.jsx)(n.p,{children:"The above is a greet function with a JSDoc annotation. The generated content is as follows:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-md",children:"\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"overview",children:["Overview",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Displays a list of modules that can be placed on the front page to display all modules."}),"\n",(0,t.jsx)(n.p,{children:"The Overview component has only one list property, which receives an array of objects, and the following properties of the objects"}),"\n",(0,t.jsxs)(n.table,{children:["\n",(0,t.jsxs)(n.thead,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.th,{align:"center",children:"property"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"description"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"type"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"default"}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.tbody,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"React.ReactNode"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"text"}),"\n",(0,t.jsxs)(n.td,{align:"center",children:["text(",(0,t.jsx)(n.strong,{children:"required"}),")"]}),"\n",(0,t.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"link"}),"\n",(0,t.jsxs)(n.td,{align:"center",children:["link(",(0,t.jsx)(n.strong,{children:"required"}),")"]}),"\n",(0,t.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"arrow"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"whether to show arrows"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"boolean"}),"\n",(0,t.jsx)(n.td,{align:"center",children:(0,t.jsx)(n.code,{children:"false"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"plugin-options",children:["Plugin options",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-options",children:"#"})]}),"\n",(0,t.jsxs)(n.h3,{id:"apiparsetool",children:["apiParseTool",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiparsetool",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"API parse tool."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"'react-docgen-typescript' | 'documentation'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'react-docgen-typescript'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.h3,{id:"doc",children:["doc",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#doc",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://rspress.dev/api/index.html",target:"_blank",rel:"noopener noreferrer",children:"Config"}),"."]}),"\n",(0,t.jsxs)(n.h3,{id:"entries",children:["entries",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#entries",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Module names and relative paths for automatically generated documents."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"Entries | ToolEntries"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"type Entries = Record;\ntype ToolEntries = {\n documentation: Entries;\n 'react-docgen-typescript': Entries;\n};\n"})}),"\n",(0,t.jsx)(n.p,{children:"It also supports the use of different parsing tools for different files:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n documentation: {\n Add: './src/utils/add.ts',\n },\n 'react-docgen-typescript': {\n Button: './src/components/button.tsx',\n },\n },\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.h3,{id:"iframeposition",children:["iframePosition",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#iframeposition",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,t.jsx)(n.code,{children:"'follow' | 'fixed'"})]}),"\n",(0,t.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,t.jsx)(n.code,{children:"'follow'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["When the value is ",(0,t.jsx)(n.code,{children:"follow"}),", each code block will have an iframe showing its rendered view.\nWhen ",(0,t.jsx)(n.code,{children:"fixed"}),", the iframe will be fixed to the right side of the page, showing the view of all the code blocks on the current page."]}),"\n",(0,t.jsxs)(n.h3,{id:"parsetooloptions",children:["parseToolOptions",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parsetooloptions",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"API parse tool options."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"ParseToolOptions"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"type ParseToolOptions = {\n // https://github.com/styleguidist/react-docgen-typescript#options\n 'react-docgen-typescript'?: ParserOptions;\n // https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md#parameters-1\n documentation?: DocumentationArgs;\n};\n"})}),"\n",(0,t.jsxs)(n.h3,{id:"previewmode",children:["previewMode",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#previewmode",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"'iframe' | 'internal'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'internal'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["In case of ",(0,t.jsx)(n.code,{children:"internal"}),", the component will be rendered directly in the page, otherwise it will be loaded through an iframe."]}),"\n",(0,t.jsxs)(n.h3,{id:"deprecated-languages",children:["deprecated: languages",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-languages",children:"#"})]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["Starting from version 2.44.0, please refer to the ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"Internationalization"})," section to implement multiple languages.\n"]})})]}),"\n",(0,t.jsxs)(n.h3,{id:"deprecated-usemodulesidebar",children:["deprecated: useModuleSidebar",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-usemodulesidebar",children:"#"})]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["Starting from version 2.44.0, a sniffing mechanism has been implemented internally, so please directly use ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"}),"\nor directly configure ",(0,t.jsx)(n.a,{href:"https://rspress.dev/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"})," to implement a custom sidebar.\n"]})})]}),"\n",(0,t.jsxs)(n.h2,{id:"scripts",children:["Scripts",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"modern dev"}),": Start dev server for doc site."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"modern build --platform"}),": Build doc site in production, by default output directories is ",(0,t.jsx)(n.code,{children:"doc_build"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"advanced-guide",children:["Advanced guide",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#advanced-guide",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["The above has covered the basics of developing module documentation, but this is not enough for developing a complete documentation station. Check out the ",(0,t.jsx)(n.a,{href:"https://rspress.dev",target:"_blank",rel:"noopener noreferrer",children:"Rspress"})," for an in-depth look at our documentation framework.\nYou can modify the documentation framework configuration via the ",(0,t.jsx)(n.code,{children:"doc"})," configuration."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools'.\nimport { modulePluginDoc } from '@modern-js/plugin-rspress'.\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n doc: {\n // Customize the documentation site configuration\n }\n }),\n ],\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(s,{...e})}):s(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fuse-module-doc.mdx"]={toc:[{text:"Before we start",id:"before-we-start",depth:2},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3},{text:"Basic site structure",id:"basic-site-structure",depth:2},{text:"Configure sidebar",id:"configure-sidebar",depth:3},{text:"Writing Documentation",id:"writing-documentation",depth:2},{text:"Component preview",id:"component-preview",depth:2},{text:"Example",id:"example",depth:3},{text:"Mobile Preview",id:"mobile-preview",depth:3},{text:"Using external demos",id:"using-external-demos",depth:3},{text:"Using built-in components",id:"using-built-in-components",depth:2},{text:"API",id:"api",depth:3},{text:"Parse file",id:"parse-file",depth:4},{text:"Content generation",id:"content-generation",depth:4},{text:"Using the component",id:"using-the-component",depth:4},{text:"Overview",id:"overview",depth:3},{text:"Plugin options",id:"plugin-options",depth:2},{text:"apiParseTool",id:"apiparsetool",depth:3},{text:"doc",id:"doc",depth:3},{text:"entries",id:"entries",depth:3},{text:"iframePosition",id:"iframeposition",depth:3},{text:"parseToolOptions",id:"parsetooloptions",depth:3},{text:"previewMode",id:"previewmode",depth:3},{text:"deprecated: languages",id:"deprecated-languages",depth:3},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3},{text:"Scripts",id:"scripts",depth:2},{text:"Advanced guide",id:"advanced-guide",depth:2}],title:"Developing Module documentation",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file +/*! For license information please see 8058.a1f19999.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8058"],{85227:function(e,n,r){"use strict";r.r(n);var t=r("39980"),i=r("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",h3:"h3",ol:"ol",li:"li",pre:"pre",code:"code",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",img:"img",div:"div",ul:"ul",h4:"h4",strong:"strong"},(0,i.ah)(),e.components);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.h1,{id:"developing-module-documentation",children:["Developing Module documentation",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#developing-module-documentation",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"This chapter describes how to quickly build a static documentation site for a module project."}),"\n",(0,t.jsxs)(n.h2,{id:"before-we-start",children:["Before we start",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#before-we-start",children:"#"})]}),"\n",(0,t.jsxs)(n.h3,{id:"why-we-need-to-build-a-documentation-site-for-a-module",children:["Why we need to build a documentation site for a module",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#why-we-need-to-build-a-documentation-site-for-a-module",children:"#"})]}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:"a documentation site can help us to better organize the structure of the documentation."}),"\n",(0,t.jsx)(n.li,{children:"the documentation site has better presentation, such as the ability to execute functions in the page, render components."}),"\n",(0,t.jsx)(n.li,{children:"to make better use of AI search capabilities."}),"\n"]}),"\n",(0,t.jsxs)(n.h3,{id:"preliminary-preparation",children:["Preliminary preparation",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#preliminary-preparation",children:"#"})]}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["Enable the documentation feature via ",(0,t.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"micro-generator"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:["Read ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/start/introduction.html",target:"_blank",rel:"noopener noreferrer",children:"Introduction to Rspress"}),"."]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"After finishing the preparation work, we will build a documentation site for the module project based on Rspress."}),"\n",(0,t.jsxs)(n.h2,{id:"basic-site-structure",children:["Basic site structure",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#basic-site-structure",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"The overall layout of the site consists of three parts: the navigation bar, the sidebar and the body part, which also includes the TOC (Table of contents found at the beginning of a book or document)."}),"\n",(0,t.jsxs)(n.p,{children:["The Rspress uses ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/conventional-route.html",target:"_blank",rel:"noopener noreferrer",children:"File System Routing"}),", on which the module documentation is based, to automate the generation of the sidebar.\nFor example, if you have the following file structure:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 foo\n\u2502 \u2514\u2500\u2500 bar.md\n\u2502 \u2514\u2500\u2500 index.md\n\u2514\u2500\u2500 foo.md\n\u2514\u2500\u2500 index.md\n\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Then the routing path for ",(0,t.jsx)(n.code,{children:"foo/bar.md"})," will be ",(0,t.jsx)(n.code,{children:"/foo/bar"}),", the routing path for ",(0,t.jsx)(n.code,{children:"foo.md"})," will be ",(0,t.jsx)(n.code,{children:"/foo"}),", and the routing path for ",(0,t.jsx)(n.code,{children:"index.md"})," will be ",(0,t.jsx)(n.code,{children:"/"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"The specific mapping rules are as follows:"}),"\n",(0,t.jsxs)(n.table,{children:["\n",(0,t.jsxs)(n.thead,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.th,{children:"file-path"}),"\n",(0,t.jsx)(n.th,{children:"routing-path"}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.tbody,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"index.md"})}),"\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/"})}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo.md"})}),"\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo"})}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo/index.md"})}),"\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo/"})}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo/bar.md"})}),"\n",(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"/foo/bar"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"The sidebars corresponding in turn to the above file paths and routing paths are shown below:"}),"\n",(0,t.jsx)("img",{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/rpauheh7nulwbm/edenx-module/docs-blog/autosidebar.png"}),"\n",(0,t.jsxs)(n.h3,{id:"configure-sidebar",children:["Configure sidebar",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configure-sidebar",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["As shown in the figure above, the module documentation has automatically generated sidebars for file system routing, where the text of each column of the sidebar is determined by the file's first level title or directory name.\nIf you need to customize the sidebar, please use ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"})," or configure ",(0,t.jsx)(n.a,{href:"https://rspress.dev/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"})," directly."]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive info",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,t.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,t.jsx)(n.p,{children:"If your document directory structure complies with internationalization, for example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 en\n\u2502 \u251C\u2500\u2500 button.mdx\n\u2502 \u251C\u2500\u2500 index.mdx\n\u2514\u2500\u2500 zh\n \u251C\u2500\u2500 button.mdx\n \u251C\u2500\u2500 index.mdx\n"})}),"\n",(0,t.jsxs)(n.p,{children:["You need to follow ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"internationalization"})," guide and configure ",(0,t.jsx)(n.code,{children:"lang"})," \u548C ",(0,t.jsx)(n.code,{children:"locales"}),",\notherwise, the automatically generated sidebar of the module will not handle the ",(0,t.jsx)(n.code,{children:"zh"})," and ",(0,t.jsx)(n.code,{children:"en"})," directories.\n"]})]})]}),"\n",(0,t.jsxs)(n.h2,{id:"writing-documentation",children:["Writing Documentation",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#writing-documentation",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Next, we can focus on writing the content of the document. In addition to the basic Markdown syntax, you may also need to understand the following advanced topics:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/use-mdx.html",target:"_blank",rel:"noopener noreferrer",children:"Using MDX"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/static-assets.html",target:"_blank",rel:"noopener noreferrer",children:"Using Assets"})}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"component-preview",children:["Component preview",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#component-preview",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Module documentation provides preview capabilities for component libraries. The contents in code blocks written in jsx and tsx will be parsed as React components."}),"\n",(0,t.jsxs)(n.h3,{id:"example",children:["Example",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Here is a complete example using the component preview feature:"}),"\n",(0,t.jsxs)(n.p,{children:["Assuming our project name is ",(0,t.jsx)(n.code,{children:"demo"})," and we export a Button component."]}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["Add a new ",(0,t.jsx)(n.code,{children:"docs/Button.mdx"})," file:"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",meta:'title="Button.mdx"',children:"# Button\n\n## Basic Usage\n\nButtons come in four sizes: small, medium, large\n\n```tsx\nimport React from 'react';\nimport { Button } from 'demo';\n\nexport default () => {\n return ;\n};\n```\n"})}),"\n",(0,t.jsxs)(n.ol,{start:"2",children:["\n",(0,t.jsxs)(n.li,{children:["In the ",(0,t.jsx)(n.code,{children:"tsconfig.json"}),", configure aliases and point the package name to the current project directory, make the way document developers and users use components consistent:"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",meta:'title="tsconfig.json"',children:'{\n "compilerOptions": {\n "paths": {\n "demo": ["."]\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.ol,{start:"3",children:["\n",(0,t.jsxs)(n.li,{children:["In the ",(0,t.jsx)(n.code,{children:".gitignore"}),", add ",(0,t.jsx)(n.code,{children:"doc_build/"}),":"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",meta:'title=".gitignore"',children:"doc_build/\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Congratulations, you have finished writing a component document, execute ",(0,t.jsx)(n.code,{children:"pnpm run dev"})," to see the result, remember to build the component library first to make sure the component product exists."]}),"\n",(0,t.jsxs)(n.h3,{id:"mobile-preview",children:["Mobile Preview",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#mobile-preview",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["Also, we support mobile preview mode, i.e. rendering mobile components using iframe, and set iframe position by ",(0,t.jsx)(n.code,{children:"iframePosition"}),",\nsupport swipe preview and new page opening."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools'.\nimport { modulePluginDoc } from '@modern-js/plugin-rspress'.\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n /**\n * Select the preview method\n * @default internal\n */\n previewMode: 'iframe',\n /**\n * Select iframe position\n * @default 'follow'\n */\n iframePosition: 'fixed',\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,t.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,t.jsxs)(n.p,{children:["If you only want to change the way a particular ",(0,t.jsx)(n.code,{children:"jsx"})," and ",(0,t.jsx)(n.code,{children:"tsx"})," block is previewed, you can use a different modifier to identify it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:"```jsx pure\n// The content here will not be rendered\n```\n\n```jsx internal\n// Used to render components in documentation\n```\n\n```jsx iframe\n// Used to render components in iframe\n```\n"})}),"\n"]})]}),"\n",(0,t.jsxs)(n.h3,{id:"using-external-demos",children:["Using external demos",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-external-demos",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["If our demo is very complex, then it is recommended to write the demo separately and then use the ",(0,t.jsx)(n.code,{children:"code"})," tag in the mdx:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,t.jsx)(n.p,{children:"This also supports setting the preview method for each individual code block, for example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"using-built-in-components",children:["Using built-in components",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-built-in-components",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"The plugin implements some built-in components internally so that you can develop module documentation more easily."}),"\n",(0,t.jsxs)(n.h3,{id:"api",children:["API",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Display the API content of the module."}),"\n",(0,t.jsxs)(n.h4,{id:"parse-file",children:["Parse file",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parse-file",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Before we can use the API component, we first need to specify the files to parse:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n Button: './src/button.tsx',\n },\n apiParseTool: 'react-docgen-typescript',\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"content-generation",children:["Content generation",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#content-generation",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Next, we'll see what kind of markdown content is generated based on the parsed file."}),"\n",(0,t.jsxs)(n.p,{children:["Content can be generated with two different tools, ",(0,t.jsx)(n.a,{href:"https://github.com/styleguidist/react-docgen-typescript",target:"_blank",rel:"noopener noreferrer",children:"react-docgen-typescript"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/documentationjs/documentation",target:"_blank",rel:"noopener noreferrer",children:"documentation"}),":"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"react-docgen-typescript"})," is targeted at component library scenarios and will only parse props to generate tables."]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"export type ButtonProps = {\n /**\n * Whether to disable the button\n */\n disabled?: boolean;\n /* * Whether to disable the button */ disabled?\n * Type of Button\n * @default 'default'\n */\n size?: 'mini' | 'small' | 'default' | 'large';\n}.\nexport const Button = (props?: ButtonProps) => {};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The above is a standard writeup where ",(0,t.jsx)(n.code,{children:"ButtonProps"})," will be extracted into the table and ",(0,t.jsx)(n.code,{children:"Button"})," will be the title of the table.\nIf you use the default export, the filename will be used as the form title."]}),"\n",(0,t.jsx)(n.p,{children:"Notice that export features declared elsewhere are not available."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"const A = () => {};\n\nexport { A }; // wrong\nexport default A; // wrong\nexport const B = () => {}; // right\nexport default () => {}; // right\n"})}),"\n",(0,t.jsx)(n.p,{children:"The generated content is as follows:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-mdx",children:'### ButtonTest\n\n| property | description | type | default |\n| :------: | :---------------------------: | :--------------------------------------: | :---------: |\n| disabled | Whether to disable the button | `boolean` | `-` |\n| size | Type of Button | `"mini" \\|"small" \\|"default" \\|"large"` | `\'default\'` |\n'})}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,t.jsx)(n.p,{children:"If React types are used in Props, you need to add the types in tsconfig.json, otherwise the types will not be resolved under the React namespace."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "compilerOptions": {\n "types": ["react"]\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"The best way is that you import the type directly:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { FC } from 'react';\n"})}),"\n"]})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"documentation"})," is used in tool library scenarios to parse JSDoc annotations."]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"/**\n * Greet function that returns a greeting message.\n * @param {string} name - The name of the person to greet.\n * @param {string} [greeting='Hello'] - The greeting to use.\n * @returns {string} The greeting message.\n */\nfunction greet(name: string, greeting = 'Hello') {\n return `${greeting}, ${name}! `;\n}\n"})}),"\n",(0,t.jsx)(n.p,{children:"The above is a greet function with a JSDoc annotation. The generated content is as follows:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-md",children:"\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"overview",children:["Overview",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Displays a list of modules that can be placed on the front page to display all modules."}),"\n",(0,t.jsx)(n.p,{children:"The Overview component has only one list property, which receives an array of objects, and the following properties of the objects"}),"\n",(0,t.jsxs)(n.table,{children:["\n",(0,t.jsxs)(n.thead,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.th,{align:"center",children:"property"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"description"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"type"}),"\n",(0,t.jsx)(n.th,{align:"center",children:"default"}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.tbody,{children:["\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"React.ReactNode"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"text"}),"\n",(0,t.jsxs)(n.td,{align:"center",children:["text(",(0,t.jsx)(n.strong,{children:"required"}),")"]}),"\n",(0,t.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"link"}),"\n",(0,t.jsxs)(n.td,{align:"center",children:["link(",(0,t.jsx)(n.strong,{children:"required"}),")"]}),"\n",(0,t.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,t.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,t.jsxs)(n.tr,{children:["\n",(0,t.jsx)(n.td,{align:"center",children:"arrow"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"whether to show arrows"}),"\n",(0,t.jsx)(n.td,{align:"center",children:"boolean"}),"\n",(0,t.jsx)(n.td,{align:"center",children:(0,t.jsx)(n.code,{children:"false"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"plugin-options",children:["Plugin options",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-options",children:"#"})]}),"\n",(0,t.jsxs)(n.h3,{id:"apiparsetool",children:["apiParseTool",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiparsetool",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"API parse tool."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"'react-docgen-typescript' | 'documentation'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'react-docgen-typescript'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.h3,{id:"doc",children:["doc",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#doc",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://rspress.dev/api/index.html",target:"_blank",rel:"noopener noreferrer",children:"Config"}),"."]}),"\n",(0,t.jsxs)(n.h3,{id:"entries",children:["entries",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#entries",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"Module names and relative paths for automatically generated documents."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"Entries | ToolEntries"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"type Entries = Record;\ntype ToolEntries = {\n documentation: Entries;\n 'react-docgen-typescript': Entries;\n};\n"})}),"\n",(0,t.jsx)(n.p,{children:"It also supports the use of different parsing tools for different files:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n documentation: {\n Add: './src/utils/add.ts',\n },\n 'react-docgen-typescript': {\n Button: './src/components/button.tsx',\n },\n },\n }),\n ],\n});\n"})}),"\n",(0,t.jsxs)(n.h3,{id:"iframeposition",children:["iframePosition",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#iframeposition",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,t.jsx)(n.code,{children:"'follow' | 'fixed'"})]}),"\n",(0,t.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,t.jsx)(n.code,{children:"'follow'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["When the value is ",(0,t.jsx)(n.code,{children:"follow"}),", each code block will have an iframe showing its rendered view.\nWhen ",(0,t.jsx)(n.code,{children:"fixed"}),", the iframe will be fixed to the right side of the page, showing the view of all the code blocks on the current page."]}),"\n",(0,t.jsxs)(n.h3,{id:"parsetooloptions",children:["parseToolOptions",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parsetooloptions",children:"#"})]}),"\n",(0,t.jsx)(n.p,{children:"API parse tool options."}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"ParseToolOptions"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"type ParseToolOptions = {\n // https://github.com/styleguidist/react-docgen-typescript#options\n 'react-docgen-typescript'?: ParserOptions;\n // https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md#parameters-1\n documentation?: DocumentationArgs;\n};\n"})}),"\n",(0,t.jsxs)(n.h3,{id:"previewmode",children:["previewMode",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#previewmode",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Type:",(0,t.jsx)(n.code,{children:"'iframe' | 'internal'"})]}),"\n",(0,t.jsxs)(n.li,{children:["Default: ",(0,t.jsx)(n.code,{children:"'internal'"})]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["In case of ",(0,t.jsx)(n.code,{children:"internal"}),", the component will be rendered directly in the page, otherwise it will be loaded through an iframe."]}),"\n",(0,t.jsxs)(n.h3,{id:"deprecated-languages",children:["deprecated: languages",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-languages",children:"#"})]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["Starting from version 2.44.0, please refer to the ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"Internationalization"})," section to implement multiple languages.\n"]})})]}),"\n",(0,t.jsxs)(n.h3,{id:"deprecated-usemodulesidebar",children:["deprecated: useModuleSidebar",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-usemodulesidebar",children:"#"})]}),"\n",(0,t.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,t.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,t.jsx)(n.div,{className:"rspress-directive-content",children:(0,t.jsxs)(n.p,{children:["Starting from version 2.44.0, a sniffing mechanism has been implemented internally, so please directly use ",(0,t.jsx)(n.a,{href:"https://rspress.dev/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"}),"\nor directly configure ",(0,t.jsx)(n.a,{href:"https://rspress.dev/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"})," to implement a custom sidebar.\n"]})})]}),"\n",(0,t.jsxs)(n.h2,{id:"scripts",children:["Scripts",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"modern dev"}),": Start dev server for doc site."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"modern build --platform"}),": Build doc site in production, by default output directories is ",(0,t.jsx)(n.code,{children:"doc_build"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"advanced-guide",children:["Advanced guide",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#advanced-guide",children:"#"})]}),"\n",(0,t.jsxs)(n.p,{children:["The above has covered the basics of developing module documentation, but this is not enough for developing a complete documentation station. Check out the ",(0,t.jsx)(n.a,{href:"https://rspress.dev",target:"_blank",rel:"noopener noreferrer",children:"Rspress"})," for an in-depth look at our documentation framework.\nYou can modify the documentation framework configuration via the ",(0,t.jsx)(n.code,{children:"doc"})," configuration."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools'.\nimport { modulePluginDoc } from '@modern-js/plugin-rspress'.\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n doc: {\n // Customize the documentation site configuration\n }\n }),\n ],\n});\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(s,{...e})}):s(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fuse-module-doc.mdx"]={toc:[{text:"Before we start",id:"before-we-start",depth:2},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3},{text:"Basic site structure",id:"basic-site-structure",depth:2},{text:"Configure sidebar",id:"configure-sidebar",depth:3},{text:"Writing Documentation",id:"writing-documentation",depth:2},{text:"Component preview",id:"component-preview",depth:2},{text:"Example",id:"example",depth:3},{text:"Mobile Preview",id:"mobile-preview",depth:3},{text:"Using external demos",id:"using-external-demos",depth:3},{text:"Using built-in components",id:"using-built-in-components",depth:2},{text:"API",id:"api",depth:3},{text:"Parse file",id:"parse-file",depth:4},{text:"Content generation",id:"content-generation",depth:4},{text:"Using the component",id:"using-the-component",depth:4},{text:"Overview",id:"overview",depth:3},{text:"Plugin options",id:"plugin-options",depth:2},{text:"apiParseTool",id:"apiparsetool",depth:3},{text:"doc",id:"doc",depth:3},{text:"entries",id:"entries",depth:3},{text:"iframePosition",id:"iframeposition",depth:3},{text:"parseToolOptions",id:"parsetooloptions",depth:3},{text:"previewMode",id:"previewmode",depth:3},{text:"deprecated: languages",id:"deprecated-languages",depth:3},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3},{text:"Scripts",id:"scripts",depth:2},{text:"Advanced guide",id:"advanced-guide",depth:2}],title:"Developing Module documentation",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/952.6c5ac17e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8058.a1f19999.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/952.6c5ac17e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8058.a1f19999.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9826.e8ebb4aa.js b/modern-js/module-tools/static/js/async/8067.3cf6d68d.js similarity index 85% rename from modern-js/module-tools/static/js/async/9826.e8ebb4aa.js rename to modern-js/module-tools/static/js/async/8067.3cf6d68d.js index 087757f4f6..2a03d9872e 100644 --- a/modern-js/module-tools/static/js/async/9826.e8ebb4aa.js +++ b/modern-js/module-tools/static/js/async/8067.3cf6d68d.js @@ -1,2 +1,2 @@ -/*! For license information please see 9826.e8ebb4aa.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9826"],{67903:function(e,n,s){"use strict";s.r(n);var t=s("39980"),o=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,t.jsxs)(n.h1,{id:"\u6982\u89C8",children:["\u6982\u89C8",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6982\u89C8",children:"#"})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(r,{...e})}):r(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["zh%2Fapi%2Findex.md"]={toc:[],title:"\u6982\u89C8",frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 8067.3cf6d68d.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8067"],{46498:function(e,n,s){"use strict";s.r(n);var t=s("39980"),o=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,t.jsxs)(n.h1,{id:"\u6982\u89C8",children:["\u6982\u89C8",(0,t.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6982\u89C8",children:"#"})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(r,{...e})}):r(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["zh%2Fapi%2Findex.md"]={toc:[],title:"\u6982\u89C8",frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/81.129c306f.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8067.3cf6d68d.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/81.129c306f.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8067.3cf6d68d.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/81.129c306f.js b/modern-js/module-tools/static/js/async/81.129c306f.js deleted file mode 100644 index c4a92fb642..0000000000 --- a/modern-js/module-tools/static/js/async/81.129c306f.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 81.129c306f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["81"],{3620:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Fpublish-emo.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8104.66e49f69.js b/modern-js/module-tools/static/js/async/8104.66e49f69.js new file mode 100644 index 0000000000..9fd82cebf3 --- /dev/null +++ b/modern-js/module-tools/static/js/async/8104.66e49f69.js @@ -0,0 +1,2 @@ +/*! For license information please see 8104.66e49f69.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8104"],{31456:function(e,l,n){"use strict";n.r(l);var s=n("39980"),o=n("9580"),i=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",code:"code",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.h1,{id:"polyfill-\u63D2\u4EF6",children:["Polyfill \u63D2\u4EF6",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#polyfill-\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,s.jsx)(l.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(l.div,{className:"rspress-directive-content",children:[(0,s.jsx)(l.p,{children:"\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u9700\u8981\u4E3A npm \u5305\u6CE8\u5165 polyfill\uFF0C\u8FD9\u4E00\u6B65\u5E94\u8BE5\u5728 Web \u5E94\u7528\u7684\u6846\u67B6\u4FA7\u5B8C\u6210\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u573A\u666F\uFF0C\u4E3A\u4E86\u8BA9\u6211\u4EEC\u7684\u5E93\u80FD\u591F\u76F4\u63A5\u8FD0\u884C\u5728\u4F4E\u7248\u672C\u6D4F\u89C8\u5668\u91CC\uFF0C\u6211\u4EEC\u9700\u8981\u6CE8\u5165 polyfill\u3002"}),"\n",(0,s.jsxs)(l.p,{children:["\u8BF7\u6CE8\u610F\uFF0C\u6B64\u63D2\u4EF6\u5E76\u4E0D\u4F1A\u8F6C\u5316\u4F60\u7684\u4EE3\u7801\u8BED\u6CD5\uFF0C\u53EA\u4F1A\u4E3A\u4F60\u7684\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u4E0D\u652F\u6301\u7684\u529F\u80FD\u6CE8\u5165 polyfill\uFF0C\u628A\u5B83\u4EEC\u4F5C\u4E3A\u666E\u901A\u51FD\u6570\u5BFC\u5165\u800C\u4E0D\u662F\u6C61\u67D3\u5168\u5C40\u3002\u4F60\u9700\u8981\u5B89\u88C5 ",(0,s.jsx)(l.code,{children:"core-js-pure"})," \u4F9D\u8D56"]}),"\n"]})]}),"\n",(0,s.jsxs)(l.h2,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(l.h3,{id:"\u5B89\u88C5",children:["\u5B89\u88C5",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B89\u88C5",children:"#"})]}),"\n","\n",(0,s.jsx)(i.SU,{command:"add @modern-js/plugin-module-polyfill -D"}),"\n",(0,s.jsxs)(l.h3,{id:"\u6CE8\u518C\u63D2\u4EF6",children:["\u6CE8\u518C\u63D2\u4EF6",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u518C\u63D2\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(l.p,{children:"\u5728 Modern.js Module \u4E2D\uFF0C\u4F60\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6CE8\u518C\u63D2\u4EF6\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginPolyfill()],\n});\n"})}),"\n",(0,s.jsx)(l.p,{children:"\u4F60\u4E5F\u53EF\u4EE5\u901A\u8FC7 hooks \u914D\u7F6E\u6CE8\u518C\uFF0C\u4F8B\u5982\u4F60\u540C\u65F6\u5177\u6709\u591A\u4EFD\u6784\u5EFA\u914D\u7F6E\uFF0C\u5E76\u53EA\u9700\u8981\u5728 bundle \u6784\u5EFA\u65F6\u6CE8\u5165 polyfill\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getPolyfillHook } from '@modern-js/plugin-module-polyfill';\n\nconst polyfillHook = getPolyfillHook();\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n buildType: 'bundle',\n hooks: [polyfillHook],\n },\n {\n buildType: 'bundleless',\n },\n ],\n});\n"})}),"\n",(0,s.jsxs)(l.h2,{id:"\u914D\u7F6E",children:["\u914D\u7F6E",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(l.ul,{children:["\n",(0,s.jsx)(l.li,{children:(0,s.jsx)(l.strong,{children:"\u7C7B\u578B\uFF1A"})}),"\n"]}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"type options = {\n targets?: Record | string;\n};\n"})}),"\n",(0,s.jsxs)(l.h3,{id:"targets",children:["targets",(0,s.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#targets",children:"#"})]}),"\n",(0,s.jsxs)(l.p,{children:["\u53C2\u8003 ",(0,s.jsx)(l.a,{href:"https://babeljs.io/docs/options#targets",target:"_blank",rel:"noopener noreferrer",children:"Babel target"}),"."]}),"\n",(0,s.jsx)(l.p,{children:"\u4E0B\u9762\u662F\u4E00\u4E2A\u4F8B\u5B50\uFF1A"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginPolyfill({\n targets: '> 0.25%, not dead',\n }),\n ],\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,o.ah)(),e.components);return l?(0,s.jsx)(l,{...e,children:(0,s.jsx)(r,{...e})}):r(e)}l.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Fplugin-polyfill.mdx"]={toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2},{text:"targets",id:"targets",depth:3}],title:"Polyfill \u63D2\u4EF6",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8104.66e49f69.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8104.66e49f69.js.LICENSE.txt new file mode 100644 index 0000000000..0e69721496 --- /dev/null +++ b/modern-js/module-tools/static/js/async/8104.66e49f69.js.LICENSE.txt @@ -0,0 +1,5 @@ +/*! react/jsx-runtime */ + +/*! @mdx-js/react */ + +/*! @theme */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5388.a629059c.js b/modern-js/module-tools/static/js/async/8269.4ed5a426.js similarity index 95% rename from modern-js/module-tools/static/js/async/5388.a629059c.js rename to modern-js/module-tools/static/js/async/8269.4ed5a426.js index 9d4836bfea..b1a70ba974 100644 --- a/modern-js/module-tools/static/js/async/5388.a629059c.js +++ b/modern-js/module-tools/static/js/async/8269.4ed5a426.js @@ -1,2 +1,2 @@ -/*! For license information please see 5388.a629059c.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5388"],{69553:function(l,i,e){"use strict";e.r(i);var n=e("39980"),s=e("9580");function r(l){let i=Object.assign({h1:"h1",a:"a",h2:"h2",ul:"ul",li:"li",code:"code"},(0,s.ah)(),l.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.h1,{id:"\u603B\u89C8",children:["\u603B\u89C8",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#\u603B\u89C8",children:"#"})]}),"\n",(0,n.jsxs)(i.h2,{id:"\u5B98\u65B9\u63D2\u4EF6",children:["\u5B98\u65B9\u63D2\u4EF6",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B98\u65B9\u63D2\u4EF6",children:"#"})]}),"\n",(0,n.jsxs)(i.ul,{children:["\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-import",children:"@modern-js/plugin-module-import"}),"\uFF1A\u4F7F\u7528 SWC \u63D0\u4F9B\u4E0E ",(0,n.jsx)(i.code,{children:"babel-plugin-import"})," \u4E00\u6837\u7684\u80FD\u529B\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-banner",children:"@modern-js/plugin-module-banner"}),"\uFF1A\u4E3A\u6BCF\u4E2A JS \u548C CSS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6DFB\u52A0\u81EA\u5B9A\u4E49\u5185\u5BB9\uFF0C\u4F8B\u5982\u7248\u6743\u4FE1\u606F\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-node-polyfill",children:"@modern-js/plugin-module-node-polyfill"}),"\uFF1A\u4F1A\u81EA\u52A8\u6CE8\u5165 Node \u6838\u5FC3\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u7AEF\u7684 polyfills\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-polyfill",children:"@modern-js/plugin-module-polyfill"}),"\uFF1A\u4E3A\u4F60\u7684\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u4E0D\u652F\u6301\u7684\u529F\u80FD\u6CE8\u5165 polyfill\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-babel",children:"@modern-js/plugin-module-babel"}),"\uFF1A\u4F7F\u7528 Babel \u8F6C\u6362\u4F60\u7684\u4EE3\u7801\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-vue",children:"@modern-js/plugin-module-vue"}),"\uFF1A\u63D0\u4F9B\u5BF9 Vue 3 \u7EC4\u4EF6\u6784\u5EFA\u7684\u652F\u6301\u3002"]}),"\n"]})]})}function d(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,s.ah)(),l.components);return i?(0,n.jsx)(i,{...l,children:(0,n.jsx)(r,{...l})}):r(l)}i.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Foverview.md"]={toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2}],title:"\u603B\u89C8",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 8269.4ed5a426.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8269"],{17482:function(l,i,e){"use strict";e.r(i);var n=e("39980"),s=e("9580");function r(l){let i=Object.assign({h1:"h1",a:"a",h2:"h2",ul:"ul",li:"li",code:"code"},(0,s.ah)(),l.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.h1,{id:"\u603B\u89C8",children:["\u603B\u89C8",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#\u603B\u89C8",children:"#"})]}),"\n",(0,n.jsxs)(i.h2,{id:"\u5B98\u65B9\u63D2\u4EF6",children:["\u5B98\u65B9\u63D2\u4EF6",(0,n.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5B98\u65B9\u63D2\u4EF6",children:"#"})]}),"\n",(0,n.jsxs)(i.ul,{children:["\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-import",children:"@modern-js/plugin-module-import"}),"\uFF1A\u4F7F\u7528 SWC \u63D0\u4F9B\u4E0E ",(0,n.jsx)(i.code,{children:"babel-plugin-import"})," \u4E00\u6837\u7684\u80FD\u529B\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-banner",children:"@modern-js/plugin-module-banner"}),"\uFF1A\u4E3A\u6BCF\u4E2A JS \u548C CSS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6DFB\u52A0\u81EA\u5B9A\u4E49\u5185\u5BB9\uFF0C\u4F8B\u5982\u7248\u6743\u4FE1\u606F\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-node-polyfill",children:"@modern-js/plugin-module-node-polyfill"}),"\uFF1A\u4F1A\u81EA\u52A8\u6CE8\u5165 Node \u6838\u5FC3\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u7AEF\u7684 polyfills\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-polyfill",children:"@modern-js/plugin-module-polyfill"}),"\uFF1A\u4E3A\u4F60\u7684\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u4E0D\u652F\u6301\u7684\u529F\u80FD\u6CE8\u5165 polyfill\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-babel",children:"@modern-js/plugin-module-babel"}),"\uFF1A\u4F7F\u7528 Babel \u8F6C\u6362\u4F60\u7684\u4EE3\u7801\u3002"]}),"\n",(0,n.jsxs)(i.li,{children:[(0,n.jsx)(i.a,{href:"/zh/plugins/official-list/plugin-vue",children:"@modern-js/plugin-module-vue"}),"\uFF1A\u63D0\u4F9B\u5BF9 Vue 3 \u7EC4\u4EF6\u6784\u5EFA\u7684\u652F\u6301\u3002"]}),"\n"]})]})}function d(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,s.ah)(),l.components);return i?(0,n.jsx)(i,{...l,children:(0,n.jsx)(r,{...l})}):r(l)}i.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fofficial-list%2Foverview.md"]={toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2}],title:"\u603B\u89C8",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8175.9fda3d57.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8269.4ed5a426.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8175.9fda3d57.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8269.4ed5a426.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/840.17ce598b.js b/modern-js/module-tools/static/js/async/840.17ce598b.js deleted file mode 100644 index e7edb315b7..0000000000 --- a/modern-js/module-tools/static/js/async/840.17ce598b.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 840.17ce598b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["840"],{12761:function(e,n,s){"use strict";s.r(n);var r=s("39980"),i=s("9580");function l(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"\u5E38\u89C1\u95EE\u9898",children:["\u5E38\u89C1\u95EE\u9898",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5E38\u89C1\u95EE\u9898",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"\u8FD9\u91CC\u662F Modern.js Module \u5E38\u89C1\u95EE\u9898\u5206\u7C7B\u5217\u8868\uFF1A"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/basic",children:"\u901A\u7528\u7C7B\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/build",children:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/storybook",children:"Storybook \u76F8\u5173\u95EE\u9898"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/zh/guide/faq/test",children:"\u6D4B\u8BD5\u76F8\u5173\u95EE\u9898"})}),"\n"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Findex.md"]={toc:[],title:"\u5E38\u89C1\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8439.74d8f520.js b/modern-js/module-tools/static/js/async/8409.1be93ad7.js similarity index 99% rename from modern-js/module-tools/static/js/async/8439.74d8f520.js rename to modern-js/module-tools/static/js/async/8409.1be93ad7.js index 124c4babf6..5778130577 100644 --- a/modern-js/module-tools/static/js/async/8439.74d8f520.js +++ b/modern-js/module-tools/static/js/async/8409.1be93ad7.js @@ -1,2 +1,2 @@ -/*! For license information please see 8439.74d8f520.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8439"],{15755:function(e,i,n){"use strict";n.r(i);var s=n("39980"),r=n("9580");function o(e){let i=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",pre:"pre",strong:"strong",ul:"ul",li:"li",ol:"ol",em:"em"},(0,r.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.h1,{id:"modify-the-output",children:["Modify the output",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#modify-the-output",children:"#"})]}),"\n",(0,s.jsxs)(i.h2,{id:"default-output-artifacts",children:["Default output artifacts",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#default-output-artifacts",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["When you use the ",(0,s.jsx)(i.code,{children:"modern build"})," command in an initialized project, Modern.js Module will generate corresponding build artifacts based on the current configuration."]}),"\n",(0,s.jsx)(i.p,{children:"The default configuration is as follows:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // Register the CLI tool of Modern.js Module\n plugins: [moduleTools()],\n // Specify the build preset configuration\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.strong,{children:"The default output files has the following characteristics"}),"."]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["will generate ",(0,s.jsx)(i.a,{href:"https://nodejs.org/api/modules.html#modules-commonjs-modules",target:"_blank",rel:"noopener noreferrer",children:"CommonJS"})," and ",(0,s.jsx)(i.a,{href:"https://nodejs.org/api/esm.html#modules-ecmascript-modules",target:"_blank",rel:"noopener noreferrer",children:"ESM"}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The code syntax is supported up to ",(0,s.jsx)(i.code,{children:"ES6"})," , and more advanced syntax will be converted."]}),"\n",(0,s.jsxs)(i.li,{children:["All code is bundled into one file, i.e. ",(0,s.jsx)(i.strong,{children:"bundle"})," processing is performed."]}),"\n",(0,s.jsxs)(i.li,{children:["The output root directory is the ",(0,s.jsx)(i.code,{children:"dist"})," directory under the project, and the type file output directory is ",(0,s.jsx)(i.code,{children:"dist/types"}),"."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"You may have the following questions when you see this."}),"\n",(0,s.jsxs)(i.ol,{children:["\n",(0,s.jsxs)(i.li,{children:["what is ",(0,s.jsx)(i.code,{children:"buildPreset"}),"?"]}),"\n",(0,s.jsx)(i.li,{children:"what determines these characteristics of the product?"}),"\n"]}),"\n",(0,s.jsxs)(i.p,{children:["Then the next step is to first explain ",(0,s.jsx)(i.code,{children:"buildPreset"}),"."]}),"\n",(0,s.jsxs)(i.h2,{id:"buildpreset",children:["buildPreset",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#buildpreset",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["The ",(0,s.jsx)(i.code,{children:"buildPreset"})," represents a prepared set or sets of build-related configurations that can be used to eliminate the trouble and complexity of configuration by using the default values corresponding to the build Preset, resulting in the expected product."]}),"\n",(0,s.jsx)(i.p,{children:"Modern.js Module mainly comes with two built-in build presets, including:"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:"npm-component: Used to build component libraries."}),"\n",(0,s.jsx)(i.li,{children:"npm-library: Used to package projects of other library types, such as tool libraries."}),"\n"]}),"\n",(0,s.jsxs)(i.p,{children:["It also provides some variations, such as ",(0,s.jsx)(i.code,{children:"npm-library-with-umd"})," and ",(0,s.jsx)(i.code,{children:"npm-library-es5"}),", which, as their names suggest, correspond to library presets with umd output and support for es5 syntax, respectively. For more detailed configuration, you can refer to its ",(0,s.jsx)(i.a,{href:"/api/config/build-preset",children:"API"}),"."]}),"\n",(0,s.jsx)(i.p,{children:"In addition, we can also fully customize the build configuration:"}),"\n",(0,s.jsxs)(i.h2,{id:"buildconfig",children:["buildConfig",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsxs)(i.strong,{children:[(0,s.jsx)(i.code,{children:"buildConfig"})," is a configuration option that describes how to compile and generate build artifacts"]}),'. What was mentioned at the beginning about "',(0,s.jsx)(i.em,{children:"features of build artifacts"}),'" are actually properties supported by ',(0,s.jsx)(i.code,{children:"buildConfig"}),". The currently supported properties cover the needs of most module type projects when building artifacts. ",(0,s.jsx)(i.code,{children:"buildConfig"})," not only contains some properties that artifacts have, but also contains some features needed to build artifacts. The following is a brief list from a classification point of view."]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"The basic attributes of a build artifacts include:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Whether the artifact is bundled or not: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#buildtype",children:(0,s.jsx)(i.code,{children:"buildConfig.buildType"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Product support for syntax: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#target",children:(0,s.jsx)(i.code,{children:"buildConfig.target"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Output format: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#format",children:(0,s.jsx)(i.code,{children:"buildConfig.format"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["How the output type file is handled: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#dts",children:(0,s.jsx)(i.code,{children:"buildConfig.dts"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["How the sourceMap of the artifact is handled: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#sourcemap",children:(0,s.jsx)(i.code,{children:"buildConfig.sourceMap"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The input (or source file) corresponding to the output: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#input",children:(0,s.jsx)(i.code,{children:"buildConfig.input"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The directory of the output of the artifact: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#outdir",children:(0,s.jsx)(i.code,{children:"buildConfig.outDir"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Build source directory: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#sourcedir",children:(0,s.jsx)(i.code,{children:"buildConfig.sourceDir"})}),"."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Common functions required for build artifacts include:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Alias: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#alias",children:(0,s.jsx)(i.code,{children:"buildConfig.alias"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Static resource handling: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#asset",children:(0,s.jsx)(i.code,{children:"buildConfig.asset"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Third-party dependency handling: The corresponding APIs are","\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/api/config/build-config#autoexternal",children:(0,s.jsx)(i.code,{children:"buildConfig.autoExternal"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/api/config/build-config#externals",children:(0,s.jsx)(i.code,{children:"buildConfig.externals"})}),"."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(i.li,{children:["Copy: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#copy",children:(0,s.jsx)(i.code,{children:"buildConfig.copy"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Global variable substitution: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#define",children:(0,s.jsx)(i.code,{children:"buildConfig.define"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Specify ",(0,s.jsx)(i.a,{href:"https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"JSX"})," compilation method, the corresponding API is [",(0,s.jsx)(i.code,{children:"buildConfig.jsx"}),"](/api/config/ build-config#jsx)."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Some advanced properties or less frequently used functions:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Product code compression: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#minify",children:(0,s.jsx)(i.code,{children:"buildConfig.minify"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Code splitting: ",(0,s.jsx)(i.a,{href:"/api/config/build-config#splitting",children:(0,s.jsx)(i.code,{children:"buildConfig.splitting"})})]}),"\n",(0,s.jsxs)(i.li,{children:["Specify whether the build artifacts is for the NodeJS environment or the browser environment: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#platform",children:(0,s.jsx)(i.code,{children:"buildConfig.platform"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["umd product-related.","\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Specifies the global variables imported externally to the umd product: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#umdglobals",children:(0,s.jsx)(i.code,{children:"buildConfig.umdGlobals"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Specify the module name of the umd product: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#umdmodulename",children:(0,s.jsx)(i.code,{children:"buildConfig.umdModuleName"})}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"In addition to the above categories, frequently asked questions and best practices about these APIs can be found at the following links"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:(0,s.jsxs)(i.a,{href:"/guide/advance/in-depth-about-build#bundle--bundleless",children:["About ",(0,s.jsx)(i.code,{children:"bundle"})," and ",(0,s.jsx)(i.code,{children:"bundleless"}),"?"]})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsxs)(i.a,{href:"/guide/advance/in-depth-about-build#input--sourcedir",children:["About ",(0,s.jsx)(i.code,{children:"input"})," and ",(0,s.jsx)(i.code,{children:"sourceDir"})]})}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/guide/advance/in-depth-about-build#dts",children:"About d.ts"}),"."]}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/in-depth-about-build#define",children:"How to use define"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/external-dependency",children:"How to handle third-party dependencies?"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/copy",children:"How to use copy?"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/build-umd",children:"How to use umd"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/asset",children:"How to use asset"})}),"\n"]}),"\n",(0,s.jsxs)(i.h2,{id:"combining-configuration-and-presets",children:["Combining Configuration and Presets",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#combining-configuration-and-presets",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["Once we understand ",(0,s.jsx)(i.code,{children:"buildPreset"})," and ",(0,s.jsx)(i.code,{children:"buildConfig"}),", we can use them together."]}),"\n",(0,s.jsxs)(i.p,{children:["In a real project, we can use ",(0,s.jsx)(i.code,{children:"buildPreset"})," to quickly get a set of default build configurations. If you need to customise it, you can use ",(0,s.jsx)(i.code,{children:"buildConfig"})," to override and extend it."]}),"\n",(0,s.jsx)(i.p,{children:"The extension logic is as follows."}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["When ",(0,s.jsx)(i.code,{children:"buildConfig"})," is an array, new configuration items are added to the original preset."]}),"\n"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: [\n {\n format: 'iife',\n target: 'es2020',\n outDir: '. /dist/global'\n }\n ]\n});\n"})}),"\n",(0,s.jsxs)(i.p,{children:["This will generate an additional IIFE-formatted product that supports up to ES2020 syntax on top of the original preset, in the ",(0,s.jsx)(i.code,{children:"dist/global"})," directory under the project."]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["When ",(0,s.jsx)(i.code,{children:"buildConfig"})," is an object, the configuration items in the object are overwritten in the preset."]}),"\n"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: {\n sourceMap: true,\n },\n}).\n"})}),"\n",(0,s.jsx)(i.p,{children:"This will cause a sourceMap file to be generated for each build task."})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,r.ah)(),e.components);return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}i.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fmodify-output-product.md"]={toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2},{text:"buildPreset",id:"buildpreset",depth:2},{text:"buildConfig",id:"buildconfig",depth:2},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2}],title:"Modify the output",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 8409.1be93ad7.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8409"],{66939:function(e,i,n){"use strict";n.r(i);var s=n("39980"),r=n("9580");function o(e){let i=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",pre:"pre",strong:"strong",ul:"ul",li:"li",ol:"ol",em:"em"},(0,r.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.h1,{id:"modify-the-output",children:["Modify the output",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#modify-the-output",children:"#"})]}),"\n",(0,s.jsxs)(i.h2,{id:"default-output-artifacts",children:["Default output artifacts",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#default-output-artifacts",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["When you use the ",(0,s.jsx)(i.code,{children:"modern build"})," command in an initialized project, Modern.js Module will generate corresponding build artifacts based on the current configuration."]}),"\n",(0,s.jsx)(i.p,{children:"The default configuration is as follows:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // Register the CLI tool of Modern.js Module\n plugins: [moduleTools()],\n // Specify the build preset configuration\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.strong,{children:"The default output files has the following characteristics"}),"."]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["will generate ",(0,s.jsx)(i.a,{href:"https://nodejs.org/api/modules.html#modules-commonjs-modules",target:"_blank",rel:"noopener noreferrer",children:"CommonJS"})," and ",(0,s.jsx)(i.a,{href:"https://nodejs.org/api/esm.html#modules-ecmascript-modules",target:"_blank",rel:"noopener noreferrer",children:"ESM"}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The code syntax is supported up to ",(0,s.jsx)(i.code,{children:"ES6"})," , and more advanced syntax will be converted."]}),"\n",(0,s.jsxs)(i.li,{children:["All code is bundled into one file, i.e. ",(0,s.jsx)(i.strong,{children:"bundle"})," processing is performed."]}),"\n",(0,s.jsxs)(i.li,{children:["The output root directory is the ",(0,s.jsx)(i.code,{children:"dist"})," directory under the project, and the type file output directory is ",(0,s.jsx)(i.code,{children:"dist/types"}),"."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"You may have the following questions when you see this."}),"\n",(0,s.jsxs)(i.ol,{children:["\n",(0,s.jsxs)(i.li,{children:["what is ",(0,s.jsx)(i.code,{children:"buildPreset"}),"?"]}),"\n",(0,s.jsx)(i.li,{children:"what determines these characteristics of the product?"}),"\n"]}),"\n",(0,s.jsxs)(i.p,{children:["Then the next step is to first explain ",(0,s.jsx)(i.code,{children:"buildPreset"}),"."]}),"\n",(0,s.jsxs)(i.h2,{id:"buildpreset",children:["buildPreset",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#buildpreset",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["The ",(0,s.jsx)(i.code,{children:"buildPreset"})," represents a prepared set or sets of build-related configurations that can be used to eliminate the trouble and complexity of configuration by using the default values corresponding to the build Preset, resulting in the expected product."]}),"\n",(0,s.jsx)(i.p,{children:"Modern.js Module mainly comes with two built-in build presets, including:"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:"npm-component: Used to build component libraries."}),"\n",(0,s.jsx)(i.li,{children:"npm-library: Used to package projects of other library types, such as tool libraries."}),"\n"]}),"\n",(0,s.jsxs)(i.p,{children:["It also provides some variations, such as ",(0,s.jsx)(i.code,{children:"npm-library-with-umd"})," and ",(0,s.jsx)(i.code,{children:"npm-library-es5"}),", which, as their names suggest, correspond to library presets with umd output and support for es5 syntax, respectively. For more detailed configuration, you can refer to its ",(0,s.jsx)(i.a,{href:"/api/config/build-preset",children:"API"}),"."]}),"\n",(0,s.jsx)(i.p,{children:"In addition, we can also fully customize the build configuration:"}),"\n",(0,s.jsxs)(i.h2,{id:"buildconfig",children:["buildConfig",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsxs)(i.strong,{children:[(0,s.jsx)(i.code,{children:"buildConfig"})," is a configuration option that describes how to compile and generate build artifacts"]}),'. What was mentioned at the beginning about "',(0,s.jsx)(i.em,{children:"features of build artifacts"}),'" are actually properties supported by ',(0,s.jsx)(i.code,{children:"buildConfig"}),". The currently supported properties cover the needs of most module type projects when building artifacts. ",(0,s.jsx)(i.code,{children:"buildConfig"})," not only contains some properties that artifacts have, but also contains some features needed to build artifacts. The following is a brief list from a classification point of view."]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"The basic attributes of a build artifacts include:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Whether the artifact is bundled or not: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#buildtype",children:(0,s.jsx)(i.code,{children:"buildConfig.buildType"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Product support for syntax: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#target",children:(0,s.jsx)(i.code,{children:"buildConfig.target"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Output format: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#format",children:(0,s.jsx)(i.code,{children:"buildConfig.format"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["How the output type file is handled: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#dts",children:(0,s.jsx)(i.code,{children:"buildConfig.dts"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["How the sourceMap of the artifact is handled: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#sourcemap",children:(0,s.jsx)(i.code,{children:"buildConfig.sourceMap"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The input (or source file) corresponding to the output: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#input",children:(0,s.jsx)(i.code,{children:"buildConfig.input"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["The directory of the output of the artifact: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#outdir",children:(0,s.jsx)(i.code,{children:"buildConfig.outDir"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Build source directory: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#sourcedir",children:(0,s.jsx)(i.code,{children:"buildConfig.sourceDir"})}),"."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Common functions required for build artifacts include:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Alias: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#alias",children:(0,s.jsx)(i.code,{children:"buildConfig.alias"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Static resource handling: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#asset",children:(0,s.jsx)(i.code,{children:"buildConfig.asset"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Third-party dependency handling: The corresponding APIs are","\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/api/config/build-config#autoexternal",children:(0,s.jsx)(i.code,{children:"buildConfig.autoExternal"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/api/config/build-config#externals",children:(0,s.jsx)(i.code,{children:"buildConfig.externals"})}),"."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(i.li,{children:["Copy: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#copy",children:(0,s.jsx)(i.code,{children:"buildConfig.copy"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Global variable substitution: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#define",children:(0,s.jsx)(i.code,{children:"buildConfig.define"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Specify ",(0,s.jsx)(i.a,{href:"https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"JSX"})," compilation method, the corresponding API is [",(0,s.jsx)(i.code,{children:"buildConfig.jsx"}),"](/api/config/ build-config#jsx)."]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Some advanced properties or less frequently used functions:"})}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Product code compression: The corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#minify",children:(0,s.jsx)(i.code,{children:"buildConfig.minify"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Code splitting: ",(0,s.jsx)(i.a,{href:"/api/config/build-config#splitting",children:(0,s.jsx)(i.code,{children:"buildConfig.splitting"})})]}),"\n",(0,s.jsxs)(i.li,{children:["Specify whether the build artifacts is for the NodeJS environment or the browser environment: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#platform",children:(0,s.jsx)(i.code,{children:"buildConfig.platform"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["umd product-related.","\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Specifies the global variables imported externally to the umd product: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#umdglobals",children:(0,s.jsx)(i.code,{children:"buildConfig.umdGlobals"})}),"."]}),"\n",(0,s.jsxs)(i.li,{children:["Specify the module name of the umd product: the corresponding API is ",(0,s.jsx)(i.a,{href:"/api/config/build-config#umdmodulename",children:(0,s.jsx)(i.code,{children:"buildConfig.umdModuleName"})}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"In addition to the above categories, frequently asked questions and best practices about these APIs can be found at the following links"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:(0,s.jsxs)(i.a,{href:"/guide/advance/in-depth-about-build#bundle--bundleless",children:["About ",(0,s.jsx)(i.code,{children:"bundle"})," and ",(0,s.jsx)(i.code,{children:"bundleless"}),"?"]})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsxs)(i.a,{href:"/guide/advance/in-depth-about-build#input--sourcedir",children:["About ",(0,s.jsx)(i.code,{children:"input"})," and ",(0,s.jsx)(i.code,{children:"sourceDir"})]})}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.a,{href:"/guide/advance/in-depth-about-build#dts",children:"About d.ts"}),"."]}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/in-depth-about-build#define",children:"How to use define"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/external-dependency",children:"How to handle third-party dependencies?"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/copy",children:"How to use copy?"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/build-umd",children:"How to use umd"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"/guide/advance/asset",children:"How to use asset"})}),"\n"]}),"\n",(0,s.jsxs)(i.h2,{id:"combining-configuration-and-presets",children:["Combining Configuration and Presets",(0,s.jsx)(i.a,{className:"header-anchor","aria-hidden":"true",href:"#combining-configuration-and-presets",children:"#"})]}),"\n",(0,s.jsxs)(i.p,{children:["Once we understand ",(0,s.jsx)(i.code,{children:"buildPreset"})," and ",(0,s.jsx)(i.code,{children:"buildConfig"}),", we can use them together."]}),"\n",(0,s.jsxs)(i.p,{children:["In a real project, we can use ",(0,s.jsx)(i.code,{children:"buildPreset"})," to quickly get a set of default build configurations. If you need to customise it, you can use ",(0,s.jsx)(i.code,{children:"buildConfig"})," to override and extend it."]}),"\n",(0,s.jsx)(i.p,{children:"The extension logic is as follows."}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["When ",(0,s.jsx)(i.code,{children:"buildConfig"})," is an array, new configuration items are added to the original preset."]}),"\n"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: [\n {\n format: 'iife',\n target: 'es2020',\n outDir: '. /dist/global'\n }\n ]\n});\n"})}),"\n",(0,s.jsxs)(i.p,{children:["This will generate an additional IIFE-formatted product that supports up to ES2020 syntax on top of the original preset, in the ",(0,s.jsx)(i.code,{children:"dist/global"})," directory under the project."]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["When ",(0,s.jsx)(i.code,{children:"buildConfig"})," is an object, the configuration items in the object are overwritten in the preset."]}),"\n"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: {\n sourceMap: true,\n },\n}).\n"})}),"\n",(0,s.jsx)(i.p,{children:"This will cause a sourceMap file to be generated for each build task."})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:i}=Object.assign({},(0,r.ah)(),e.components);return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}i.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fmodify-output-product.md"]={toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2},{text:"buildPreset",id:"buildpreset",depth:2},{text:"buildConfig",id:"buildconfig",depth:2},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2}],title:"Modify the output",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8200.2c9b573e.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8409.1be93ad7.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8200.2c9b573e.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8409.1be93ad7.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/8484.8075cc5a.js b/modern-js/module-tools/static/js/async/8484.8075cc5a.js deleted file mode 100644 index 3ce6687c62..0000000000 --- a/modern-js/module-tools/static/js/async/8484.8075cc5a.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 8484.8075cc5a.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8484"],{7992:function(e,n,t){"use strict";t.r(n);var r=t("39980"),i=t("9580"),o=t("23657");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",div:"div",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"banner-plugin",children:["Banner Plugin",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner-plugin",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Provide the ability to inject content at the top and bottom of each JS and CSS file."}),"\n",(0,r.jsxs)(n.h2,{id:"quick-start",children:["Quick Start",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"install",children:["Install",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,r.jsx)(o.SU,{command:"add @modern-js/plugin-module-banner -D"}),"\n",(0,r.jsxs)(n.h3,{id:"register",children:["Register",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"You can install the plugin with the following command:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBanner } from '@modern-js/plugin-module-banner';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: '//comment',\n css: '/*comment*/',\n },\n }),\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["Note: CSS comments do not support the ",(0,r.jsx)(n.code,{children:"//comment"})," syntax. Refer to ",(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Comments",target:"_blank",rel:"noopener noreferrer",children:'"CSS Comments"'}),"\n"]})})]}),"\n",(0,r.jsxs)(n.h2,{id:"example",children:["Example",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"add-copyright-information-at-the-top-of-a-js-file",children:["Add copyright information at the top of a JS file",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-copyright-information-at-the-top-of-a-js-file",children:"#"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { modulePluginBanner } from '@modern-js/plugin-module-banner';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: copyRight,\n },\n }),\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"configuration",children:["Configuration",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configuration",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"Type"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type BannerOptions = {\n banner: {\n js?: string;\n css?: string;\n };\n footer?: {\n js?: string;\n css?: string;\n };\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"banner",children:["banner",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Add content at the top."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"banner.js"}),": Add content at the top of a JS file."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"banner.css"}),": Add content at the top of a CSS file."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"footer",children:["footer",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Add content at the bottom."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"footer.js"}),": Add content at the bottom of a JS file."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"footer.css"}),": Add content at the bottom of a CSS file."]}),"\n"]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-banner.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Example",id:"example",depth:2},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3},{text:"Configuration",id:"configuration",depth:2},{text:"banner",id:"banner",depth:3},{text:"footer",id:"footer",depth:3}],title:"Banner Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8506.886cd5ae.js b/modern-js/module-tools/static/js/async/8506.886cd5ae.js deleted file mode 100644 index 6f68307816..0000000000 --- a/modern-js/module-tools/static/js/async/8506.886cd5ae.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 8506.886cd5ae.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8506"],{76141:function(e,n,i){"use strict";i.r(n);var d=i("39980"),l=i("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",code:"code",pre:"pre",strong:"strong",ul:"ul",li:"li",ol:"ol",em:"em"},(0,l.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",children:["\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",children:"#"})]}),"\n",(0,d.jsxs)(n.h2,{id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",children:["\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["\u5F53\u4F60\u5728\u521D\u59CB\u5316\u7684\u9879\u76EE\u91CC\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"modern build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0CModern.js Module \u4F1A\u6839\u636E\u5F53\u524D\u914D\u7F6E\u5185\u5BB9\uFF0C\u751F\u6210\u76F8\u5E94\u7684\u6784\u5EFA\u4EA7\u7269\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u6A21\u677F\u521B\u5EFA\u7684\u9ED8\u8BA4\u914D\u7F6E\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n // \u6CE8\u518C Modern.js Module \u7684 CLI \u5DE5\u5177\n plugins: [moduleTools()],\n // \u6307\u5B9A\u6784\u5EFA\u9884\u8BBE\u914D\u7F6E\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.strong,{children:"\u9ED8\u8BA4\u751F\u6210\u4EA7\u7269\u5177\u6709\u4EE5\u4E0B\u7279\u70B9"}),"\uFF1A"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4F1A\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://nodejs.org/api/modules.html#modules-commonjs-modules",target:"_blank",rel:"noopener noreferrer",children:"CommonJS"})," \u548C ",(0,d.jsx)(n.a,{href:"https://nodejs.org/api/esm.html#modules-ecmascript-modules",target:"_blank",rel:"noopener noreferrer",children:"ESM"})," \u4E24\u4EFD\u4EA7\u7269\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EE3\u7801\u8BED\u6CD5\u652F\u6301\u5230 ",(0,d.jsx)(n.code,{children:"ES6"})," ,\u66F4\u9AD8\u7EA7\u7684\u8BED\u6CD5\u5C06\u4F1A\u88AB\u8F6C\u6362\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6240\u6709\u7684\u4EE3\u7801\u7ECF\u8FC7\u6253\u5305\u53D8\u6210\u4E86\u4E00\u4E2A\u6587\u4EF6\uFF0C\u5373\u8FDB\u884C\u4E86 ",(0,d.jsx)(n.strong,{children:"bundle"})," \u5904\u7406\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u8F93\u51FA\u6839\u76EE\u5F55\u4E3A\u9879\u76EE\u4E0B\u7684 ",(0,d.jsx)(n.code,{children:"dist"})," \u76EE\u5F55\uFF0C\u7C7B\u578B\u6587\u4EF6\u8F93\u51FA\u7684\u76EE\u5F55\u4E3A ",(0,d.jsx)(n.code,{children:"dist/types"}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"\u770B\u5230\u8FD9\u91CC\u4F60\u53EF\u80FD\u4F1A\u6709\u4EE5\u4E0B\u7591\u95EE\uFF1A"}),"\n",(0,d.jsxs)(n.ol,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"buildPreset"})," \u662F\u4EC0\u4E48\uFF1F"]}),"\n",(0,d.jsx)(n.li,{children:"\u4EA7\u7269\u7684\u8FD9\u4E9B\u7279\u70B9\u662F\u7531\u4EC0\u4E48\u51B3\u5B9A\u7684\uFF1F"}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u9996\u5148\u6765\u4E86\u89E3\u4E00\u4E0B ",(0,d.jsx)(n.code,{children:"buildPreset"}),"\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"\u6784\u5EFA\u9884\u8BBE",children:["\u6784\u5EFA\u9884\u8BBE",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u9884\u8BBE",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"buildPreset"})," \u4EE3\u8868\u7740\u63D0\u524D\u51C6\u5907\u597D\u7684\u4E00\u7EC4\u6216\u8005\u591A\u7EC4\u6784\u5EFA\u76F8\u5173\u7684\u914D\u7F6E\uFF0C\u53EA\u9700\u8981\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u5BF9\u5E94\u7684\u9884\u8BBE\u503C\uFF0C\u5C31\u53EF\u4EE5\u7701\u53BB\u9EBB\u70E6\u4E14\u590D\u6742\u7684\u914D\u7F6E\u5DE5\u4F5C\uFF0C\u5F97\u5230\u7B26\u5408\u9884\u671F\u7684\u4EA7\u7269\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"Modern.js Module \u4E3B\u8981\u5185\u7F6E\u4E86\u4E24\u5957\u6784\u5EFA\u9884\u8BBE,\u5305\u62EC:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"npm-component"}),": \u7528\u4E8E\u6784\u5EFA\u7EC4\u4EF6\u5E93\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"npm-library"}),": \u7528\u4E8E\u6253\u5305\u5176\u4ED6\u5E93\u7C7B\u578B\u7684\u9879\u76EE,\u5982\u5DE5\u5177\u5E93\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u540C\u65F6\uFF0C\u8FD8\u63D0\u4F9B\u4E00\u4E9B\u53D8\u4F53\uFF0C\u4F8B\u5982 ",(0,d.jsx)(n.code,{children:"npm-library-with-umd"})," \u548C ",(0,d.jsx)(n.code,{children:"npm-library-es5"}),"\uFF0C\u987E\u540D\u601D\u4E49\uFF0C\u5206\u522B\u5BF9\u5E94\u5E26\u6709 umd \u4EA7\u7269\u548C\u652F\u6301\u5230 es5 \u8BED\u6CD5\u7684\u5E93\u9884\u8BBE\u3002\n\u8BE6\u7EC6\u914D\u7F6E\u53EF\u4EE5\u67E5\u770B\u5176",(0,d.jsx)(n.a,{href:"/api/config/build-preset",children:"API"}),"\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u9664\u6B64\u4E4B\u5916,\u6211\u4EEC\u4E5F\u53EF\u4EE5\u5B8C\u5168\u81EA\u5B9A\u4E49\u6784\u5EFA\u914D\u7F6E:"}),"\n",(0,d.jsxs)(n.h2,{id:"\u6784\u5EFA\u914D\u7F6E",children:["\u6784\u5EFA\u914D\u7F6E",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u914D\u7F6E",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsxs)(n.strong,{children:[(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879"]}),"\u3002\u5728\u6700\u5F00\u59CB\u63D0\u5230\u7684\u5173\u4E8E\u201C",(0,d.jsx)(n.em,{children:"\u6784\u5EFA\u4EA7\u7269\u7684\u7279\u70B9"}),"\u201D\uFF0C\u5176\u5B9E\u90FD\u662F ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u6240\u652F\u6301\u7684\u5C5E\u6027\u3002\u76EE\u524D\u6240\u652F\u6301\u7684\u5C5E\u6027\u8986\u76D6\u4E86\u5927\u90E8\u5206\u6A21\u5757\u7C7B\u578B\u9879\u76EE\u5728\u6784\u5EFA\u4EA7\u7269\u65F6\u7684\u9700\u6C42\uFF0C",(0,d.jsx)(n.code,{children:"buildConfig"})," \u4E0D\u4EC5\u5305\u542B\u4E00\u4E9B\u4EA7\u7269\u6240\u5177\u5907\u7684\u5C5E\u6027\uFF0C\u4E5F\u5305\u542B\u4E86\u6784\u5EFA\u4EA7\u7269\u6240\u9700\u8981\u7684\u4E00\u4E9B\u7279\u6027\u529F\u80FD\u3002\u63A5\u4E0B\u6765\u4ECE\u5206\u7C7B\u7684\u89D2\u5EA6\u7B80\u5355\u7F57\u5217\u4E00\u4E0B\uFF1A"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u6784\u5EFA\u4EA7\u7269\u7684\u57FA\u672C\u5C5E\u6027\u5305\u62EC\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u662F\u5426\u88AB\u6253\u5305\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#buildtype",children:(0,d.jsx)(n.code,{children:"buildConfig.buildType"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u5BF9\u4E8E\u8BED\u6CD5\u7684\u652F\u6301\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#target",children:(0,d.jsx)(n.code,{children:"buildConfig.target"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u683C\u5F0F\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#format",children:(0,d.jsx)(n.code,{children:"buildConfig.format"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u7C7B\u578B\u6587\u4EF6\u5982\u4F55\u5904\u7406\uFF0C\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#dts",children:(0,d.jsx)(n.code,{children:"buildConfig.dts"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u7684 sourceMap \u5982\u4F55\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#sourcemap",children:(0,d.jsx)(n.code,{children:"buildConfig.sourceMap"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u5BF9\u5E94\u7684\u8F93\u5165\uFF08\u6216\u8005\u662F\u6E90\u6587\u4EF6\uFF09\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#input",children:(0,d.jsx)(n.code,{children:"buildConfig.input"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u8F93\u51FA\u7684\u76EE\u5F55\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#outdir",children:(0,d.jsx)(n.code,{children:"buildConfig.outDir"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,d.jsx)(n.code,{children:"buildConfig.sourceDir"})}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u6784\u5EFA\u4EA7\u7269\u6240\u9700\u7684\u5E38\u7528\u529F\u80FD\u5305\u62EC\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u522B\u540D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#alias",children:(0,d.jsx)(n.code,{children:"buildConfig.alias"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u9759\u6001\u8D44\u6E90\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#asset",children:(0,d.jsx)(n.code,{children:"buildConfig.asset"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406\uFF1A\u5BF9\u5E94\u7684 API \u6709\uFF1A","\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,d.jsx)(n.code,{children:"buildConfig.autoExternal"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,d.jsx)(n.code,{children:"buildConfig.externals"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(n.li,{children:["\u62F7\u8D1D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#copy",children:(0,d.jsx)(n.code,{children:"buildConfig.copy"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u5168\u5C40\u53D8\u91CF\u66FF\u6362\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#define",children:(0,d.jsx)(n.code,{children:"buildConfig.define"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A ",(0,d.jsx)(n.a,{href:"https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"JSX"})," \u7F16\u8BD1\u65B9\u5F0F\uFF0C\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#jsx",children:(0,d.jsx)(n.code,{children:"buildConfig.jsx"})}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"\u4E00\u4E9B\u9AD8\u7EA7\u5C5E\u6027\u6216\u8005\u4F7F\u7528\u9891\u7387\u4E0D\u9AD8\u7684\u529F\u80FD\uFF1A"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u4EA7\u7269\u4EE3\u7801\u538B\u7F29\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#minify",children:(0,d.jsx)(n.code,{children:"buildConfig.minify"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u4EE3\u7801\u5206\u5272\uFF1A",(0,d.jsx)(n.a,{href:"/api/config/build-config#splitting",children:(0,d.jsx)(n.code,{children:"buildConfig.spitting"})})]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A\u6784\u5EFA\u4EA7\u7269\u7528\u4E8E NodeJS \u73AF\u5883\u8FD8\u662F\u6D4F\u89C8\u5668\u73AF\u5883\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#platform",children:(0,d.jsx)(n.code,{children:"buildConfig.platform"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["umd \u4EA7\u7269\u76F8\u5173\uFF1A","\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A umd \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#umdglobals",children:(0,d.jsx)(n.code,{children:"buildConfig.umdGlobals"})}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:["\u6307\u5B9A umd \u4EA7\u7269\u7684\u6A21\u5757\u540D\uFF1A\u5BF9\u5E94\u7684 API \u662F ",(0,d.jsx)(n.a,{href:"/api/config/build-config#umdmodulename",children:(0,d.jsx)(n.code,{children:"buildConfig.umdModuleName"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"\u9664\u4E86\u4EE5\u4E0A\u5206\u7C7B\u4EE5\u5916\uFF0C\u5173\u4E8E\u8FD9\u4E9B API \u7684\u5E38\u89C1\u95EE\u9898\u548C\u6700\u4F73\u5B9E\u8DF5\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u94FE\u63A5\u6765\u4E86\u89E3\uFF1A"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:(0,d.jsxs)(n.a,{href:"/guide/advance/in-depth-about-build#bundle--bundleless",children:["\u5173\u4E8E ",(0,d.jsx)(n.code,{children:"bundle"})," \u548C ",(0,d.jsx)(n.code,{children:"bundleless"})]})}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsxs)(n.a,{href:"/guide/advance/in-depth-about-build#input--sourcedir",children:["\u5173\u4E8E ",(0,d.jsx)(n.code,{children:"input"})," \u548C ",(0,d.jsx)(n.code,{children:"sourceDir"})]}),"\u3002"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#dts",children:"\u5173\u4E8E\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6"}),"\u3002"]}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#define",children:"\u5982\u4F55\u4F7F\u7528 define"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/external-dependency",children:"\u5982\u4F55\u5904\u7406\u7B2C\u4E09\u65B9\u4F9D\u8D56"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/copy",children:"\u5982\u4F55\u4F7F\u7528\u62F7\u8D1D"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/build-umd",children:"\u5982\u4F55\u6784\u5EFA umd \u4EA7\u7269"})}),"\n",(0,d.jsx)(n.li,{children:(0,d.jsx)(n.a,{href:"/guide/advance/asset",children:"\u5982\u4F55\u4F7F\u7528\u9759\u6001\u8D44\u6E90"})}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",children:["\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",children:"#"})]}),"\n",(0,d.jsxs)(n.p,{children:["\u4E86\u89E3 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u548C ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u540E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5C06\u4E8C\u8005\u8FDB\u884C\u7ED3\u5408\u4F7F\u7528\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5728\u5B9E\u9645\u9879\u76EE\u4E2D,\u6211\u4EEC\u53EF\u4EE5\u5148\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildPreset"})," \u6765\u5FEB\u901F\u83B7\u53D6\u4E00\u5957\u9ED8\u8BA4\u6784\u5EFA\u914D\u7F6E\u3002\u5982\u679C\u9700\u8981\u81EA\u5B9A\u4E49,\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u8FDB\u884C\u8986\u76D6\u548C\u6269\u5C55\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u6269\u5C55\u7684\u903B\u8F91\u5982\u4E0B:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u5F53 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u6570\u7EC4\u65F6\uFF0C\u4F1A\u5728\u539F\u6765\u7684\u9884\u8BBE\u57FA\u7840\u4E0A\u6DFB\u52A0\u65B0\u7684\u914D\u7F6E\u9879\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: [\n {\n format: 'iife',\n target: 'es2020',\n outDir: './dist/global'\n }\n ]\n});\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u8FD9\u4F1A\u5728\u539F\u672C\u9884\u8BBE\u7684\u57FA\u7840\u4E0A\uFF0C\u989D\u5916\u751F\u6210\u4E00\u4EFD IIFE \u683C\u5F0F\u3001\u652F\u6301\u5230 ES2020 \u8BED\u6CD5\u7684\u4EA7\u7269\uFF0C\u8F93\u51FA\u76EE\u5F55\u4E3A\u9879\u76EE\u4E0B\u7684 ",(0,d.jsx)(n.code,{children:"dist/global"})," \u76EE\u5F55\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\u5F53 ",(0,d.jsx)(n.code,{children:"buildConfig"})," \u662F\u5BF9\u8C61\u65F6,\u4F1A\u5C06\u5BF9\u8C61\u4E2D\u7684\u914D\u7F6E\u9879\u8986\u76D6\u5230\u9884\u8BBE\u4E2D\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n buildConfig: {\n sourceMap: true,\n }\n});\n"})}),"\n",(0,d.jsx)(n.p,{children:"\u8FD9\u4F1A\u4F7F\u5F97\u6BCF\u4E00\u9879\u6784\u5EFA\u4EFB\u52A1\u90FD\u4F1A\u751F\u6210 sourceMap \u6587\u4EF6\u3002"})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,l.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fmodify-output-product.md"]={toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2}],title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js b/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js new file mode 100644 index 0000000000..457d4b016f --- /dev/null +++ b/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js @@ -0,0 +1,2 @@ +/*! For license information please see 8528.1ccd4f8d.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8528"],{51458:function(e,n,t){"use strict";t.r(n);var r=t("39980"),i=t("9580"),o=t("23657");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",div:"div",ul:"ul",li:"li",strong:"strong"},(0,i.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"banner-plugin",children:["Banner Plugin",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner-plugin",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Provide the ability to inject content at the top and bottom of each JS and CSS file."}),"\n",(0,r.jsxs)(n.h2,{id:"quick-start",children:["Quick Start",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"install",children:["Install",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,r.jsx)(o.SU,{command:"add @modern-js/plugin-module-banner -D"}),"\n",(0,r.jsxs)(n.h3,{id:"register",children:["Register",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"You can install the plugin with the following command:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBanner } from '@modern-js/plugin-module-banner';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: '//comment',\n css: '/*comment*/',\n },\n }),\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,r.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,r.jsx)(n.div,{className:"rspress-directive-content",children:(0,r.jsxs)(n.p,{children:["Note: CSS comments do not support the ",(0,r.jsx)(n.code,{children:"//comment"})," syntax. Refer to ",(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Comments",target:"_blank",rel:"noopener noreferrer",children:'"CSS Comments"'}),"\n"]})})]}),"\n",(0,r.jsxs)(n.h2,{id:"example",children:["Example",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#example",children:"#"})]}),"\n",(0,r.jsxs)(n.h3,{id:"add-copyright-information-at-the-top-of-a-js-file",children:["Add copyright information at the top of a JS file",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#add-copyright-information-at-the-top-of-a-js-file",children:"#"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import { modulePluginBanner } from '@modern-js/plugin-module-banner';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBanner({\n banner: {\n js: copyRight,\n },\n }),\n ],\n});\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"configuration",children:["Configuration",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configuration",children:"#"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"Type"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"type BannerOptions = {\n banner: {\n js?: string;\n css?: string;\n };\n footer?: {\n js?: string;\n css?: string;\n };\n};\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"banner",children:["banner",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Add content at the top."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"banner.js"}),": Add content at the top of a JS file."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"banner.css"}),": Add content at the top of a CSS file."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"footer",children:["footer",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"Add content at the bottom."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"footer.js"}),": Add content at the bottom of a JS file."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"footer.css"}),": Add content at the bottom of a CSS file."]}),"\n"]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-banner.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Example",id:"example",depth:2},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3},{text:"Configuration",id:"configuration",depth:2},{text:"banner",id:"banner",depth:3},{text:"footer",id:"footer",depth:3}],title:"Banner Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js.LICENSE.txt new file mode 100644 index 0000000000..0e69721496 --- /dev/null +++ b/modern-js/module-tools/static/js/async/8528.1ccd4f8d.js.LICENSE.txt @@ -0,0 +1,5 @@ +/*! react/jsx-runtime */ + +/*! @mdx-js/react */ + +/*! @theme */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7948.f52b62fa.js b/modern-js/module-tools/static/js/async/8571.1705338e.js similarity index 93% rename from modern-js/module-tools/static/js/async/7948.f52b62fa.js rename to modern-js/module-tools/static/js/async/8571.1705338e.js index 6ee8341809..11f60f280a 100644 --- a/modern-js/module-tools/static/js/async/7948.f52b62fa.js +++ b/modern-js/module-tools/static/js/async/8571.1705338e.js @@ -1,2 +1,2 @@ -/*! For license information please see 7948.f52b62fa.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7948"],{28112:function(e,t,i){"use strict";i.r(t);var n=i("39980"),o=i("9580");function s(e){let t=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,n.jsxs)(t.h1,{id:"index",children:["index",(0,n.jsx)(t.a,{className:"header-anchor","aria-hidden":"true",href:"#index",children:"#"})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,o.ah)(),e.components);return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(s,{...e})}):s(e)}t.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Findex.md"]={toc:[],title:"index",frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/en/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/en/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Jest: Delightful Testing Framework",details:"Jest integration makes it easier to test code\u3002",icon:"\uD83D\uDCD0"}]}}}}]); \ No newline at end of file +/*! For license information please see 8571.1705338e.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8571"],{48029:function(e,t,i){"use strict";i.r(t);var n=i("39980"),o=i("9580");function s(e){let t=Object.assign({h1:"h1",a:"a"},(0,o.ah)(),e.components);return(0,n.jsxs)(t.h1,{id:"index",children:["index",(0,n.jsx)(t.a,{className:"header-anchor","aria-hidden":"true",href:"#index",children:"#"})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,o.ah)(),e.components);return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(s,{...e})}):s(e)}t.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Findex.md"]={toc:[],title:"index",frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/en/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/en/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Jest: Delightful Testing Framework",details:"Jest integration makes it easier to test code\u3002",icon:"\uD83D\uDCD0"}]}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8439.74d8f520.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8571.1705338e.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8439.74d8f520.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8571.1705338e.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/8580.1a78ef5f.js b/modern-js/module-tools/static/js/async/8580.1a78ef5f.js new file mode 100644 index 0000000000..9383380e6c --- /dev/null +++ b/modern-js/module-tools/static/js/async/8580.1a78ef5f.js @@ -0,0 +1,2 @@ +/*! For license information please see 8580.1a78ef5f.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8580"],{65612:function(n,e,s){"use strict";s.r(e);var o=s("39980"),i=s("9580");function t(n){let e=Object.assign({pre:"pre",code:"code",p:"p"},(0,i.ah)(),n.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,o.jsx)(e.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"})]})}function l(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,i.ah)(),n.components);return e?(0,o.jsx)(e,{...n,children:(0,o.jsx)(t,{...n})}):t(n)}e.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fcomponents%2Fregister-esbuild-plugin.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8506.886cd5ae.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8580.1a78ef5f.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8506.886cd5ae.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8580.1a78ef5f.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/5567.90015958.js b/modern-js/module-tools/static/js/async/8612.6fdbde84.js similarity index 98% rename from modern-js/module-tools/static/js/async/5567.90015958.js rename to modern-js/module-tools/static/js/async/8612.6fdbde84.js index 84364cc40e..bb658db1cd 100644 --- a/modern-js/module-tools/static/js/async/5567.90015958.js +++ b/modern-js/module-tools/static/js/async/8612.6fdbde84.js @@ -1,2 +1,2 @@ -/*! For license information please see 5567.90015958.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5567"],{59168:function(e,n,i){"use strict";i.r(n);var o=i("39980"),t=i("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",ul:"ul",li:"li",pre:"pre",blockquote:"blockquote",h3:"h3"},(0,t.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"use-the-copy-tools",children:["Use the Copy Tools",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#use-the-copy-tools",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Modern.js Module provides the Copy utility for copying already existing individual files or entire directories into the output directory. Next we learn how to use it."}),"\n",(0,o.jsxs)(n.h2,{id:"understanding-the-copy-api",children:["Understanding the Copy API",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#understanding-the-copy-api",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["We can use the Copy tool via the ",(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copy",children:(0,o.jsx)(n.code,{children:"buildConfig.copy"})})," API, which contains the following two main configurations."]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copypatterns",children:(0,o.jsx)(n.code,{children:"patterns"})})}),"\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copyoptions",children:(0,o.jsx)(n.code,{children:"options"})})}),"\n"]}),"\n",(0,o.jsxs)(n.h2,{id:"api-description",children:["API Description",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api-description",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"copy.patterns"})," is used to find files to be copied and configure the output path."]}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.from"})," parameter is used to specify the file or directory to be copied. It accepts either a Glob pattern string or a specific path. A Glob pattern string refers to the ",(0,o.jsx)(n.a,{href:"https://github.com/mrmlnc/fast-glob#pattern-syntax",target:"_blank",rel:"noopener noreferrer",children:"fast-glob pattern syntax"}),". Therefore, we can use it in two ways as follows:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './index.html', to: '' },\n { from: './*.html', to: '' },\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.context"})," parameter is generally used in conjunction with ",(0,o.jsx)(n.code,{children:"patterns.from"}),". By default, its value is the same as ",(0,o.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,o.jsx)(n.code,{children:"buildConfig.sourceDir"})}),". Therefore, we can specify the file ",(0,o.jsx)(n.code,{children:"src/data.json"})," to be copied in the following way:"]}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsxs)(n.p,{children:["By default, ",(0,o.jsx)(n.code,{children:"buildConfig.sourceDir"})," is set to ",(0,o.jsx)(n.code,{children:"src"}),"."]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './data.json' to: ''},\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["When the specified file is not in the source code directory, you can modify the ",(0,o.jsx)(n.code,{children:"context"})," configuration. For example, to specify the file ",(0,o.jsx)(n.code,{children:"temp/index.html"})," in the project directory to be copied:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"import path from 'path';\n\nexport default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n {\n from: './index.html',\n context: path.join(__dirname, './temp')\n to: '',\n }\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.to"})," parameter is used to specify the output path for the copied files. By default, its value corresponds to ",(0,o.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"buildConfig.outDir"}),". Therefore, we can copy ",(0,o.jsx)(n.code,{children:"src/index.html"})," to the ",(0,o.jsx)(n.code,{children:"dist"})," directory as follows:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './index.html' }],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["When we configure ",(0,o.jsx)(n.code,{children:"patterns.to"}),":"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["If it is a relative path, the path will be calculated relative to ",(0,o.jsx)(n.code,{children:"buildConfig.outDir"})," to determine the absolute path for copying the files."]}),"\n",(0,o.jsx)(n.li,{children:"If it is an absolute path, the value will be used directly."}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["Finally, ",(0,o.jsx)(n.code,{children:"patterns.globOptions"})," is used to configure the ",(0,o.jsx)(n.a,{href:"https://github.com/sindresorhus/globby",target:"_blank",rel:"noopener noreferrer",children:"globby"})," object for finding files to copy. Its configuration can be referenced from:"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"https://github.com/sindresorhus/globby#options",target:"_blank",rel:"noopener noreferrer",children:"globby.options"})}),"\n"]}),"\n",(0,o.jsxs)(n.h2,{id:"examples-of-different-scenarios",children:["Examples of Different Scenarios",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#examples-of-different-scenarios",children:"#"})]}),"\n",(0,o.jsxs)(n.h3,{id:"copying-files",children:["Copying Files",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-files",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to file\n */\n {\n from: './temp-1/a.png',\n context: __dirname,\n to: './temp-1/b.png',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-files-to-a-directory",children:["Copying Files to a Directory",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-files-to-a-directory",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to dir\n */\n {\n from: './temp-2/a.png',\n context: __dirname,\n to: './temp-2',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-from-directory-to-directory",children:["Copying from Directory to Directory",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-from-directory-to-directory",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to dir\n */\n {\n from: './temp-3/',\n to: './temp-3',\n context: __dirname,\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-from-directory-to-file",children:["Copying from Directory to File",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-from-directory-to-file",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to file\n */\n {\n from: './temp-4/',\n context: __dirname,\n to: './temp-4/_index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"using-glob",children:["Using Glob",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-glob",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy glob to dir\n */\n {\n from: './*.html',\n to: './temp-5',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n {\n copy: {\n patterns: [\n /**\n * copy glob to file\n */\n {\n from: './*.html',\n to: './temp-6/index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})})]})}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(r,{...e})}):r(e)}n.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fcopy.md"]={toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2},{text:"API Description",id:"api-description",depth:2},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2},{text:"Copying Files",id:"copying-files",depth:3},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3},{text:"Using Glob",id:"using-glob",depth:3}],title:"Use the Copy Tools",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 8612.6fdbde84.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8612"],{19959:function(e,n,i){"use strict";i.r(n);var o=i("39980"),t=i("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",ul:"ul",li:"li",pre:"pre",blockquote:"blockquote",h3:"h3"},(0,t.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.h1,{id:"use-the-copy-tools",children:["Use the Copy Tools",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#use-the-copy-tools",children:"#"})]}),"\n",(0,o.jsx)(n.p,{children:"Modern.js Module provides the Copy utility for copying already existing individual files or entire directories into the output directory. Next we learn how to use it."}),"\n",(0,o.jsxs)(n.h2,{id:"understanding-the-copy-api",children:["Understanding the Copy API",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#understanding-the-copy-api",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:["We can use the Copy tool via the ",(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copy",children:(0,o.jsx)(n.code,{children:"buildConfig.copy"})})," API, which contains the following two main configurations."]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copypatterns",children:(0,o.jsx)(n.code,{children:"patterns"})})}),"\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"/en/api/config/build-config#copyoptions",children:(0,o.jsx)(n.code,{children:"options"})})}),"\n"]}),"\n",(0,o.jsxs)(n.h2,{id:"api-description",children:["API Description",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api-description",children:"#"})]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"copy.patterns"})," is used to find files to be copied and configure the output path."]}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.from"})," parameter is used to specify the file or directory to be copied. It accepts either a Glob pattern string or a specific path. A Glob pattern string refers to the ",(0,o.jsx)(n.a,{href:"https://github.com/mrmlnc/fast-glob#pattern-syntax",target:"_blank",rel:"noopener noreferrer",children:"fast-glob pattern syntax"}),". Therefore, we can use it in two ways as follows:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './index.html', to: '' },\n { from: './*.html', to: '' },\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.context"})," parameter is generally used in conjunction with ",(0,o.jsx)(n.code,{children:"patterns.from"}),". By default, its value is the same as ",(0,o.jsx)(n.a,{href:"/api/config/build-config#sourcedir",children:(0,o.jsx)(n.code,{children:"buildConfig.sourceDir"})}),". Therefore, we can specify the file ",(0,o.jsx)(n.code,{children:"src/data.json"})," to be copied in the following way:"]}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsxs)(n.p,{children:["By default, ",(0,o.jsx)(n.code,{children:"buildConfig.sourceDir"})," is set to ",(0,o.jsx)(n.code,{children:"src"}),"."]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './data.json' to: ''},\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["When the specified file is not in the source code directory, you can modify the ",(0,o.jsx)(n.code,{children:"context"})," configuration. For example, to specify the file ",(0,o.jsx)(n.code,{children:"temp/index.html"})," in the project directory to be copied:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"import path from 'path';\n\nexport default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n {\n from: './index.html',\n context: path.join(__dirname, './temp')\n to: '',\n }\n ],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["The ",(0,o.jsx)(n.code,{children:"patterns.to"})," parameter is used to specify the output path for the copied files. By default, its value corresponds to ",(0,o.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"buildConfig.outDir"}),". Therefore, we can copy ",(0,o.jsx)(n.code,{children:"src/index.html"})," to the ",(0,o.jsx)(n.code,{children:"dist"})," directory as follows:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './index.html' }],\n },\n },\n});\n"})}),"\n",(0,o.jsxs)(n.p,{children:["When we configure ",(0,o.jsx)(n.code,{children:"patterns.to"}),":"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["If it is a relative path, the path will be calculated relative to ",(0,o.jsx)(n.code,{children:"buildConfig.outDir"})," to determine the absolute path for copying the files."]}),"\n",(0,o.jsx)(n.li,{children:"If it is an absolute path, the value will be used directly."}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["Finally, ",(0,o.jsx)(n.code,{children:"patterns.globOptions"})," is used to configure the ",(0,o.jsx)(n.a,{href:"https://github.com/sindresorhus/globby",target:"_blank",rel:"noopener noreferrer",children:"globby"})," object for finding files to copy. Its configuration can be referenced from:"]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"https://github.com/sindresorhus/globby#options",target:"_blank",rel:"noopener noreferrer",children:"globby.options"})}),"\n"]}),"\n",(0,o.jsxs)(n.h2,{id:"examples-of-different-scenarios",children:["Examples of Different Scenarios",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#examples-of-different-scenarios",children:"#"})]}),"\n",(0,o.jsxs)(n.h3,{id:"copying-files",children:["Copying Files",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-files",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to file\n */\n {\n from: './temp-1/a.png',\n context: __dirname,\n to: './temp-1/b.png',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-files-to-a-directory",children:["Copying Files to a Directory",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-files-to-a-directory",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to dir\n */\n {\n from: './temp-2/a.png',\n context: __dirname,\n to: './temp-2',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-from-directory-to-directory",children:["Copying from Directory to Directory",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-from-directory-to-directory",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to dir\n */\n {\n from: './temp-3/',\n to: './temp-3',\n context: __dirname,\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"copying-from-directory-to-file",children:["Copying from Directory to File",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copying-from-directory-to-file",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to file\n */\n {\n from: './temp-4/',\n context: __dirname,\n to: './temp-4/_index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,o.jsxs)(n.h3,{id:"using-glob",children:["Using Glob",(0,o.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#using-glob",children:"#"})]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy glob to dir\n */\n {\n from: './*.html',\n to: './temp-5',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n {\n copy: {\n patterns: [\n /**\n * copy glob to file\n */\n {\n from: './*.html',\n to: './temp-6/index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})})]})}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,t.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(r,{...e})}):r(e)}n.default=s,s.__RSPRESS_PAGE_META={},s.__RSPRESS_PAGE_META["en%2Fguide%2Fadvance%2Fcopy.md"]={toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2},{text:"API Description",id:"api-description",depth:2},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2},{text:"Copying Files",id:"copying-files",depth:3},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3},{text:"Using Glob",id:"using-glob",depth:3}],title:"Use the Copy Tools",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8738.736ed031.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8612.6fdbde84.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8738.736ed031.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8612.6fdbde84.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/865.6bb1555b.js b/modern-js/module-tools/static/js/async/865.6bb1555b.js deleted file mode 100644 index 8b4d58d914..0000000000 --- a/modern-js/module-tools/static/js/async/865.6bb1555b.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 865.6bb1555b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["865"],{96948:function(e,n,r){"use strict";r.r(n);var l=r("39980"),s=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",h2:"h2",h3:"h3",pre:"pre",blockquote:"blockquote"},(0,s.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"plugin-hooks",children:["Plugin Hooks",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#plugin-hooks",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u5173\u4E8E Modern.js Module \u652F\u6301\u7684\u751F\u547D\u5468\u671F\u94A9\u5B50\u3002"}),"\n",(0,l.jsx)(n.p,{children:"\u76EE\u524D\u4E3B\u8981\u5305\u542B\u4EE5\u4E0B\u51E0\u7C7B\u751F\u547D\u5468\u671F\u94A9\u5B50\uFF1A"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"\u914D\u7F6E\u94A9\u5B50\uFF1A\u7528\u4E8E\u5904\u7406\u7528\u6237\u914D\u7F6E\u3002"}),"\n",(0,l.jsxs)(n.li,{children:["\u6784\u5EFA\u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u6784\u5EFA\u6E90\u7801\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"buildPlatform"})," \u94A9\u5B50\uFF1A\u4EC5\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u751F\u6210\u5176\u4ED6\u6784\u5EFA\u4EA7\u7269\u65F6\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:["\u8C03\u8BD5\u94A9\u5B50\uFF1A\u8FD0\u884C ",(0,l.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u65F6\u4F1A\u89E6\u53D1\u7684\u94A9\u5B50\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.p,{children:["\u8FD9\u91CC\u8BE6\u7EC6\u89E3\u91CA\u4E86 ",(0,l.jsx)(n.a,{href:"https://modernjs.dev/guides/topic-detail/framework-plugin/hook.html",target:"_blank",rel:"noopener noreferrer",children:"Hook \u6A21\u578B"})]}),"\n",(0,l.jsxs)(n.h2,{id:"\u914D\u7F6E\u94A9\u5B50",children:["\u914D\u7F6E\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"resolvemoduleuserconfig",children:[(0,l.jsx)(n.code,{children:"resolveModuleUserConfig"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemoduleuserconfig",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u7528\u4E8E\u4FEE\u6539\u7528\u6237\u914D\u7F6E\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n resolveModuleUserConfig(config: ModuleUserConfig): ModuleUserConfig {},\n };\n },\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u6784\u5EFA\u94A9\u5B50",children:["\u6784\u5EFA\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u6309\u7167\u987A\u5E8F\u89E6\u53D1\u4EE5\u4E0B Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuild"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuildTask"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuildTask"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuild"})}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuild",children:[(0,l.jsx)(n.code,{children:"beforeBuild"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuild",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6267\u884C\u6574\u4F53\u6784\u5EFA\u6D41\u7A0B\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuild(options: Options): void {},\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"type Options = {\n options: { config: BaseBuildConfig[]; cliOptions: BuildCommandOptions };\n};\n\nexport interface BuildCommandOptions {\n config: string;\n clear?: boolean;\n dts?: boolean;\n platform?: boolean | string[];\n tsconfig: string;\n watch?: boolean;\n}\n"})}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"BuildConfig"})," \u7C7B\u578B\u53C2\u8003 ",(0,l.jsx)(n.a,{href:"/api/",children:"API \u914D\u7F6E"})]}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuildtask",children:[(0,l.jsx)(n.code,{children:"beforeBuildTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildtask",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6839\u636E\u6784\u5EFA\u914D\u7F6E\uFF0CModern.js Module \u4F1A\u5C06\u6574\u4F53\u6784\u5EFA\u5206\u6210\u591A\u4E2A\u5B50\u6784\u5EFA\u4EFB\u52A1\u3002\u8BE5 Hook \u5C06\u4F1A\u5728\u6BCF\u4E00\u4E2A\u6784\u5EFA\u5B50\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"AsyncWaterfall"})]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildTask(config: BaseBuildConfig): BaseBuildConfig {\n return config;\n },\n };\n },\n});\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuildtask",children:[(0,l.jsx)(n.code,{children:"afterBuildTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildtask",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"}),"\uFF0C\u6BCF\u4E00\u4E2A\u6784\u5EFA\u5B50\u4EFB\u52A1\u7ED3\u675F\u4E4B\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildTask(options: BuildTaskResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u548C\u8FD4\u56DE\u503C\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildTaskResult {\n status: 'success' | 'fail';\n message?: string;\n config: BaseBuildConfig;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuild",children:[(0,l.jsx)(n.code,{children:"afterBuild"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuild",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u7C7B\u578B\uFF1A",(0,l.jsx)(n.code,{children:"ParallelWorkflow"}),"\uFF0C\u6574\u4F53\u6784\u5EFA\u6D41\u7A0B\u7ED3\u675F\u4E4B\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuild(options: BuildResult): void {\n // ...\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u53C2\u6570\u548C\u8FD4\u56DE\u503C\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildResult {\n status: 'success' | 'fail';\n message?: string;\n config: BuildConfig;\n commandOptions: BuildCommandOptions;\n totalDuration: number;\n}\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"buildplatform-\u94A9\u5B50",children:["buildPlatform \u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform-\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["module-tools \u8FD8\u63D0\u4F9B\u4E86 ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u6765\u6267\u884C\u7279\u5B9A\u7684\u6784\u5EFA\u4EFB\u52A1\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u4F8B\u5982\u5728\u5B89\u88C5\u4E86 Doc \u63D2\u4EF6\u540E\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u6216\u8005 ",(0,l.jsx)(n.code,{children:"build --platform doc"})," \u6765\u6267\u884C doc \u7684\u6784\u5EFA\u4EFB\u52A1\u3002\u56E0\u4E3A doc \u63D2\u4EF6\u57FA\u4E8E buildPlatform Hooks \u5B9E\u73B0\u4E86\u8BE5\u529F\u80FD\u3002"]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u540E\u4F1A\u6309\u7167\u4EE5\u4E0B\u987A\u5E8F\u89E6\u53D1 Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"registerBuildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"beforeBuildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"buildPlatform"})}),"\n",(0,l.jsx)(n.li,{children:(0,l.jsx)(n.code,{children:"afterBuildPlatform"})}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"registerbuildplatform",children:[(0,l.jsx)(n.code,{children:"registerBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerbuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u83B7\u53D6\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u65F6\u5019\u9700\u8981\u8FD0\u884C\u7684\u4EFB\u52A1\u4FE1\u606F\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerBuildPlatform(): RegisterBuildPlatformResult {\n // ...\n return {\n platform: 'doc',\n build() {\n // logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // \u5F53\u524D\u8FD0\u884C\u7684 platform \u6784\u5EFA\u4EFB\u52A1\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforebuildplatform",children:[(0,l.jsx)(n.code,{children:"beforeBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforebuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"beforeBuildPlatform"})," \u4F1A\u5728\u6267\u884C\u6574\u4F53\u7684\u6784\u5EFA\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeBuildPlatform(platforms: RegisterBuildPlatformResult[]): void {\n console.info(`have ${platforms.length} platform tasks`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface RegisterBuildPlatformResult {\n platform: string | string[];\n build: (\n currentPlatform: string, // \u5F53\u524D\u8FD0\u884C\u7684 platform \u6784\u5EFA\u4EFB\u52A1\n context: { isTsProject: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"buildplatform",children:[(0,l.jsx)(n.code,{children:"buildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"buildPlatform"})," \u4F1A\u5728\u6BCF\u4E2A\u6784\u5EFA\u4EFB\u52A1\u6267\u884C\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n buildPlatform({ platform }: Options): void {\n console.info(`current task is ${platform}`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface Options {\n platform: string;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterbuildplatform",children:[(0,l.jsx)(n.code,{children:"afterBuildPlatform"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterbuildplatform",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,l.jsx)(n.code,{children:"build --platform"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u89E6\u53D1\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6784\u5EFA\u4EFB\u52A1\u3002",(0,l.jsx)(n.code,{children:"afterBuildPlatform"})," \u4F1A\u5728\u6574\u4F53 platform \u6784\u5EFA\u4EFB\u52A1\u7ED3\u675F\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterBuildPlatform(result: BuildPlatformResult): void {\n if (result.status === 'success') {\n console.info(`all platform build task success`);\n } else {\n console.error(result.message);\n }\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface BuildPlatformResult {\n status: 'success' | 'fail';\n message: string | Error | null;\n}\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"\u8C03\u8BD5\u94A9\u5B50",children:["\u8C03\u8BD5\u94A9\u5B50",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8C03\u8BD5\u94A9\u5B50",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,l.jsx)(n.code,{children:"dev"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u4F1A\u6309\u7167\u987A\u5E8F\u89E6\u53D1\u4EE5\u4E0B Hooks\uFF1A"]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"registerDev"}),": \u5728\u83B7\u53D6\u8C03\u8BD5\u529F\u80FD\u4FE1\u606F\u7684\u65F6\u5019\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDev"}),": \u5F00\u59CB\u6267\u884C\u8C03\u8BD5\u6574\u4F53\u6D41\u7A0B\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDevMenu"}),": \u51FA\u73B0\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"afterDevMenu"}),": \u9009\u62E9\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u9009\u9879\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"beforeDevTask"}),": \u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"]}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"afterDev"}),": \u6267\u884C dev \u6574\u4F53\u6D41\u7A0B\u6700\u540E\u89E6\u53D1\u3002"]}),"\n"]}),"\n",(0,l.jsxs)(n.h3,{id:"registerdev",children:[(0,l.jsx)(n.code,{children:"registerDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#registerdev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6CE8\u518C\u8C03\u8BD5\u5DE5\u5177\u76F8\u5173\u7684\u6570\u636E\u3002\u4E3B\u8981\u5305\u542B\uFF1A"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsx)(n.li,{children:"\u8C03\u8BD5\u5DE5\u5177\u7684\u540D\u79F0"}),"\n",(0,l.jsx)(n.li,{children:"\u663E\u793A\u5728\u83DC\u5355\u5217\u8868\u4E2D\u7684\u9879\u76EE\u540D\u79F0\u4EE5\u53CA\u5BF9\u5E94\u7684\u503C\u3002"}),"\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.code,{children:"dev"})," \u5B50\u547D\u4EE4\u7684\u5B9A\u4E49\u3002"]}),"\n",(0,l.jsx)(n.li,{children:"\u662F\u5426\u5728\u8FD0\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u6267\u884C\u6E90\u7801\u6784\u5EFA"}),"\n",(0,l.jsx)(n.li,{children:"\u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u7684\u51FD\u6570\u3002"}),"\n"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n registerDev() {\n return {\n // \u8C03\u8BD5\u5DE5\u5177\u540D\u79F0\n name: 'storybook',\n // \u83DC\u5355\u663E\u793A\u5185\u5BB9\n menuItem: {\n name: 'Storybook',\n value: 'storybook',\n },\n // \u5B9A\u4E49\u7684 dev \u5B50\u547D\u4EE4\n subCommands: ['storybook', 'story'],\n async action() {\n // dev logic\n },\n };\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforedev",children:[(0,l.jsx)(n.code,{children:"beforeDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728\u6536\u96C6\u5B8C\u6240\u6709\u8C03\u8BD5\u5DE5\u5177\u5143\u6570\u636E\u540E\uFF0C\u6267\u884C dev \u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDev(metas: DevToolData[]) {\n console.info(`have ${metas.length} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforeafterdevmenu",children:[(0,l.jsx)(n.code,{children:"(before|after)DevMenu"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforeafterdevmenu",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"beforeDevMenu"})," \u5728\u51FA\u73B0\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u4E4B\u524D\u89E6\u53D1\u3002\u63A5\u6536 ",(0,l.jsx)(n.a,{href:"https://github.com/SBoudrias/Inquirer.js#question",target:"_blank",rel:"noopener noreferrer",children:"inquirer question"})," \u4F5C\u4E3A\u53C2\u6570\u3002\u9ED8\u8BA4\u503C\u4E3A\uFF1A"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"const question = [\n {\n name: 'choiceDevTool',\n message: '\u9009\u62E9\u8C03\u8BD5\u5DE5\u5177',\n type: 'list',\n // \u6CE8\u518C\u7684\u8C03\u8BD5\u4FE1\u606F\n choices,\n },\n];\n"})}),"\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"afterDevMenu"})," \u9009\u62E9\u8C03\u8BD5\u5217\u8868/\u83DC\u5355\u9009\u9879\u540E\u89E6\u53D1\u3002"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevMenu(questions) {\n questions[0].message += '!';\n return questions; // required\n },\n afterDevMenu(options: Options) {\n console.info(`choise ${options.result.choiceDevTool} dev tools`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export type { QuestionCollection } from 'inquirer';\n\nexport interface Options {\n result: PromptResult;\n devTools: DevToolData[];\n}\n\nexport type PromptResult = { choiceDevTool: string };\nexport interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"beforedevtask",children:[(0,l.jsx)(n.code,{children:"beforeDevTask"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#beforedevtask",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u6267\u884C\u8C03\u8BD5\u4EFB\u52A1\u4E4B\u524D\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n beforeDevTask(currentDevData: DevToolData) {\n console.info(`${currentDevData.name} running`);\n },\n };\n },\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"\u5165\u53C2\u548C\u8FD4\u56DE\u7684\u53C2\u6570\u7C7B\u578B\uFF1A"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export interface DevToolData {\n name: string;\n subCommands?: string[];\n menuItem?: {\n name: string;\n value: string;\n };\n action: (\n options: { port?: string },\n context: { isTsProject?: boolean },\n ) => void | Promise;\n}\n"})}),"\n",(0,l.jsxs)(n.h3,{id:"afterdev",children:[(0,l.jsx)(n.code,{children:"afterDev"}),(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#afterdev",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"\u5728\u4E2D\u65AD\u8C03\u8BD5\u4EFB\u52A1\u8FDB\u7A0B\u65F6\u89E6\u53D1\u3002"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"export const myPlugin = (): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n return {\n afterDev() {\n console.info(`exit!`);\n },\n };\n },\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(i,{...e})}):i(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fapi%2Fplugin-api%2Fplugin-hooks.md"]={toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2},{text:"`beforeBuild`",id:"beforebuild",depth:3},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3},{text:"`afterBuild`",id:"afterbuild",depth:3},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3},{text:"`buildPlatform`",id:"buildplatform",depth:3},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2},{text:"`registerDev`",id:"registerdev",depth:3},{text:"`beforeDev`",id:"beforedev",depth:3},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3},{text:"`beforeDevTask`",id:"beforedevtask",depth:3},{text:"`afterDev`",id:"afterdev",depth:3}],title:"Plugin Hooks",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3293.8c6de277.js b/modern-js/module-tools/static/js/async/8741.507fd5f7.js similarity index 96% rename from modern-js/module-tools/static/js/async/3293.8c6de277.js rename to modern-js/module-tools/static/js/async/8741.507fd5f7.js index ae44e4f637..193ebe8fba 100644 --- a/modern-js/module-tools/static/js/async/3293.8c6de277.js +++ b/modern-js/module-tools/static/js/async/8741.507fd5f7.js @@ -1,2 +1,2 @@ -/*! For license information please see 3293.8c6de277.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3293"],{1910:function(e,n,s){"use strict";s.r(n);var l=s("39980"),o=s("9580"),i=s("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code"},(0,o.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"babel-plugin",children:["Babel Plugin",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin",children:"#"})]}),"\n",(0,l.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,l.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,l.jsx)(n.div,{className:"rspress-directive-content",children:(0,l.jsx)(n.p,{children:"Normally, we don't need to use Babel to transform our code, this plugin is only used as a downgrade."})})]}),"\n",(0,l.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"install",children:["Install",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,l.jsx)(i.SU,{command:"add @modern-js/plugin-module-babel -D"}),"\n",(0,l.jsxs)(n.h3,{id:"register",children:["Register",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"You can install the plugin with the following command:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginBabel()],\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"You can also configure the registration via hooks, for example,\nif you need to bundle two files A and B at the same time and only need to use babel when bundle A:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getBabelHook } from '@modern-js/plugin-module-babel';\n\nconst babelHook = getBabelHook({\n // babel options\n});\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n hooks: [babelHook],\n input: ['src/a.ts'],\n },\n {\n input: ['src/b.ts'],\n },\n ],\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"config",children:["Config",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["See ",(0,l.jsx)(n.a,{href:"https://babeljs.io/docs/options",target:"_blank",rel:"noopener noreferrer",children:"babel options"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["Here is an example with ",(0,l.jsx)(n.code,{children:"@babel/preset-env"})," configured"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBabel({\n presets: [['@babel/preset-env']],\n }),\n ],\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(r,{...e})}):r(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-babel.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Config",id:"config",depth:2}],title:"Babel Plugin",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 8741.507fd5f7.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8741"],{7880:function(e,n,s){"use strict";s.r(n);var l=s("39980"),o=s("9580"),i=s("23657");function r(e){let n=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code"},(0,o.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.h1,{id:"babel-plugin",children:["Babel Plugin",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#babel-plugin",children:"#"})]}),"\n",(0,l.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,l.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,l.jsx)(n.div,{className:"rspress-directive-content",children:(0,l.jsx)(n.p,{children:"Normally, we don't need to use Babel to transform our code, this plugin is only used as a downgrade."})})]}),"\n",(0,l.jsxs)(n.h2,{id:"quick-start",children:["Quick start",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,l.jsxs)(n.h3,{id:"install",children:["Install",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,l.jsx)(i.SU,{command:"add @modern-js/plugin-module-babel -D"}),"\n",(0,l.jsxs)(n.h3,{id:"register",children:["Register",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"You can install the plugin with the following command:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginBabel()],\n});\n"})}),"\n",(0,l.jsx)(n.p,{children:"You can also configure the registration via hooks, for example,\nif you need to bundle two files A and B at the same time and only need to use babel when bundle A:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { getBabelHook } from '@modern-js/plugin-module-babel';\n\nconst babelHook = getBabelHook({\n // babel options\n});\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: [\n {\n hooks: [babelHook],\n input: ['src/a.ts'],\n },\n {\n input: ['src/b.ts'],\n },\n ],\n});\n"})}),"\n",(0,l.jsxs)(n.h2,{id:"config",children:["Config",(0,l.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#config",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["See ",(0,l.jsx)(n.a,{href:"https://babeljs.io/docs/options",target:"_blank",rel:"noopener noreferrer",children:"babel options"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["Here is an example with ",(0,l.jsx)(n.code,{children:"@babel/preset-env"})," configured"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginBabel } from '@modern-js/plugin-module-babel';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginBabel({\n presets: [['@babel/preset-env']],\n }),\n ],\n});\n"})})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(r,{...e})}):r(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-babel.mdx"]={toc:[{text:"Quick start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Config",id:"config",depth:2}],title:"Babel Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/3293.8c6de277.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8741.507fd5f7.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/3293.8c6de277.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8741.507fd5f7.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3777.44838359.js b/modern-js/module-tools/static/js/async/8746.f85b2010.js similarity index 90% rename from modern-js/module-tools/static/js/async/3777.44838359.js rename to modern-js/module-tools/static/js/async/8746.f85b2010.js index 7d6c9c7c71..726f445254 100644 --- a/modern-js/module-tools/static/js/async/3777.44838359.js +++ b/modern-js/module-tools/static/js/async/8746.f85b2010.js @@ -1,2 +1,2 @@ -/*! For license information please see 3777.44838359.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3777"],{16013:function(e,n,s){"use strict";s.r(n);var i=s("39980"),l=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li"},(0,l.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"faq",children:["FAQ",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#faq",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Here is a list of all frequently asked questions about Modern.js Module."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/basic",children:"General FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/build",children:"Build FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/storybook",children:"Storybook FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/test",children:"Test FAQ"})}),"\n"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,l.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Findex.md"]={toc:[],title:"FAQ",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 8746.f85b2010.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8746"],{34378:function(e,n,s){"use strict";s.r(n);var i=s("39980"),l=s("9580");function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li"},(0,l.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"faq",children:["FAQ",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#faq",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Here is a list of all frequently asked questions about Modern.js Module."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/basic",children:"General FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/build",children:"Build FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/storybook",children:"Storybook FAQ"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/en/guide/faq/test",children:"Test FAQ"})}),"\n"]})]})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,l.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}n.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["en%2Fguide%2Ffaq%2Findex.md"]={toc:[],title:"FAQ",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8842.64147a1b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8746.f85b2010.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8842.64147a1b.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8746.f85b2010.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/8773.66b5f0c8.js b/modern-js/module-tools/static/js/async/8914.a2a0b7b9.js similarity index 98% rename from modern-js/module-tools/static/js/async/8773.66b5f0c8.js rename to modern-js/module-tools/static/js/async/8914.a2a0b7b9.js index 41a2f438be..24abcaed90 100644 --- a/modern-js/module-tools/static/js/async/8773.66b5f0c8.js +++ b/modern-js/module-tools/static/js/async/8914.a2a0b7b9.js @@ -1,2 +1,2 @@ -/*! For license information please see 8773.66b5f0c8.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8773"],{55348:function(e,n,r){"use strict";r.r(n);var i=r("39980"),o=r("9580"),s=r("23657");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"import-plugin",children:["Import Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#import-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Using ",(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," provides the same ability and configuration as ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"babel-plugin-import"})}),"."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Since ",(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," version >= 2.16.0, this plugin functionality is built into Modern.js Module and is provided by ",(0,i.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:(0,i.jsx)(n.code,{children:"transformImport"})}),".\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick Start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-import -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginImport } from '@modern-js/plugin-module-import';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'antd',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"This way we can use the ability of automatic import in Modern.js Module."}),"\n",(0,i.jsxs)(n.h2,{id:"configurations",children:["Configurations",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configurations",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n pluginImport?: ImportItem[];\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"pluginimport",children:["pluginImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pluginimport",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The elements of the array are configuration objects for ",(0,i.jsx)(n.code,{children:"babel-plugin-import"}),", which can be referred to ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Example:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n // babel-plugin-import`s options config\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"notes",children:["Notes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#notes",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC and ported from ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"}),". The configuration options remain consistent."]}),"\n",(0,i.jsxs)(n.p,{children:["Some configurations can be passed in as functions, such as ",(0,i.jsx)(n.code,{children:"customName"}),", ",(0,i.jsx)(n.code,{children:"customStyleName"}),", etc., but in Modern.js Module, we do not recommend using functions in these configuration items.\nBecause we will call SWC in the esbuild plugin, and then when Rust calls these configuration functions through Node-API, a deadlock will occur."]}),"\n",(0,i.jsxs)(n.p,{children:["Simple function logic can actually be replaced by template language. Below is an example of using a template with ",(0,i.jsx)(n.code,{children:"customName"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { MyButton as Btn } from 'foo';\n"})}),"\n",(0,i.jsx)(n.p,{children:"Add the following configuration on the right-hand side:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ member }}',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"{{ member }}"})," in it will be replaced with the corresponding import member. After transformation:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/MyButton';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Template ",(0,i.jsx)(n.code,{children:"customName: 'foo/es/{{ member }}'"})," is the same as ",(0,i.jsx)(n.code,{children:" customName: (member) => `foo/es/${member}` "}),", but template value has no performance overhead of Node-API."]}),"\n",(0,i.jsxs)(n.p,{children:["The template used here is ",(0,i.jsx)(n.a,{href:"https://handlebarsjs.com",target:"_blank",rel:"noopener noreferrer",children:"handlebars"}),". There are some useful builtin tools, Take the above import statement as an example:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ kebabCase member }}',\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"Transformed to:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/my-button';\n"})}),"\n",(0,i.jsx)(n.p,{children:"In addition to kebabCase, there are cameraCase, snakeCase, upperCase and lowerCase can be used as well."})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-import.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Configurations",id:"configurations",depth:2},{text:"pluginImport",id:"pluginimport",depth:3},{text:"Notes",id:"notes",depth:2}],title:"Import Plugin",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 8914.a2a0b7b9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8914"],{50399:function(e,n,r){"use strict";r.r(n);var i=r("39980"),o=r("9580"),s=r("23657");function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",div:"div",h2:"h2",h3:"h3",pre:"pre",ul:"ul",li:"li",strong:"strong"},(0,o.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"import-plugin",children:["Import Plugin",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#import-plugin",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Using ",(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," provides the same ability and configuration as ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"babel-plugin-import"})}),"."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["Since ",(0,i.jsx)(n.code,{children:"@modern-js/module-tools"})," version >= 2.16.0, this plugin functionality is built into Modern.js Module and is provided by ",(0,i.jsx)(n.a,{href:"/api/config/build-config#transformimport",children:(0,i.jsx)(n.code,{children:"transformImport"})}),".\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"quick-start",children:["Quick Start",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(n.h3,{id:"install",children:["Install",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-import -D"}),"\n",(0,i.jsxs)(n.h3,{id:"register",children:["Register",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginImport } from '@modern-js/plugin-module-import';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'antd',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"This way we can use the ability of automatic import in Modern.js Module."}),"\n",(0,i.jsxs)(n.h2,{id:"configurations",children:["Configurations",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#configurations",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n pluginImport?: ImportItem[];\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"pluginimport",children:["pluginImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pluginimport",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The elements of the array are configuration objects for ",(0,i.jsx)(n.code,{children:"babel-plugin-import"}),", which can be referred to ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Example:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n // babel-plugin-import`s options config\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"notes",children:["Notes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#notes",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC and ported from ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-import"}),". The configuration options remain consistent."]}),"\n",(0,i.jsxs)(n.p,{children:["Some configurations can be passed in as functions, such as ",(0,i.jsx)(n.code,{children:"customName"}),", ",(0,i.jsx)(n.code,{children:"customStyleName"}),", etc., but in Modern.js Module, we do not recommend using functions in these configuration items.\nBecause we will call SWC in the esbuild plugin, and then when Rust calls these configuration functions through Node-API, a deadlock will occur."]}),"\n",(0,i.jsxs)(n.p,{children:["Simple function logic can actually be replaced by template language. Below is an example of using a template with ",(0,i.jsx)(n.code,{children:"customName"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { MyButton as Btn } from 'foo';\n"})}),"\n",(0,i.jsx)(n.p,{children:"Add the following configuration on the right-hand side:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ member }}',\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"{{ member }}"})," in it will be replaced with the corresponding import member. After transformation:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/MyButton';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Template ",(0,i.jsx)(n.code,{children:"customName: 'foo/es/{{ member }}'"})," is the same as ",(0,i.jsx)(n.code,{children:" customName: (member) => `foo/es/${member}` "}),", but template value has no performance overhead of Node-API."]}),"\n",(0,i.jsxs)(n.p,{children:["The template used here is ",(0,i.jsx)(n.a,{href:"https://handlebarsjs.com",target:"_blank",rel:"noopener noreferrer",children:"handlebars"}),". There are some useful builtin tools, Take the above import statement as an example:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { modulePluginImport } from '@modern-js/plugin-module-import';\nimport { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginImport({\n pluginImport: [\n {\n libraryName: 'foo',\n customName: 'foo/es/{{ kebabCase member }}',\n },\n ],\n }),\n ],\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"Transformed to:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import Btn from 'foo/es/my-button';\n"})}),"\n",(0,i.jsx)(n.p,{children:"In addition to kebabCase, there are cameraCase, snakeCase, upperCase and lowerCase can be used as well."})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,o.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}n.default=l,l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-import.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Configurations",id:"configurations",depth:2},{text:"pluginImport",id:"pluginimport",depth:3},{text:"Notes",id:"notes",depth:2}],title:"Import Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8914.a2a0b7b9.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8914.a2a0b7b9.js.LICENSE.txt new file mode 100644 index 0000000000..0e69721496 --- /dev/null +++ b/modern-js/module-tools/static/js/async/8914.a2a0b7b9.js.LICENSE.txt @@ -0,0 +1,5 @@ +/*! react/jsx-runtime */ + +/*! @mdx-js/react */ + +/*! @theme */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8954.12a56f9d.js b/modern-js/module-tools/static/js/async/8954.12a56f9d.js deleted file mode 100644 index 7f4f2c1118..0000000000 --- a/modern-js/module-tools/static/js/async/8954.12a56f9d.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 8954.12a56f9d.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8954"],{37902:function(e,n,d){"use strict";d.r(n);var s=d("39980"),c=d("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",pre:"pre",h2:"h2",strong:"strong",h3:"h3",ul:"ul",li:"li",blockquote:"blockquote"},(0,c.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",children:["\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E00\u822C\u6765\u8BF4\uFF0C\u9879\u76EE\u6240\u9700\u8981\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u53EF\u4EE5\u901A\u8FC7\u5305\u7BA1\u7406\u5668\u7684 ",(0,s.jsx)(n.code,{children:"install"})," \u547D\u4EE4\u5B89\u88C5\uFF0C\u5728\u5B89\u88C5\u7B2C\u4E09\u65B9\u4F9D\u8D56\u6210\u529F\u540E\uFF0C\u8FD9\u4E9B\u7B2C\u4E09\u65B9\u4F9D\u8D56\u4E00\u822C\u4F1A\u51FA\u73B0\u5728\u9879\u76EE ",(0,s.jsx)(n.code,{children:"package.json"})," \u7684 ",(0,s.jsx)(n.code,{children:"dependencies"})," \u548C ",(0,s.jsx)(n.code,{children:"devDependencies"})," \u4E0B\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="pacakge.json"',children:'{\n "dependencies": {},\n "devDependencies": {}\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4E0B\u7684\u4F9D\u8D56\u901A\u5E38\u6765\u8BF4\u662F\u8FD9\u4E2A\u5305\u8FD0\u884C\u6240\u9700\u7684\u4F9D\u8D56\uFF0C ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u5219\u4EE3\u8868\u7740\u5F00\u53D1\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4EE5\u5916\uFF0C",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started#peerdependencies",children:(0,s.jsx)(n.code,{children:'"peerDependencies"'})})," \u4E5F\u53EF\u4EE5\u58F0\u660E\u5728\u751F\u4EA7\u73AF\u5883\u4E0B\u8FD0\u884C\u6240\u9700\u8981\u7684\u4F9D\u8D56\uFF0C\u6B64\u65F6\u4F1A\u548C\u5B83\u7684\u5BBF\u4E3B\u5171\u4EAB\u4E00\u4EFD\u4F9D\u8D56\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",children:["\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728 Modern.js Module \u91CC\uFF0C",(0,s.jsxs)(n.strong,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4E0D\u4F1A\u5BF9 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4EE5\u53CA ",(0,s.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u8FDB\u884C\u6253\u5305\u5904\u7406"]}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u662F\u56E0\u4E3A\u5728\u5B89\u88C5 npm \u5305\u65F6\uFF0C\u5176 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u4E5F\u4F1A\u88AB\u5B89\u88C5\u3002\u4E0D\u6253\u5305 ",(0,s.jsx)(n.code,{children:'"dependencies"'}),"\uFF0C\u53EF\u4EE5\u51CF\u5C0F\u5305\u4EA7\u7269\u7684\u4F53\u79EF\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u6253\u5305\u67D0\u4E9B\u4F9D\u8D56\uFF0C\u5EFA\u8BAE\u5C06\u5B83\u4EEC\u4ECE ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u632A\u5230 ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \uFF0C\u8FD9\u76F8\u5F53\u4E8E\u5BF9\u4F9D\u8D56\u8FDB\u884C ",(0,s.jsx)(n.strong,{children:"prebundle"})," \uFF0C\u53EF\u4EE5\u51CF\u5C0F\u4F9D\u8D56\u5B89\u88C5\u7684\u4F53\u79EF\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u9879\u76EE\u4F9D\u8D56\u4E86 ",(0,s.jsx)(n.code,{children:"react"}),":"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n },\n // or\n "peerDependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,s.jsx)(n.code,{children:"react"})," \u4F9D\u8D56:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u4EA7\u7269\u4E2D\u4E0D\u4F1A\u5305\u542B ",(0,s.jsx)(n.code,{children:"react"})," \u7684\u4EE3\u7801:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u5982\u679C\u60F3\u8981\u4FEE\u6539\u9ED8\u8BA4\u7684\u5904\u7406\u65B9\u5F0F\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684 API \u8FDB\u884C\u4FEE\u6539\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,s.jsx)(n.code,{children:"buildConfig.autoExternal"})})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",children:["\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728\u4E0A\u9762\u6211\u4EEC\u63D0\u5230\u4E86 ",(0,s.jsx)(n.code,{children:"buildConfig.autoExternal"})," API \u7684\u7528\u9014\uFF0C\u540C\u65F6 ",(0,s.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,s.jsx)(n.code,{children:"buildConfig.externals"})})," \u53EF\u4EE5\u5B9E\u73B0\u5BF9\u4E09\u65B9\u4F9D\u8D56\u66F4\u7EC6\u5FAE\u7684\u5904\u7406\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F8B\u5982\u5F53\u6211\u4EEC\u9700\u8981\u4EC5\u5BF9\u67D0\u4E9B\u4F9D\u8D56\u4E0D\u8FDB\u884C\u6253\u5305\u5904\u7406\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u8FDB\u884C\u914D\u7F6E\uFF1A"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"\u4E00\u822C\u8FD9\u79CD\u60C5\u51B5\uFF0C\u53EF\u80FD\u662F\u67D0\u4E9B\u4F9D\u8D56\u4E0D\u9002\u5408\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u9047\u5230\u8FD9\u79CD\u60C5\u51B5\uFF0C\u5219\u53EF\u4EE5\u6309\u7167\u4E0B\u9762\u7684\u65B9\u5F0F\u8FDB\u884C\u5904\u7406\u3002"}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"epxort default defineConfig({\n buildConfig: {\n autoExternal: false,\n externals: ['pkg-1', /pkg-2/],\n }\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,c.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fexternal-dependency.mdx"]={toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2}],title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",frontmatter:{sidebar_position:4}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7371.40bbf968.js b/modern-js/module-tools/static/js/async/8975.5404cc56.js similarity index 99% rename from modern-js/module-tools/static/js/async/7371.40bbf968.js rename to modern-js/module-tools/static/js/async/8975.5404cc56.js index 0e08206430..d8d020a603 100644 --- a/modern-js/module-tools/static/js/async/7371.40bbf968.js +++ b/modern-js/module-tools/static/js/async/8975.5404cc56.js @@ -1,2 +1,2 @@ -/*! For license information please see 7371.40bbf968.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7371"],{11354:function(e,s,n){"use strict";n.r(s);var i=n("39980"),r=n("9580");function l(e){let s=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul",h3:"h3",blockquote:"blockquote",strong:"strong"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h1,{id:"developing-components",children:["Developing Components",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#developing-components",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"This chapter will describe how to develop component projects using the Modern.js Module."}),"\n",(0,i.jsxs)(s.h2,{id:"initialize-the-project",children:["Initialize the project",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#initialize-the-project",children:"#"})]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["It is recommended to use the ",(0,i.jsx)(s.code,{children:"@modern-js/create"})," command to initialize an npm project."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-text",meta:'title="Interactive questions"',children:"npx @modern-js/create@latest components-project\n\n? Please select the type of project you want to create: Npm Module\n? Please fill in the project name: components-demo\n? Please select the programming language: TS\n? Please select the package manager: pnpm\n"})}),"\n",(0,i.jsxs)(s.ol,{start:"2",children:["\n",(0,i.jsx)(s.li,{children:"The initialized directory structure:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 README.md\n\u251C\u2500\u2500 node_modules/\n\u251C\u2500\u2500 dist/\n\u251C\u2500\u2500 modern.config.ts\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pnpm-lock.yaml\n\u251C\u2500\u2500 src\n\u2502 \u251C\u2500\u2500 index.ts\n\u2502 \u2514\u2500\u2500 modern-app-env.d.ts\n\u2514\u2500\u2500 tsconfig.json\n"})}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsxs)(s.li,{children:["Finally, modify the file suffix and content of ",(0,i.jsx)(s.code,{children:"./src/index.ts"})," as follows, and the initialization of the component project is completed."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"export default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(s.h2,{id:"debugging-code-with-storybook",children:["Debugging code with Storybook",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#debugging-code-with-storybook",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Please refer to ",(0,i.jsx)(s.a,{href:"/guide/basic/using-storybook",children:'"Using Storybook"'})," to debug code using Storybook."]}),"\n",(0,i.jsxs)(s.h2,{id:"developing-styles",children:["Developing Styles",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#developing-styles",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Next we can add styles to the component."}),"\n",(0,i.jsx)(s.p,{children:"The following capabilities are currently supported for developing styles."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"CSS/PostCSS"}),"\n",(0,i.jsx)(s.li,{children:"Less"}),"\n",(0,i.jsx)(s.li,{children:"Scss/Sass"}),"\n",(0,i.jsx)(s.li,{children:"Tailwind CSS"}),"\n",(0,i.jsx)(s.li,{children:"CSS Modules"}),"\n"]}),"\n",(0,i.jsxs)(s.h3,{id:"csspostcss",children:["CSS/PostCSS",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#csspostcss",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports PostCSS and has the following built-in PostCSS plugins."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/luisrudge/postcss-flexbugs-fixes",target:"_blank",rel:"noopener noreferrer",children:"flexbugs-fixes"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-custom-properties",target:"_blank",rel:"noopener noreferrer",children:"custom-properties"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/maximkoretskiy/postcss-initial",target:"_blank",rel:"noopener noreferrer",children:"initial"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/shrpne/postcss-page-break",target:"_blank",rel:"noopener noreferrer",children:"page-break"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-font-variant",target:"_blank",rel:"noopener noreferrer",children:"font-variant"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-media-minmax",target:"_blank",rel:"noopener noreferrer",children:"media-minmax"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",target:"_blank",rel:"noopener noreferrer",children:"nesting"})}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["So we can create ",(0,i.jsx)(s.code,{children:".css"})," files in our projects and use the syntax support and capabilities provided by these plugins directly in our css files."]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-less",meta:'title="./src/index.css"',children:'a,\nb {\n color: red;\n\n /* "&" comes first */\n & c,\n & d {\n color: white;\n }\n\n /* "&" comes later, requiring "@nest" */\n @nest e & {\n color: yellow;\n }\n}\n'})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"CSS artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:"a,\nb {\n color: red;\n}\na c,\nb c,\na d,\nb d {\n color: white;\n}\ne a,\ne b {\n color: yellow;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"less",children:["Less",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports development styles using Less."}),"\n",(0,i.jsxs)(s.blockquote,{children:["\n",(0,i.jsx)(s.p,{children:"The current built-in Less version is v4.1.3"}),"\n"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-less",meta:'title="./src/common.less"',children:"@bg: black;\n@bg-light: boolean(luma(@bg) > 50%);\n\ndiv {\n background: @bg;\n color: if(@bg-light, black, white);\n}\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Less artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"div {\n background: black;\n color: white;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"sassscss",children:["Sass/Scss",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#sassscss",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports developing styles using Scss/Sass."}),"\n",(0,i.jsxs)(s.blockquote,{children:["\n",(0,i.jsx)(s.p,{children:"The current built-in Sass version is v1.54.4"}),"\n"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-sass",meta:'title="./src/common.sass"',children:"$font-stack: Helvetica, sans-serif;\n$primary-color: #333;\n\nbody {\n font: 100% $font-stack;\n color: $primary-color;\n}\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Less artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"body {\n font: 100% Helvetica, sans-serif;\n color: #333;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"tailwind-css",children:["Tailwind CSS",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Please refer to ",(0,i.jsx)(s.a,{href:"/guide/best-practices/use-tailwindcss",children:'"Using Tailwind CSS"'})," for detailed usage."]}),"\n",(0,i.jsxs)(s.h3,{id:"css-modules",children:["CSS Modules",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#css-modules",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports the development of styles using CSS Modules. By default, the following files are recognized as CSS Module files."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.css"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.less"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.scss"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.sass"})}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"If you need to configure CSS Modules, you can check out the API at"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/api/config/build-config#styleautomodules",children:"style.autoModules"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/api/config/build-config#stylemodules",children:"style.modules"})}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"The following is a code example."}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import style from './index.module.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./src/index.module.css"',children:".btn {\n color: blue;\n}\n"})}),"\n",(0,i.jsxs)(s.h2,{id:"configuring-build-artifacts",children:["Configuring build artifacts",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#configuring-build-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Based on most scenarios of component project usage, ",(0,i.jsxs)(s.strong,{children:["it is recommended to use the ",(0,i.jsx)(s.code,{children:"npm-component"})," build preset"]}),". This preset yields a output directory structure of"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 dist\n\u2502 \u251C\u2500\u2500 es\n\u2502 \u251C\u2500\u2500 lib\n\u2502 \u2514\u2500\u2500 types\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/es"}),": Contains bundleless artifacts in ES modules format that support the es6 syntax."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/lib"}),": Contains bundleless artifacts in CommonJS format with support for es6 syntax."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/types"}),": Contains the types file."]}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.a,{href:"/en/api/config/build-preset",children:(0,i.jsx)(s.code,{children:"buildPreset"})})," can be configured manually if there is a requirement to use syntax support, and supports modifying the supported syntax by adding a suffix to ",(0,i.jsx)(s.code,{children:"npm-component"}),"."]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",children:"export default defineConfig({\n buildPreset: 'npm-component-es2019',\n});\n"})}),"\n",(0,i.jsxs)(s.p,{children:["If you have special needs for the build artifacts directory structure, you can use the ",(0,i.jsxs)(s.a,{href:"/en/api/config/build-config",children:[(0,i.jsx)(s.code,{children:"buildConfig"})," API"]}),", which can be used by the following documentation."]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/guide/basic/modify-output-product#build-configuration-object",children:"modify-output-product"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/guide/advance/in-depth-about-build",children:"in-depth-about-build"})}),"\n"]}),"\n",(0,i.jsxs)(s.h2,{id:"releasing-components",children:["Releasing components",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#releasing-components",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["It is recommended to use the version release feature provided by Modern.js Module. You can refer to the ",(0,i.jsx)(s.a,{href:"/en/guide/basic/publish-your-project",children:'"Version Management and Release"'})," section for more information."]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,r.ah)(),e.components);return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}s.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fbest-practices%2Fcomponents.mdx"]={toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2},{text:"Developing Styles",id:"developing-styles",depth:2},{text:"CSS/PostCSS",id:"csspostcss",depth:3},{text:"Less",id:"less",depth:3},{text:"Sass/Scss",id:"sassscss",depth:3},{text:"Tailwind CSS",id:"tailwind-css",depth:3},{text:"CSS Modules",id:"css-modules",depth:3},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2},{text:"Releasing components",id:"releasing-components",depth:2}],title:"Developing Components",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +/*! For license information please see 8975.5404cc56.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8975"],{40726:function(e,s,n){"use strict";n.r(s);var i=n("39980"),r=n("9580");function l(e){let s=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",ol:"ol",li:"li",code:"code",pre:"pre",ul:"ul",h3:"h3",blockquote:"blockquote",strong:"strong"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h1,{id:"developing-components",children:["Developing Components",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#developing-components",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"This chapter will describe how to develop component projects using the Modern.js Module."}),"\n",(0,i.jsxs)(s.h2,{id:"initialize-the-project",children:["Initialize the project",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#initialize-the-project",children:"#"})]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["It is recommended to use the ",(0,i.jsx)(s.code,{children:"@modern-js/create"})," command to initialize an npm project."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-text",meta:'title="Interactive questions"',children:"npx @modern-js/create@latest components-project\n\n? Please select the type of project you want to create: Npm Module\n? Please fill in the project name: components-demo\n? Please select the programming language: TS\n? Please select the package manager: pnpm\n"})}),"\n",(0,i.jsxs)(s.ol,{start:"2",children:["\n",(0,i.jsx)(s.li,{children:"The initialized directory structure:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 README.md\n\u251C\u2500\u2500 node_modules/\n\u251C\u2500\u2500 dist/\n\u251C\u2500\u2500 modern.config.ts\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pnpm-lock.yaml\n\u251C\u2500\u2500 src\n\u2502 \u251C\u2500\u2500 index.ts\n\u2502 \u2514\u2500\u2500 modern-app-env.d.ts\n\u2514\u2500\u2500 tsconfig.json\n"})}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsxs)(s.li,{children:["Finally, modify the file suffix and content of ",(0,i.jsx)(s.code,{children:"./src/index.ts"})," as follows, and the initialization of the component project is completed."]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"export default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsxs)(s.h2,{id:"debugging-code-with-storybook",children:["Debugging code with Storybook",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#debugging-code-with-storybook",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Please refer to ",(0,i.jsx)(s.a,{href:"/guide/basic/using-storybook",children:'"Using Storybook"'})," to debug code using Storybook."]}),"\n",(0,i.jsxs)(s.h2,{id:"developing-styles",children:["Developing Styles",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#developing-styles",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Next we can add styles to the component."}),"\n",(0,i.jsx)(s.p,{children:"The following capabilities are currently supported for developing styles."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"CSS/PostCSS"}),"\n",(0,i.jsx)(s.li,{children:"Less"}),"\n",(0,i.jsx)(s.li,{children:"Scss/Sass"}),"\n",(0,i.jsx)(s.li,{children:"Tailwind CSS"}),"\n",(0,i.jsx)(s.li,{children:"CSS Modules"}),"\n"]}),"\n",(0,i.jsxs)(s.h3,{id:"csspostcss",children:["CSS/PostCSS",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#csspostcss",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports PostCSS and has the following built-in PostCSS plugins."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/luisrudge/postcss-flexbugs-fixes",target:"_blank",rel:"noopener noreferrer",children:"flexbugs-fixes"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-custom-properties",target:"_blank",rel:"noopener noreferrer",children:"custom-properties"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/maximkoretskiy/postcss-initial",target:"_blank",rel:"noopener noreferrer",children:"initial"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/shrpne/postcss-page-break",target:"_blank",rel:"noopener noreferrer",children:"page-break"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-font-variant",target:"_blank",rel:"noopener noreferrer",children:"font-variant"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/postcss/postcss-media-minmax",target:"_blank",rel:"noopener noreferrer",children:"media-minmax"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",target:"_blank",rel:"noopener noreferrer",children:"nesting"})}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["So we can create ",(0,i.jsx)(s.code,{children:".css"})," files in our projects and use the syntax support and capabilities provided by these plugins directly in our css files."]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-less",meta:'title="./src/index.css"',children:'a,\nb {\n color: red;\n\n /* "&" comes first */\n & c,\n & d {\n color: white;\n }\n\n /* "&" comes later, requiring "@nest" */\n @nest e & {\n color: yellow;\n }\n}\n'})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"CSS artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/index.css"',children:"a,\nb {\n color: red;\n}\na c,\nb c,\na d,\nb d {\n color: white;\n}\ne a,\ne b {\n color: yellow;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"less",children:["Less",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#less",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports development styles using Less."}),"\n",(0,i.jsxs)(s.blockquote,{children:["\n",(0,i.jsx)(s.p,{children:"The current built-in Less version is v4.1.3"}),"\n"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source Code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-less",meta:'title="./src/common.less"',children:"@bg: black;\n@bg-light: boolean(luma(@bg) > 50%);\n\ndiv {\n background: @bg;\n color: if(@bg-light, black, white);\n}\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Less artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"div {\n background: black;\n color: white;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"sassscss",children:["Sass/Scss",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#sassscss",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports developing styles using Scss/Sass."}),"\n",(0,i.jsxs)(s.blockquote,{children:["\n",(0,i.jsx)(s.p,{children:"The current built-in Sass version is v1.54.4"}),"\n"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Source code:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-sass",meta:'title="./src/common.sass"',children:"$font-stack: Helvetica, sans-serif;\n$primary-color: #333;\n\nbody {\n font: 100% $font-stack;\n color: $primary-color;\n}\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:"Less artifact:"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./dist/es/common.css"',children:"body {\n font: 100% Helvetica, sans-serif;\n color: #333;\n}\n"})}),"\n",(0,i.jsxs)(s.h3,{id:"tailwind-css",children:["Tailwind CSS",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Please refer to ",(0,i.jsx)(s.a,{href:"/guide/best-practices/use-tailwindcss",children:'"Using Tailwind CSS"'})," for detailed usage."]}),"\n",(0,i.jsxs)(s.h3,{id:"css-modules",children:["CSS Modules",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#css-modules",children:"#"})]}),"\n",(0,i.jsx)(s.p,{children:"Modern.js Module supports the development of styles using CSS Modules. By default, the following files are recognized as CSS Module files."}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.css"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.less"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.scss"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.code,{children:".module.sass"})}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"If you need to configure CSS Modules, you can check out the API at"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/api/config/build-config#styleautomodules",children:"style.autoModules"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/api/config/build-config#stylemodules",children:"style.modules"})}),"\n"]}),"\n",(0,i.jsx)(s.p,{children:"The following is a code example."}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",meta:'title="./src/index.tsx"',children:"import style from './index.module.css';\n\nexport default () => {\n return
                  hello world
                  ;\n};\n"})}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-css",meta:'title="./src/index.module.css"',children:".btn {\n color: blue;\n}\n"})}),"\n",(0,i.jsxs)(s.h2,{id:"configuring-build-artifacts",children:["Configuring build artifacts",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#configuring-build-artifacts",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["Based on most scenarios of component project usage, ",(0,i.jsxs)(s.strong,{children:["it is recommended to use the ",(0,i.jsx)(s.code,{children:"npm-component"})," build preset"]}),". This preset yields a output directory structure of"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-bash",children:".\n\u251C\u2500\u2500 dist\n\u2502 \u251C\u2500\u2500 es\n\u2502 \u251C\u2500\u2500 lib\n\u2502 \u2514\u2500\u2500 types\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/es"}),": Contains bundleless artifacts in ES modules format that support the es6 syntax."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/lib"}),": Contains bundleless artifacts in CommonJS format with support for es6 syntax."]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:". /dist/types"}),": Contains the types file."]}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.a,{href:"/en/api/config/build-preset",children:(0,i.jsx)(s.code,{children:"buildPreset"})})," can be configured manually if there is a requirement to use syntax support, and supports modifying the supported syntax by adding a suffix to ",(0,i.jsx)(s.code,{children:"npm-component"}),"."]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-tsx",children:"export default defineConfig({\n buildPreset: 'npm-component-es2019',\n});\n"})}),"\n",(0,i.jsxs)(s.p,{children:["If you have special needs for the build artifacts directory structure, you can use the ",(0,i.jsxs)(s.a,{href:"/en/api/config/build-config",children:[(0,i.jsx)(s.code,{children:"buildConfig"})," API"]}),", which can be used by the following documentation."]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/guide/basic/modify-output-product#build-configuration-object",children:"modify-output-product"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"/en/guide/advance/in-depth-about-build",children:"in-depth-about-build"})}),"\n"]}),"\n",(0,i.jsxs)(s.h2,{id:"releasing-components",children:["Releasing components",(0,i.jsx)(s.a,{className:"header-anchor","aria-hidden":"true",href:"#releasing-components",children:"#"})]}),"\n",(0,i.jsxs)(s.p,{children:["It is recommended to use the version release feature provided by Modern.js Module. You can refer to the ",(0,i.jsx)(s.a,{href:"/en/guide/basic/publish-your-project",children:'"Version Management and Release"'})," section for more information."]})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,r.ah)(),e.components);return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}s.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["en%2Fguide%2Fbest-practices%2Fcomponents.mdx"]={toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2},{text:"Developing Styles",id:"developing-styles",depth:2},{text:"CSS/PostCSS",id:"csspostcss",depth:3},{text:"Less",id:"less",depth:3},{text:"Sass/Scss",id:"sassscss",depth:3},{text:"Tailwind CSS",id:"tailwind-css",depth:3},{text:"CSS Modules",id:"css-modules",depth:3},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2},{text:"Releasing components",id:"releasing-components",depth:2}],title:"Developing Components",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8954.12a56f9d.js.LICENSE.txt b/modern-js/module-tools/static/js/async/8975.5404cc56.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8954.12a56f9d.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/8975.5404cc56.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/8993.14d2528b.js b/modern-js/module-tools/static/js/async/8993.14d2528b.js deleted file mode 100644 index 8881aaee00..0000000000 --- a/modern-js/module-tools/static/js/async/8993.14d2528b.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 8993.14d2528b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8993"],{83503:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",code:"code",pre:"pre",ul:"ul",li:"li",blockquote:"blockquote",div:"div",h3:"h3",h4:"h4"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5F00\u59CB\u4E4B\u524D",children:["\u5F00\u59CB\u4E4B\u524D",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u59CB\u4E4B\u524D",children:"#"})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u73AF\u5883\u51C6\u5907",children:["\u73AF\u5883\u51C6\u5907",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u73AF\u5883\u51C6\u5907",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4E3A\u4E86\u4F7F\u7528 Modern.js Module\uFF0C\u9996\u5148\u9700\u8981 ",(0,s.jsx)(n.a,{href:"https://nodejs.org/zh/",target:"_blank",rel:"noopener noreferrer",children:"NodeJS"}),"\uFF0C\u6211\u4EEC\u63A8\u8350\u6700\u65B0\u7684",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"\u957F\u671F\u7EF4\u62A4\u7248\u672C"}),"\uFF0C\u5E76\u786E\u4FDD Node \u7248\u672C\u5927\u4E8E\u7B49\u4E8E ",(0,s.jsx)(n.strong,{children:"16.0.0"}),"\u3002\u56E0\u4E3A\u975E\u7A33\u5B9A\u7684 NodeJS \u65F6\u5E38\u6709\u4E00\u4E9B Bug\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://github.com/coreybutler/nvm-windows",target:"_blank",rel:"noopener noreferrer",children:"nvm-windows"})," \u548C ",(0,s.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",target:"_blank",rel:"noopener noreferrer",children:"nvm"}),"\uFF08Mac / Linux\uFF09\u5B89\u88C5\uFF0C\u8FD9\u6837\u4F60\u5C31\u53EF\u4EE5\u65B9\u4FBF\u5730\u5207\u6362\u5230\u4E0D\u540C\u7684 NodeJS \u7248\u672C\uFF0C\u8FD9\u4E9B\u7248\u672C\u53EF\u80FD\u4F1A\u7528\u4E8E\u4E0D\u540C\u7684\u9879\u76EE\u3002"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u521D\u8BC6-npm",children:["\u521D\u8BC6 npm",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521D\u8BC6-npm",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53 NodeJS \u88AB\u5B89\u88C5\u540E\uFF0C\u4F60\u4E0D\u4EC5\u53EF\u4EE5\u5728\u547D\u4EE4\u884C\u4E2D\u8BBF\u95EE ",(0,s.jsx)(n.code,{children:"node"})," \u53EF\u6267\u884C\u7A0B\u5E8F\uFF0C\u540C\u65F6\u4F60\u4E5F\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm"})," \u547D\u4EE4\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"npm \u662F NodeJS \u7684\u6807\u51C6\u8F6F\u4EF6\u5305\u7BA1\u7406\u5668\u3002\u5B83\u4E00\u5F00\u59CB\u7684\u7528\u9014\u662F\u7528\u4E8E\u4E0B\u8F7D\u548C\u7BA1\u7406 NodeJS \u5305\u7684\u4F9D\u8D56\u5173\u7CFB\uFF0C\u4F46\u540E\u6765\u5B83\u9010\u6E10\u53D8\u6210\u4E3A\u4E00\u4E2A\u7528\u4E8E\u524D\u7AEF JavaScript \u7684\u5DE5\u5177\u3002"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["\u5982\u679C\u4F60\u5DF2\u7ECF\u5BF9 npm \u548C npm \u5305\u7684\u4F7F\u7528\u65B9\u5F0F\u6709\u6240\u4E86\u89E3\uFF0C\u90A3\u4E48\u53EF\u4EE5\u76F4\u63A5\u8DF3\u5230",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started#npm-%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8",children:"\u300Cnpm \u5305\u7BA1\u7406\u5668\u300D"}),"\u90E8\u5206\u3002"]})}),"\n",(0,s.jsxs)(n.h2,{id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",children:["npm \u5305\u7C7B\u578B\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7C7B\u578B\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u90A3\u4E48\u4EC0\u4E48\u662F npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\u5462\uFF1F\u5F53\u6211\u4EEC\u5728\u4E00\u4E2A\u7A7A\u7684\u9879\u76EE\u76EE\u5F55\u4E0B\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm init"})," \u547D\u4EE4\u7684\u65F6\u5019\uFF0C\u5B83\u4F1A\u5728\u5F53\u524D\u76EE\u5F55\u4E0B\u9762\u521B\u5EFA\u4E00\u4E2A\u6587\u4EF6\u540D\u4E3A ",(0,s.jsx)(n.code,{children:"package.json"})," \u7684 JSON \u6587\u4EF6\u3002\u5728\u521B\u5EFA\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u9700\u8981\u586B\u5199\u5305\u62EC\u4F46\u4E0D\u9650\u4E8E npm \u5305\u7684\u540D\u79F0\u3001\u7248\u672C\u53F7\u3001\u63CF\u8FF0\u7B49\u7B49\u5185\u5BB9\uFF0C\u8FD9\u4E9B\u586B\u5199\u7684\u5185\u5BB9\u90FD\u4F1A\u5728\u751F\u6210\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u627E\u5230\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "npm-demo",\n "version": "1.0.0",\n "description": "",\n "main": "index.js",\n "scripts": {\n "test": "echo \\"Error: no test specified\\" && exit 1"\n },\n "author": "",\n "license": "ISC"\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u6B64\u65F6\u8FD9\u4E2A\u5305\u542B\u4E86\u521D\u59CB\u5316\u540E\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u7684\u9879\u76EE\u5C31\u662F\u4E00\u4E2A npm \u5305\u7C7B\u578B\u7684\u9879\u76EE\uFF0C\u4F60\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm publish"})," \u547D\u4EE4\u5C06\u8FD9\u4E2A\u9879\u76EE\u53D1\u5E03\u5230 ",(0,s.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["npm Registry \u662F\u4E00\u4E2A ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-the-public-npm-registry",target:"_blank",rel:"noopener noreferrer",children:"npm \u5305\u5B58\u50A8\u7684\u5730\u65B9"}),"\uFF0C\u5F00\u53D1\u8005\u4EEC\u4E0D\u4EC5\u53EF\u4EE5\u5C06\u4ED6\u4EEC\u81EA\u5DF1\u7684 npm \u5305\u53D1\u5E03\u5230 npm Registry\uFF0C\u8FD8\u53EF\u4EE5\u901A\u8FC7 npm Registry \u4F7F\u7528\u5176\u4ED6\u5F00\u53D1\u8005\u53D1\u5E03\u7684 npm \u5305\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u4F18\u8D28\u7684 npm \u5305\u4F1A\u6709\u66F4\u591A\u7684\u4EBA\u53BB\u4F7F\u7528\uFF0C\u56E0\u4E3A\u5B83\u4E0D\u4EC5\u8282\u7701\u4E86\u5F88\u591A\u4EE3\u7801\u5B9E\u73B0\u7684\u5DE5\u4F5C\uFF0C\u540C\u65F6\u4E5F\u4E0D\u5BB9\u6613\u8BA9\u9879\u76EE\u51FA\u73B0\u95EE\u9898\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",children:["\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u8981\u4E3A\u521D\u59CB\u5316\u7684\u9879\u76EE\u589E\u52A0\u7B2C\u4E09\u65B9\u7684 npm \u5305\u7684\u65F6\u5019\uFF0C\u6211\u4EEC\u53EF\u4EE5\u628A\u8FD9\u4E00\u8FC7\u7A0B\u53EB\u505A\u201C\u4E3A\u9879\u76EE\u5B89\u88C5\u4F9D\u8D56\u201D\u6216\u662F\u201C\u4E3A\u9879\u76EE\u589E\u52A0\u4F9D\u8D56\u201D\u3002\u5728\u589E\u52A0\u4F9D\u8D56\u4E4B\u524D\uFF0C\u9996\u5148\u6211\u4EEC\u8981\u7279\u522B\u4E86\u89E3\u4E00\u4EF6\u4E8B\u60C5 \u2014\u2014 ",(0,s.jsx)(n.strong,{children:"npm \u4F9D\u8D56\u7684\u8F6F\u4EF6\u5305\u7C7B\u578B"}),"\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"dependencies"'}),"\uFF1A\u4E00\u79CD\u662F\u4F60\u7684\u5E94\u7528\u7A0B\u5E8F\u5728\u751F\u4EA7\u73AF\u5883\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"devDependencies"'}),"\uFF1A\u53E6\u4E00\u79CD\u662F\u4EC5\u5728\u672C\u5730\u5F00\u53D1\u548C\u6D4B\u8BD5\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305\u3002","\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"\u8F6F\u4EF6\u5305\u53EF\u4EE5\u7406\u89E3\u4E3A\u662F\u7B2C\u4E09\u65B9\u7684 npm \u5305\u3002"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install npm-package-name"})," \u6216\u8005 ",(0,s.jsx)(n.code,{children:"npm add npm-package-name"})," \u7684\u65B9\u5F0F\u6765\u5B89\u88C5\u5728",(0,s.jsx)(n.strong,{children:"\u751F\u4EA7\u73AF\u5883\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305"}),"\uFF0C\u6216\u8005\u4E5F\u53EF\u4EE5\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u624B\u52A8\u7684\u5C06\u9700\u8981\u5B89\u88C5\u7684\u5305\u548C\u5BF9\u5E94\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"\u8BED\u4E49\u5316\u7248\u672C"}),"\u5199\u5728 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u91CC\uFF0C\u5E76\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install"})," \u547D\u4EE4\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "dependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u540C\u7406\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install npm-package-name --save-dev"})," \u6216 ",(0,s.jsx)(n.code,{children:"npm add npm-package-name --save-dev"})," \u7684\u65B9\u5F0F\u6765\u5B89\u88C5",(0,s.jsx)(n.strong,{children:"\u4EC5\u5728\u672C\u5730\u5F00\u53D1\u548C\u6D4B\u8BD5\u4E2D\u9700\u8981\u7684\u8F6F\u4EF6\u5305"}),"\uFF0C\u6216\u8005\u4E5F\u53EF\u4EE5\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u4E2D\u624B\u52A8\u7684\u5C06\u9700\u8981\u5B89\u88C5\u7684\u5305\u548C\u5BF9\u5E94\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/about-semantic-versioning",target:"_blank",rel:"noopener noreferrer",children:"\u8BED\u4E49\u5316\u7248\u672C"}),"\u5199\u5728 ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u91CC\uFF0C\u5E76\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm install"})," \u547D\u4EE4\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "name": "your-npm-project",\n "devDependencies": {\n "npm-package-name": "0.1.0"\n }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["\u5728\u5B89\u88C5\u6216\u8005\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305\u7684\u65F6\u5019\u4E00\u5B9A\u8981\u786E\u5B9A\u5B83\u4EEC\u7684\u7528\u9014\uFF0C\u4EE5\u53CA\u901A\u8FC7\u533A\u5206\u5B83\u4EEC\u7684\u7C7B\u578B\u786E\u5B9A\u597D\u5B83\u4EEC\u5E94\u8BE5\u653E\u5728 ",(0,s.jsx)(n.code,{children:'"dependencies"'})," \u8FD8\u662F ",(0,s.jsx)(n.code,{children:'"devDependencies"'})," \u4E2D\u3002"]})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4E00\u822C\u6765\u8BF4\uFF0C\u9700\u8981\u5728\u6E90\u4EE3\u7801\u4E2D\u4F7F\u7528\u5230\u7684\u5305\u90FD\u5C5E\u4E8E ",(0,s.jsx)(n.code,{children:"dependencies"})," \u4F9D\u8D56\u3002\u9664\u975E\u4F60\u901A\u8FC7\u6253\u5305\u7684\u65B9\u5F0F\u5C06\u4F9D\u8D56\u7684\u4EE3\u7801\u8F93\u51FA\u5230\u672C\u5730\uFF0C\u90A3\u4E48\u8FD9\u79CD\u60C5\u51B5\u53EF\u4EE5\u5C06\u5B83\u4F5C\u4E3A ",(0,s.jsx)(n.code,{children:"devDependencies"})," \u4F9D\u8D56\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",children:["\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",children:["npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728 ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u5B58\u5728\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\uFF0C\u5B83\u5BF9\u5E94\u7684\u503C\u662F\u4E00\u4E2A\u6A21\u5757 ID\uFF0C\u6216\u8005\u66F4\u76F4\u89C2\u7684\u8BF4\u662F\u4E00\u4E2A NodeJS \u6587\u4EF6\u8DEF\u5F84\uFF0C\u5B83\u662F\u4F60\u7A0B\u5E8F\u7684\u4E3B\u8981\u5165\u53E3\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u4F8B\u5982\u4F60\u7684\u5305\u540D\u4E3A ",(0,s.jsx)(n.code,{children:"foo"}),"\uFF0C\u5E76\u4E14\u7528\u6237\u5B89\u88C5\u4E86\u5B83\uFF0C\u7136\u540E\u6267\u884C ",(0,s.jsx)(n.code,{children:'require("foo")'})," \u4EE3\u7801\uFF0C\u90A3\u4E48 ",(0,s.jsx)(n.code,{children:"foo"})," \u8FD9\u4E2A npm \u5305\u7684 ",(0,s.jsx)(n.code,{children:'"main"'})," \u5B57\u6BB5\u5BF9\u5E94\u7684\u6587\u4EF6\u5C06\u4F1A\u88AB\u5BFC\u51FA\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["\u63A8\u8350\u5728\u4F60\u7684 npm \u5305\u91CC\u4E00\u5B9A\u8981\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5B57\u6BB5"]}),"\u3002\u5982\u679C\u6CA1\u6709\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'}),"\uFF0C\u5219\u9ED8\u8BA4\u5165\u53E3\u4E3A\u5305\u7684\u6839\u76EE\u5F55\u4E0B\u7684 ",(0,s.jsx)(n.code,{children:"index.js"})," \u6587\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86\u9700\u8981\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\u4EE5\u5916\uFF0C\u4E00\u822C\u8FD8\u4F1A\u8BBE\u7F6E ",(0,s.jsx)(n.code,{children:'"module"'})," \u5C5E\u6027\u3002\u5B83\u4E0E ",(0,s.jsx)(n.code,{children:'"main"'})," \u5C5E\u6027\u7684\u7528\u9014\u7C7B\u4F3C\uFF0C\u5B83\u4E3B\u8981\u662F\u7528\u4E8E\u5728 webpack \u573A\u666F\u4E0B\u4F7F\u7528\u3002webpack \u5728\u5927\u591A\u6570\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u4EE5 ",(0,s.jsx)(n.strong,{children:'"module" -> "main"'})," \u8FD9\u4E2A\u987A\u5E8F\u8BFB\u53D6 npm \u5305\u7684\u5165\u53E3\uFF08\u6587\u4EF6\uFF09\u3002"]}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u60F3\u8981\u4E86\u89E3\u5173\u4E8E webpack \u5982\u4F55\u505A\u8FD9\u4EF6\u4E8B\uFF0C\u53EF\u4EE5\u67E5\u770B\u8FD9\u4E2A",(0,s.jsx)(n.a,{href:"https://webpack.js.org/configuration/resolve/#resolvemainfields",target:"_blank",rel:"noopener noreferrer",children:"\u94FE\u63A5"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"scripts",children:['"scripts"',(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#scripts",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u7684 ",(0,s.jsx)(n.code,{children:'"scripts"'})," \u5C5E\u6027\u652F\u6301\u4E00\u4E9B\u5185\u7F6E\u7684\u811A\u672C\u548C npm \u9884\u8BBE\u7684\u751F\u547D\u5468\u671F\u4E8B\u4EF6\uFF0C\u4EE5\u53CA\u4EFB\u610F\u7684\u811A\u672C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u8FD9\u4E9B\u90FD\u53EF\u4EE5\u901A\u8FC7\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm run-script "})," \u6216\u7B80\u79F0 ",(0,s.jsx)(n.code,{children:"npm run "})," \u6765\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u540D\u79F0\u5339\u914D\u7684",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/using-npm/scripts#pre--post-scripts",target:"_blank",rel:"noopener noreferrer",children:"\u524D\u7F6E\u547D\u4EE4\u548C\u540E\u7F6E\u547D\u4EE4"}),"\u4E5F\u4F1A\u88AB\u8FD0\u884C\uFF08\u4F8B\u5982 ",(0,s.jsx)(n.code,{children:"premyscript"}),"\u3001",(0,s.jsx)(n.code,{children:"myscript"}),"\u3001",(0,s.jsx)(n.code,{children:"postmyscript"}),"\uFF09\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "premyscript": "",\n "myscript": "",\n "postmyscript": ""\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u6267\u884C ",(0,s.jsx)(n.code,{children:"npm run myscripts"})," \u7684\u65F6\u5019\uFF0C",(0,s.jsx)(n.code,{children:"premyscripts"})," \u5BF9\u5E94\u7684\u811A\u672C\u4F1A\u5728\u5B83\u4E4B\u524D\u6267\u884C\uFF0C",(0,s.jsx)(n.code,{children:"postmyscripts"})," \u5BF9\u5E94\u7684\u811A\u672C\u4F1A\u5728\u5B83\u4E4B\u540E\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6765\u81EA\u4F9D\u8D56\u7684\u811A\u672C\u547D\u4EE4\u53EF\u4EE5\u7528 ",(0,s.jsx)(n.code,{children:"npm explore -- npm run "})," \u8FD0\u884C\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u8FD8\u6709\u4E00\u4E9B\u7279\u6B8A\u7684\u751F\u547D\u5468\u671F\u811A\u672C\uFF08Life Scripts\uFF09\uFF0C\u53EA\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\u53D1\u751F\u3002\u8FD9\u91CC\u4ECB\u7ECD\u51E0\u4E2A\u901A\u5E38\u9700\u8981\u4E86\u89E3\u7684\u60C5\u51B5\u3002"}),"\n",(0,s.jsxs)(n.h4,{id:"npm-install",children:[(0,s.jsx)(n.code,{children:"npm install"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-install",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u4F60\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm install -g "})," \u65F6\uFF0C\u4EE5\u4E0B\u811A\u672C\u4F1A\u8FD0\u884C\u3002"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"preinstall"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"install"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postinstall"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepublish"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"preprepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postprepare"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u7684\u8F6F\u4EF6\u5305\u6839\u76EE\u5F55\u6709\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"binding.gyp"})," \u6587\u4EF6\uFF0C\u800C\u4F60\u6CA1\u6709\u5B9A\u4E49 ",(0,s.jsx)(n.code,{children:"install"})," \u6216 ",(0,s.jsx)(n.code,{children:"preinstall"})," \u811A\u672C\uFF0C\u90A3\u4E48 npm \u5C06\u4EE5 ",(0,s.jsx)(n.code,{children:"node-gyp rebuild"})," \u4F5C\u4E3A\u9ED8\u8BA4\u7684 install \u547D\u4EE4\uFF0C\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/node-gyp",target:"_blank",rel:"noopener noreferrer",children:"node-gyp"})," \u8FDB\u884C\u7F16\u8BD1\u3002"]}),"\n",(0,s.jsxs)(n.h4,{id:"npm-publish",children:[(0,s.jsx)(n.code,{children:"npm publish"}),(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-publish",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5F53\u53D1\u5E03\u9879\u76EE\u7684\u65F6\u5019\uFF0C\u6267\u884C\u8BE5\u547D\u4EE4\u4F1A\u89E6\u53D1\u4EE5\u4E0B\u811A\u672C\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepublishOnly"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepack"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"prepare"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postpack"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"publish"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"postpublish"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5F53\u4EE5 ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run",target:"_blank",rel:"noopener noreferrer",children:(0,s.jsx)(n.code,{children:"--dry-run"})})," \u6A21\u5F0F\u8FD0\u884C\u7684\u65F6\u5019\uFF0C",(0,s.jsx)(n.code,{children:"prepare"})," \u5BF9\u5E94\u7684\u811A\u672C\u5C06\u4E0D\u4F1A\u6267\u884C\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"peerdependencies",children:["peerDependencies",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#peerdependencies",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4F60\u7684 npm \u9879\u76EE\u4E0E\u5B83\u7684\u5BBF\u4E3B\u5DE5\u5177\u6216\u8005\u5E93\u4E4B\u95F4\u5B58\u5728\u67D0\u79CD\u517C\u5BB9\u5173\u7CFB\uFF08\u4F8B\u5982\u4E00\u4E2A webpack \u63D2\u4EF6\u9879\u76EE\u548C webpack\uFF09\uFF0C\u540C\u65F6\u4F60\u7684 npm \u9879\u76EE\u4E0D\u60F3\u5C06\u5BBF\u4E3B\u4F5C\u4E3A\u5FC5\u8981\u7684\u4F9D\u8D56\uFF0C\u8FD9\u4E2A\u65F6\u5019\u901A\u5E38\u8BF4\u660E\u4F60\u7684\u9879\u76EE\u53EF\u80FD\u662F\u8FD9\u4E2A\u5BBF\u4E3B\u5DE5\u5177\u6216\u8005\u5E93\u7684\u63D2\u4EF6\u3002\u4F60\u7684 npm \u9879\u76EE\u4F1A\u5BF9\u5BBF\u4E3B\u5305\u7684\u7248\u672C\u6709\u4E00\u5B9A\u7684\u8981\u6C42\uFF0C\u56E0\u4E3A\u53EA\u6709\u5728\u7279\u5B9A\u7684\u7248\u672C\u4E0B\u624D\u4F1A\u66B4\u9732\u51FA npm \u9879\u76EE\u6240\u9700\u8981\u7684 API\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u5173\u4E8E\u66F4\u591A ",(0,s.jsx)(n.code,{children:"peerDependencies"})," \u7684\u89E3\u91CA\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u94FE\u63A5\u4E86\u89E3 npm\u3001pnpm\u3001Yarn \u5BF9\u4E8E\u5B83\u7684\u4E0D\u540C\u5904\u7406\u65B9\u5F0F\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies",target:"_blank",rel:"noopener noreferrer",children:"npm \u5BF9 peerDependencies \u7684\u89E3\u91CA"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://pnpm.io/feature-comparison",target:"_blank",rel:"noopener noreferrer",children:"pnpm vs npm VS Yarn"})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"npm-\u5305\u7BA1\u7406\u5668",children:["npm \u5305\u7BA1\u7406\u5668",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#npm-\u5305\u7BA1\u7406\u5668",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u9664\u4E86 npm \u8FD9\u79CD\u6807\u51C6\u7684\u5305\u7BA1\u7406\u5668\u4EE5\u5916\uFF0C\u76EE\u524D\u4E3B\u6D41\u7684\u8FD8\u6709 ",(0,s.jsx)(n.strong,{children:"pnpm"})," \u548C ",(0,s.jsx)(n.strong,{children:"Yarn"}),"\uFF0C\u5B83\u4EEC\u90FD\u662F\u4E0D\u9519\u7684 npm cli \u66FF\u4EE3\u54C1\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A8\u8350\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://pnpm.io/installation",target:"_blank",rel:"noopener noreferrer",children:"pnpm"})," \u6765\u7BA1\u7406\u9879\u76EE\u4F9D\u8D56\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u65B9\u5F0F\u5B89\u88C5\u5B83\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"npm install -g pnpm\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",children:["Modern.js Module \u914D\u7F6E\u6587\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u914D\u7F6E\u6587\u4EF6",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"@modern-js/create"})," \u521B\u5EFA\u7684\u9879\u76EE\u76EE\u5F55\u4E0B\u63D0\u4F9B\u4E86 Modern.js Module \u7684\u914D\u7F6E\u6587\u4EF6 \u2014\u2014 ",(0,s.jsx)(n.code,{children:"modern.config.(j|t)s"}),"\u3002\u4F46 ",(0,s.jsx)(n.code,{children:"modern.config"})," \u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5FC5\u987B\u5B58\u5728\u7684\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u751F\u6210\u7684\u914D\u7F6E\u6587\u4EF6\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:["\u6211\u4EEC\u63A8\u8350\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"defineConfig"})," \u51FD\u6570"]}),"\uFF0C\u4E0D\u8FC7\u5E76\u4E0D\u5F3A\u5236\u4F7F\u7528\u5B83\u3002\u56E0\u6B64\u4F60\u4E5F\u53EF\u4EE5\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u76F4\u63A5\u8FD4\u56DE\u4E00\u4E2A\u5BF9\u8C61\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools } from '@modern-js/module-tools';\n\nexport default {\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n};\n"})})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fbefore-getting-started.md"]={toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3},{text:'"scripts"',id:"scripts",depth:3},{text:"`npm install`",id:"npm-install",depth:4},{text:"`npm publish`",id:"npm-publish",depth:4},{text:"peerDependencies",id:"peerdependencies",depth:3},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2}],title:"\u5F00\u59CB\u4E4B\u524D",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9001.2aa57bcd.js b/modern-js/module-tools/static/js/async/9016.43a2da2a.js similarity index 95% rename from modern-js/module-tools/static/js/async/9001.2aa57bcd.js rename to modern-js/module-tools/static/js/async/9016.43a2da2a.js index db32ab8af0..f6298c066d 100644 --- a/modern-js/module-tools/static/js/async/9001.2aa57bcd.js +++ b/modern-js/module-tools/static/js/async/9016.43a2da2a.js @@ -1,2 +1,2 @@ -/*! For license information please see 9001.2aa57bcd.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9001"],{89774:function(e,d,r){"use strict";r.r(d);var n=r("39980"),s=r("9580");function l(e){let d=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.h1,{id:"\u901A\u7528\u7C7B\u95EE\u9898",children:["\u901A\u7528\u7C7B\u95EE\u9898",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#\u901A\u7528\u7C7B\u95EE\u9898",children:"#"})]}),"\n",(0,n.jsxs)(d.h2,{id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",children:["Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",children:"#"})]}),"\n",(0,n.jsx)(d.p,{children:"Modern.js Module \u4F7F\u7528 esbuild \u6784\u5EFA\u5DE5\u5177\u5E93\u548C\u7EC4\u4EF6\u5E93\uFF0CRsbuild \u4E13\u6CE8\u4E8E\u89E3\u51B3 Web \u5E94\u7528\u6784\u5EFA\u573A\u666F\u3002"}),"\n",(0,n.jsxs)(d.h2,{id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",children:["Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",children:"#"})]}),"\n",(0,n.jsxs)(d.p,{children:["Modern.js Module \u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u65E0\u6CD5\u4F7F\u7528 webpack \u76F8\u5173\u751F\u6001\u7684\u5DE5\u5177\u3002\n",(0,n.jsx)(d.a,{href:"https://github.com/esbuild/community-plugins",target:"_blank",rel:"noopener noreferrer",children:"\u8FD9\u91CC"}),"\u53EF\u4EE5\u53D1\u73B0\u66F4\u591A esbuild \u793E\u533A\u63D2\u4EF6"]}),"\n",(0,n.jsxs)(d.p,{children:["\u5982\u679C Modern.js Module \u751F\u4EA7\u7684 UMD \u4EA7\u7269\u8FBE\u4E0D\u5230\u4F60\u7684\u8981\u6C42\uFF0C\u53EF\u4EE5\u4F7F\u7528 Rsbuild \u5E76\u6DFB\u52A0 ",(0,n.jsx)(d.a,{href:"https://rsbuild.dev/zh/plugins/list/plugin-umd",target:"_blank",rel:"noopener noreferrer",children:"UMD Plugin"})," \u6784\u5EFA UMD \u4EA7\u7269\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:d}=Object.assign({},(0,s.ah)(),e.components);return d?(0,n.jsx)(d,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}d.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fbasic.mdx"]={toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2}],title:"\u901A\u7528\u7C7B\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 9016.43a2da2a.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9016"],{30934:function(e,d,r){"use strict";r.r(d);var n=r("39980"),s=r("9580");function l(e){let d=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p"},(0,s.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.h1,{id:"\u901A\u7528\u7C7B\u95EE\u9898",children:["\u901A\u7528\u7C7B\u95EE\u9898",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#\u901A\u7528\u7C7B\u95EE\u9898",children:"#"})]}),"\n",(0,n.jsxs)(d.h2,{id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",children:["Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",children:"#"})]}),"\n",(0,n.jsx)(d.p,{children:"Modern.js Module \u4F7F\u7528 esbuild \u6784\u5EFA\u5DE5\u5177\u5E93\u548C\u7EC4\u4EF6\u5E93\uFF0CRsbuild \u4E13\u6CE8\u4E8E\u89E3\u51B3 Web \u5E94\u7528\u6784\u5EFA\u573A\u666F\u3002"}),"\n",(0,n.jsxs)(d.h2,{id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",children:["Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",(0,n.jsx)(d.a,{className:"header-anchor","aria-hidden":"true",href:"#modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",children:"#"})]}),"\n",(0,n.jsxs)(d.p,{children:["Modern.js Module \u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u65E0\u6CD5\u4F7F\u7528 webpack \u76F8\u5173\u751F\u6001\u7684\u5DE5\u5177\u3002\n",(0,n.jsx)(d.a,{href:"https://github.com/esbuild/community-plugins",target:"_blank",rel:"noopener noreferrer",children:"\u8FD9\u91CC"}),"\u53EF\u4EE5\u53D1\u73B0\u66F4\u591A esbuild \u793E\u533A\u63D2\u4EF6"]}),"\n",(0,n.jsxs)(d.p,{children:["\u5982\u679C Modern.js Module \u751F\u4EA7\u7684 UMD \u4EA7\u7269\u8FBE\u4E0D\u5230\u4F60\u7684\u8981\u6C42\uFF0C\u53EF\u4EE5\u4F7F\u7528 Rsbuild \u5E76\u6DFB\u52A0 ",(0,n.jsx)(d.a,{href:"https://rsbuild.dev/zh/plugins/list/plugin-umd",target:"_blank",rel:"noopener noreferrer",children:"UMD Plugin"})," \u6784\u5EFA UMD \u4EA7\u7269\u3002"]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:d}=Object.assign({},(0,s.ah)(),e.components);return d?(0,n.jsx)(d,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}d.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["zh%2Fguide%2Ffaq%2Fbasic.mdx"]={toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2}],title:"\u901A\u7528\u7C7B\u95EE\u9898",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9001.2aa57bcd.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9016.43a2da2a.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/9001.2aa57bcd.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9016.43a2da2a.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/3497.4327456e.js b/modern-js/module-tools/static/js/async/9176.d1a045a2.js similarity index 99% rename from modern-js/module-tools/static/js/async/3497.4327456e.js rename to modern-js/module-tools/static/js/async/9176.d1a045a2.js index 50e88ca23b..1d05d1a811 100644 --- a/modern-js/module-tools/static/js/async/3497.4327456e.js +++ b/modern-js/module-tools/static/js/async/9176.d1a045a2.js @@ -1,2 +1,2 @@ -/*! For license information please see 3497.4327456e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["3497"],{45849:function(e,n,r){"use strict";r.r(n);var d=r("39980"),s=r("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",pre:"pre",ul:"ul",li:"li",em:"em",div:"div"},(0,s.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"cli-\u547D\u4EE4",children:["CLI \u547D\u4EE4",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cli-\u547D\u4EE4",children:"#"})]}),"\n",(0,d.jsx)(n.p,{children:"Modern.js Module \u9879\u76EE\u53EF\u4EE5\u4F7F\u7528\u7684 CLI \u547D\u4EE4\u5982\u4E0B\uFF1A"}),"\n",(0,d.jsxs)(n.h2,{id:"modern-build",children:[(0,d.jsx)(n.code,{children:"modern build"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-build",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern build [options]\n\n\u6784\u5EFA\u751F\u4EA7\u73AF\u5883\u4EA7\u7269\n\nOptions:\n -w, --watch \u4F7F\u7528\u76D1\u542C\u6A21\u5F0F\u6784\u5EFA\u4EE3\u7801\n --tsconfig [tsconfig] \u6307\u5B9A tsconfig.json \u6587\u4EF6\u7684\u8DEF\u5F84 (default:\n "./tsconfig.json")\n --platform [platform] \u6784\u5EFA\u6240\u6709\u6216\u8005\u6307\u5B9A\u5E73\u53F0\u7684\u4EA7\u7269\n --no-dts \u5173\u95ED DTS \u7C7B\u578B\u6587\u4EF6\u751F\u6210\u548C\u7C7B\u578B\u68C0\u67E5\n --no-clear \u5173\u95ED\u81EA\u52A8\u6E05\u9664\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55\u7684\u884C\u4E3A\n -c, --config \u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\uFF08default: "modern.config.j(t)s"\uFF09\n -h, --help \u5C55\u793A\u5F53\u524D\u547D\u4EE4\u7684\u4FE1\u606F\n'})}),"\n",(0,d.jsxs)(n.p,{children:["Modern.js Module \u652F\u6301 ",(0,d.jsx)(n.code,{children:"platform"})," \u6784\u5EFA\u6A21\u5F0F\uFF0C\u53EF\u4EE5\u7528\u4E8E\u6267\u884C\u5176\u4ED6\u5DE5\u5177\u7684\u6784\u5EFA\u4EFB\u52A1\uFF0C\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u6709 ",(0,d.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\u3002\u4F8B\u5982\uFF0C\u53EF\u4EE5\u901A\u8FC7\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern build --platform"})," \u547D\u4EE4\u542F\u52A8 doc \u6784\u5EFA\u4EFB\u52A1\u751F\u6210 doc \u4EA7\u7269\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-new",children:[(0,d.jsx)(n.code,{children:"modern new"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-new",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern new [options]\n\n\u542F\u7528\u53EF\u9009\u529F\u80FD\n\nOptions:\n -d, --debug \u5F00\u542F Debug \u6A21\u5F0F\uFF0C\u6253\u5370\u8C03\u8BD5\u65E5\u5FD7\u4FE1\u606F (default: false)\n -c, --config \u751F\u6210\u5668\u8FD0\u884C\u9ED8\u8BA4\u914D\u7F6E(JSON \u5B57\u7B26\u4E32)\n --dist-tag \u751F\u6210\u5668\u4F7F\u7528\u7279\u6B8A\u7684 npm Tag \u7248\u672C\n --registry \u751F\u6210\u5668\u8FD0\u884C\u8FC7\u7A0B\u4E2D\u5B9A\u5236 npm Registry\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern new"})," \u547D\u4EE4\u7528\u4E8E\u542F\u52A8\u5FAE\u751F\u6210\u5668\u529F\u80FD\uFF0C\u5B83\u53EF\u4EE5\u4E3A\u9879\u76EE\u542F\u7528\u9ED8\u8BA4\u6CA1\u6709\u63D0\u4F9B\u7684\u529F\u80FD\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u76EE\u524D\u53EF\u4EE5\u5F00\u542F\u7684\u529F\u80FD\u6709\uFF1A"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"Test \u6D4B\u8BD5"}),"\n",(0,d.jsx)(n.li,{children:"Storybook V7"}),"\n",(0,d.jsx)(n.li,{children:"Tailwind CSS \u652F\u6301"}),"\n",(0,d.jsx)(n.li,{children:"Modern.js Runtime API"}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5173\u4E8E\u8FD9\u4E9B\u529F\u80FD\uFF0C\u53EF\u4EE5\u901A\u8FC7",(0,d.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"\u300C\u4F7F\u7528\u5FAE\u751F\u6210\u5668\u300D"})," \u7AE0\u8282\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-dev",children:[(0,d.jsx)(n.code,{children:"modern dev"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-dev",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern dev [options]\n\n\u8FD0\u884C\u548C\u8C03\u8BD5\u6A21\u5757\n\nOptions:\n -h, --help display help for command\n\nCommands:\n[dev-tools-subCommand]\n"})}),"\n",(0,d.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86\u4F7F\u7528\u8C03\u8BD5\u5DE5\u5177\u7684\u80FD\u529B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,d.jsx)(n.code,{children:"modern dev"})," \u547D\u4EE4\u6765\u542F\u52A8\u3002\u4E0D\u8FC7\u8981\u6CE8\u610F\u7684\u662F\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u662F\u6CA1\u6709\u63D0\u4F9B\u8C03\u8BD5\u76F8\u5173\u7684\u63D2\u4EF6\uFF0C\u56E0\u6B64\u6B64\u65F6\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern dev"})," \u4F1A\u63D0\u793A\uFF1A ",(0,d.jsx)(n.em,{children:'"No dev tools found available"'}),"\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\u6709 ",(0,d.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\uFF0C\u56E0\u6B64\u5728\u4F60\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern new"})," \u547D\u4EE4\u5F00\u542F\u5B83\u540E\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern dev"})," \u6216\u8005 ",(0,d.jsx)(n.code,{children:"modern dev doc"})," \u6267\u884C\u5B83\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-test",children:[(0,d.jsx)(n.code,{children:"modern test"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-test",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern test [options]\n\nOptions:\n -u --updateSnapshot \u4F7F\u7528\u6B64\u9009\u9879\u6765\u66F4\u65B0\u5FEB\u7167\n --watch \u76D1\u89C6\u6587\u4EF6\u7684\u53D8\u66F4\u5E76\u91CD\u65B0\u8FD0\u884C\u76F8\u5173\u7684\u6D4B\u8BD5\n -h, --help \u663E\u793A\u547D\u4EE4\u5E2E\u52A9\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u9700\u8981\u5148\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern new"})," \u5F00\u542F\u6D4B\u8BD5\u529F\u80FD\uFF0C\u7136\u540E\u624D\u53EF\u4EE5\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern test"})," \u547D\u4EE4\u3002\n",(0,d.jsx)(n.code,{children:"modern test"})," \u547D\u4EE4\u4F1A\u81EA\u52A8\u5C06 ",(0,d.jsx)(n.code,{children:"tests/*.test.(js|ts|jsx|tsx)"})," \u6587\u4EF6\u5F53\u505A\u6D4B\u8BD5\u7528\u4F8B\u8FD0\u884C\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-lint",children:[(0,d.jsx)(n.code,{children:"modern lint"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-lint",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern lint [options] [...files]\n\nlint and fix source files\n\nOptions:\n --no-fix disable auto fix source file\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u8FD0\u884C ",(0,d.jsx)(n.a,{href:"https://eslint.org/",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," \u68C0\u67E5\u4EE3\u7801\u8BED\u6CD5\u60C5\u51B5\u3002\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u5728 ",(0,d.jsx)(n.code,{children:"git commit"})," \u9636\u6BB5\u901A\u8FC7 ",(0,d.jsx)(n.a,{href:"https://github.com/okonet/lint-staged",target:"_blank",rel:"noopener noreferrer",children:"lint-staged"})," \u68C0\u67E5\u672C\u6B21\u63D0\u4EA4\u4FEE\u6539\u7684\u90E8\u5206\u4EE3\u7801\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"--no-fix"})," \u53C2\u6570\u8BBE\u7F6E\u540E\u53EF\u4EE5\u5173\u95ED\u81EA\u52A8\u4FEE\u590D lint \u9519\u8BEF\u4EE3\u7801\u7684\u80FD\u529B\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-change",children:[(0,d.jsx)(n.code,{children:"modern change"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-change",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern change [options]\n\n\u521B\u5EFA\u53D8\u66F4\u96C6\n\nOptions:\n --empty \u521B\u5EFA\u7A7A\u53D8\u66F4\u96C6 (default: false)\n --open \u4F7F\u7528\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u521B\u5EFA\u7684\u53D8\u66F4\u96C6 (default: false)\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern change"})," \u547D\u4EE4\u7528\u4E8E\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"})," \u9700\u8981\u7684 Markdown \u6587\u4EF6\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-pre",children:[(0,d.jsx)(n.code,{children:"modern pre"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-pre",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern pre [options] [tag]\n\n\u8FDB\u5165\u548C\u9000\u51FA\u9884\u53D1\u5E03\u6A21\u5F0F\n\nOptions:\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"modern pre"})," \u547D\u4EE4\u5728\u6B63\u5F0F\u53D1\u5E03\u524D",(0,d.jsx)(n.a,{href:"https://github.com/atlassian/changesets/blob/main/docs/prereleases.md",target:"_blank",rel:"noopener noreferrer",children:"\u9884\u53D1\u5E03"}),"\u4E00\u4E2A\u7248\u672C\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-bump",children:[(0,d.jsx)(n.code,{children:"modern bump"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-bump",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern bump [options]\n\n\u4F7F\u7528\u53D8\u66F4\u96C6\u81EA\u52A8\u66F4\u65B0\u53D1\u5E03\u7248\u672C\u548C\u53D8\u66F4\u65E5\u5FD7\n\nOptions:\n --canary \u521B\u5EFA\u4E00\u4E2A\u9884\u53D1\u5E03\u7248\u672C\u8FDB\u884C\u6D4B\u8BD5 (default: false)\n --preid \u5728\u5BF9\u9884\u53D1\u5E03\u7248\u672C\u8FDB\u884C\u7248\u672C\u63A7\u5236\u65F6\u6307\u5B9A\u6807\u8BC6\u7B26 (default: "next")\n --snapshot \u521B\u5EFA\u4E00\u4E2A\u7279\u6B8A\u7248\u672C\u8FDB\u884C\u6D4B\u8BD5 (default: false)\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:["\u6309\u7167 ",(0,d.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"})," \u751F\u6210\u7684\u53D8\u66F4\u8BB0\u5F55\u7684 Markdown \u6587\u4EF6\u4FEE\u6539 ",(0,d.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684\u7248\u672C\u53F7\uFF0C \u540C\u65F6\u751F\u6210 ",(0,d.jsx)(n.code,{children:"CHANGELOG.md"})," \u6587\u4EF6\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-release",children:[(0,d.jsx)(n.code,{children:"modern release"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-release",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern release [options]\n\n\u53D1\u5E03 npm \u5305\n\nOptions:\n --tag \u53D1\u5E03 npm \u5305\u4F7F\u7528\u7279\u5B9A\u7684 tag (default: "")\n --ignore-scripts \u53D1\u5E03\u65F6\u5FFD\u7565 package.json \u4E2D\u7684 scripts \u547D\u4EE4\uFF0C\u4EC5\u652F\u6301\u5728 pnpm monorepo\n \u4E2D\u4F7F\u7528 (default: "")\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern release"})," \u547D\u4EE4\u53EF\u4EE5\u5C06\u6A21\u5757\u53D1\u5E03\u5230 ",(0,d.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"})," \u4E0A\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"--tag"})," \u53C2\u6570\u53EF\u4EE5\u6307\u5B9A\u53D1\u5E03\u65F6\u5177\u4F53\u7684 ",(0,d.jsx)(n.a,{href:"https://docs.npmjs.com/adding-dist-tags-to-packages",target:"_blank",rel:"noopener noreferrer",children:"dist tags"}),"\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-gen-release-note",children:[(0,d.jsx)(n.code,{children:"modern gen-release-note"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-gen-release-note",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern gen-release-note [options]\n\n\u6839\u636E\u5F53\u524D\u4ED3\u5E93 changeset \u4FE1\u606F\u751F\u6210 Release Note\n\nOptions:\n --repo \u4ED3\u5E93\u540D\u79F0\uFF0C\u7528\u4E8E\u751F\u6210 Pull Request \u94FE\u63A5\uFF0C \u4F8B\u5982\uFF1A web-infra-dev/modern.js\n --custom \u81EA\u5B9A\u4E49 Release Note \u751F\u6210\u51FD\u6570\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u6839\u636E\u5F53\u524D\u4ED3\u5E93\u7684 changeset \u4FE1\u606F\u81EA\u52A8\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Release_notes",target:"_blank",rel:"noopener noreferrer",children:"Release Note"}),"\u3002"]}),"\n",(0,d.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,d.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,d.jsx)(n.div,{className:"rspress-directive-content",children:(0,d.jsxs)(n.p,{children:["\u9700\u8981\u5728 ",(0,d.jsx)(n.code,{children:"bump"})," \u547D\u4EE4\u4E4B\u524D\u6267\u884C\u3002\n"]})})]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-upgrade",children:[(0,d.jsx)(n.code,{children:"modern upgrade"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-upgrade",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern upgrade [options]\n\n\u5347\u7EA7 Modern.js \u5230\u6700\u65B0\u7248\u672C\n\nOptions:\n --registry \u5B9A\u5236 npm registry (default: "")\n -d,--debug \u5F00\u542F Debug \u6A21\u5F0F\uFF0C\u6253\u5370\u8C03\u8BD5\u65E5\u5FD7\u4FE1\u606F (default: false)\n --cwd \u9879\u76EE\u8DEF\u5F84 (default: "")\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern upgrade"})," \u547D\u4EE4\uFF0C\u7528\u4E8E\u5347\u7EA7\u9879\u76EE Modern.js \u76F8\u5173\u4F9D\u8D56\u81F3\u6700\u65B0\u7248\u672C\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6267\u884C\u547D\u4EE4 ",(0,d.jsx)(n.code,{children:"npx modern upgrade"}),"\uFF0C\u4F1A\u9ED8\u8BA4\u5C06\u5F53\u524D\u6267\u884C\u547D\u4EE4\u9879\u76EE\u7684 ",(0,d.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684 Modern.js \u76F8\u5173\u4F9D\u8D56\u66F4\u65B0\u81F3\u6700\u65B0\u7248\u672C\u3002"]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(o,{...e})}):o(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fcommand-preview.md"]={toc:[{text:"`modern build`",id:"modern-build",depth:2},{text:"`modern new`",id:"modern-new",depth:2},{text:"`modern dev`",id:"modern-dev",depth:2},{text:"`modern test`",id:"modern-test",depth:2},{text:"`modern lint`",id:"modern-lint",depth:2},{text:"`modern change`",id:"modern-change",depth:2},{text:"`modern pre`",id:"modern-pre",depth:2},{text:"`modern bump`",id:"modern-bump",depth:2},{text:"`modern release`",id:"modern-release",depth:2},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2},{text:"`modern upgrade`",id:"modern-upgrade",depth:2}],title:"CLI \u547D\u4EE4",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file +/*! For license information please see 9176.d1a045a2.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9176"],{18393:function(e,n,r){"use strict";r.r(n);var d=r("39980"),s=r("9580");function o(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",pre:"pre",ul:"ul",li:"li",em:"em",div:"div"},(0,s.ah)(),e.components);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h1,{id:"cli-\u547D\u4EE4",children:["CLI \u547D\u4EE4",(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#cli-\u547D\u4EE4",children:"#"})]}),"\n",(0,d.jsx)(n.p,{children:"Modern.js Module \u9879\u76EE\u53EF\u4EE5\u4F7F\u7528\u7684 CLI \u547D\u4EE4\u5982\u4E0B\uFF1A"}),"\n",(0,d.jsxs)(n.h2,{id:"modern-build",children:[(0,d.jsx)(n.code,{children:"modern build"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-build",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern build [options]\n\n\u6784\u5EFA\u751F\u4EA7\u73AF\u5883\u4EA7\u7269\n\nOptions:\n -w, --watch \u4F7F\u7528\u76D1\u542C\u6A21\u5F0F\u6784\u5EFA\u4EE3\u7801\n --tsconfig [tsconfig] \u6307\u5B9A tsconfig.json \u6587\u4EF6\u7684\u8DEF\u5F84 (default:\n "./tsconfig.json")\n --platform [platform] \u6784\u5EFA\u6240\u6709\u6216\u8005\u6307\u5B9A\u5E73\u53F0\u7684\u4EA7\u7269\n --no-dts \u5173\u95ED DTS \u7C7B\u578B\u6587\u4EF6\u751F\u6210\u548C\u7C7B\u578B\u68C0\u67E5\n --no-clear \u5173\u95ED\u81EA\u52A8\u6E05\u9664\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55\u7684\u884C\u4E3A\n -c, --config \u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\uFF08default: "modern.config.j(t)s"\uFF09\n -h, --help \u5C55\u793A\u5F53\u524D\u547D\u4EE4\u7684\u4FE1\u606F\n'})}),"\n",(0,d.jsxs)(n.p,{children:["Modern.js Module \u652F\u6301 ",(0,d.jsx)(n.code,{children:"platform"})," \u6784\u5EFA\u6A21\u5F0F\uFF0C\u53EF\u4EE5\u7528\u4E8E\u6267\u884C\u5176\u4ED6\u5DE5\u5177\u7684\u6784\u5EFA\u4EFB\u52A1\uFF0C\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u6709 ",(0,d.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\u3002\u4F8B\u5982\uFF0C\u53EF\u4EE5\u901A\u8FC7\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern build --platform"})," \u547D\u4EE4\u542F\u52A8 doc \u6784\u5EFA\u4EFB\u52A1\u751F\u6210 doc \u4EA7\u7269\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-new",children:[(0,d.jsx)(n.code,{children:"modern new"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-new",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern new [options]\n\n\u542F\u7528\u53EF\u9009\u529F\u80FD\n\nOptions:\n -d, --debug \u5F00\u542F Debug \u6A21\u5F0F\uFF0C\u6253\u5370\u8C03\u8BD5\u65E5\u5FD7\u4FE1\u606F (default: false)\n -c, --config \u751F\u6210\u5668\u8FD0\u884C\u9ED8\u8BA4\u914D\u7F6E(JSON \u5B57\u7B26\u4E32)\n --dist-tag \u751F\u6210\u5668\u4F7F\u7528\u7279\u6B8A\u7684 npm Tag \u7248\u672C\n --registry \u751F\u6210\u5668\u8FD0\u884C\u8FC7\u7A0B\u4E2D\u5B9A\u5236 npm Registry\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern new"})," \u547D\u4EE4\u7528\u4E8E\u542F\u52A8\u5FAE\u751F\u6210\u5668\u529F\u80FD\uFF0C\u5B83\u53EF\u4EE5\u4E3A\u9879\u76EE\u542F\u7528\u9ED8\u8BA4\u6CA1\u6709\u63D0\u4F9B\u7684\u529F\u80FD\u3002"]}),"\n",(0,d.jsx)(n.p,{children:"\u76EE\u524D\u53EF\u4EE5\u5F00\u542F\u7684\u529F\u80FD\u6709\uFF1A"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"Test \u6D4B\u8BD5"}),"\n",(0,d.jsx)(n.li,{children:"Storybook V7"}),"\n",(0,d.jsx)(n.li,{children:"Tailwind CSS \u652F\u6301"}),"\n",(0,d.jsx)(n.li,{children:"Modern.js Runtime API"}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5173\u4E8E\u8FD9\u4E9B\u529F\u80FD\uFF0C\u53EF\u4EE5\u901A\u8FC7",(0,d.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"\u300C\u4F7F\u7528\u5FAE\u751F\u6210\u5668\u300D"})," \u7AE0\u8282\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-dev",children:[(0,d.jsx)(n.code,{children:"modern dev"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-dev",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern dev [options]\n\n\u8FD0\u884C\u548C\u8C03\u8BD5\u6A21\u5757\n\nOptions:\n -h, --help display help for command\n\nCommands:\n[dev-tools-subCommand]\n"})}),"\n",(0,d.jsxs)(n.p,{children:["Modern.js Module \u63D0\u4F9B\u4E86\u4F7F\u7528\u8C03\u8BD5\u5DE5\u5177\u7684\u80FD\u529B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,d.jsx)(n.code,{children:"modern dev"})," \u547D\u4EE4\u6765\u542F\u52A8\u3002\u4E0D\u8FC7\u8981\u6CE8\u610F\u7684\u662F\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u662F\u6CA1\u6709\u63D0\u4F9B\u8C03\u8BD5\u76F8\u5173\u7684\u63D2\u4EF6\uFF0C\u56E0\u6B64\u6B64\u65F6\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern dev"})," \u4F1A\u63D0\u793A\uFF1A ",(0,d.jsx)(n.em,{children:'"No dev tools found available"'}),"\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u76EE\u524D\u5B98\u65B9\u652F\u6301\u7684\u8C03\u8BD5\u5DE5\u5177\u6709 ",(0,d.jsx)(n.a,{href:"https://rspress.dev/",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\uFF0C\u56E0\u6B64\u5728\u4F60\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern new"})," \u547D\u4EE4\u5F00\u542F\u5B83\u540E\uFF0C\u5C31\u53EF\u4EE5\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern dev"})," \u6216\u8005 ",(0,d.jsx)(n.code,{children:"modern dev doc"})," \u6267\u884C\u5B83\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-test",children:[(0,d.jsx)(n.code,{children:"modern test"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-test",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern test [options]\n\nOptions:\n -u --updateSnapshot \u4F7F\u7528\u6B64\u9009\u9879\u6765\u66F4\u65B0\u5FEB\u7167\n --watch \u76D1\u89C6\u6587\u4EF6\u7684\u53D8\u66F4\u5E76\u91CD\u65B0\u8FD0\u884C\u76F8\u5173\u7684\u6D4B\u8BD5\n -h, --help \u663E\u793A\u547D\u4EE4\u5E2E\u52A9\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u9700\u8981\u5148\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern new"})," \u5F00\u542F\u6D4B\u8BD5\u529F\u80FD\uFF0C\u7136\u540E\u624D\u53EF\u4EE5\u6267\u884C ",(0,d.jsx)(n.code,{children:"modern test"})," \u547D\u4EE4\u3002\n",(0,d.jsx)(n.code,{children:"modern test"})," \u547D\u4EE4\u4F1A\u81EA\u52A8\u5C06 ",(0,d.jsx)(n.code,{children:"tests/*.test.(js|ts|jsx|tsx)"})," \u6587\u4EF6\u5F53\u505A\u6D4B\u8BD5\u7528\u4F8B\u8FD0\u884C\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-lint",children:[(0,d.jsx)(n.code,{children:"modern lint"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-lint",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern lint [options] [...files]\n\nlint and fix source files\n\nOptions:\n --no-fix disable auto fix source file\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u8FD0\u884C ",(0,d.jsx)(n.a,{href:"https://eslint.org/",target:"_blank",rel:"noopener noreferrer",children:"ESLint"})," \u68C0\u67E5\u4EE3\u7801\u8BED\u6CD5\u60C5\u51B5\u3002\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u5728 ",(0,d.jsx)(n.code,{children:"git commit"})," \u9636\u6BB5\u901A\u8FC7 ",(0,d.jsx)(n.a,{href:"https://github.com/okonet/lint-staged",target:"_blank",rel:"noopener noreferrer",children:"lint-staged"})," \u68C0\u67E5\u672C\u6B21\u63D0\u4EA4\u4FEE\u6539\u7684\u90E8\u5206\u4EE3\u7801\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"--no-fix"})," \u53C2\u6570\u8BBE\u7F6E\u540E\u53EF\u4EE5\u5173\u95ED\u81EA\u52A8\u4FEE\u590D lint \u9519\u8BEF\u4EE3\u7801\u7684\u80FD\u529B\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-change",children:[(0,d.jsx)(n.code,{children:"modern change"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-change",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern change [options]\n\n\u521B\u5EFA\u53D8\u66F4\u96C6\n\nOptions:\n --empty \u521B\u5EFA\u7A7A\u53D8\u66F4\u96C6 (default: false)\n --open \u4F7F\u7528\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u521B\u5EFA\u7684\u53D8\u66F4\u96C6 (default: false)\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern change"})," \u547D\u4EE4\u7528\u4E8E\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"})," \u9700\u8981\u7684 Markdown \u6587\u4EF6\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-pre",children:[(0,d.jsx)(n.code,{children:"modern pre"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-pre",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern pre [options] [tag]\n\n\u8FDB\u5165\u548C\u9000\u51FA\u9884\u53D1\u5E03\u6A21\u5F0F\n\nOptions:\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u53EF\u4EE5\u4F7F\u7528 ",(0,d.jsx)(n.code,{children:"modern pre"})," \u547D\u4EE4\u5728\u6B63\u5F0F\u53D1\u5E03\u524D",(0,d.jsx)(n.a,{href:"https://github.com/atlassian/changesets/blob/main/docs/prereleases.md",target:"_blank",rel:"noopener noreferrer",children:"\u9884\u53D1\u5E03"}),"\u4E00\u4E2A\u7248\u672C\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-bump",children:[(0,d.jsx)(n.code,{children:"modern bump"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-bump",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern bump [options]\n\n\u4F7F\u7528\u53D8\u66F4\u96C6\u81EA\u52A8\u66F4\u65B0\u53D1\u5E03\u7248\u672C\u548C\u53D8\u66F4\u65E5\u5FD7\n\nOptions:\n --canary \u521B\u5EFA\u4E00\u4E2A\u9884\u53D1\u5E03\u7248\u672C\u8FDB\u884C\u6D4B\u8BD5 (default: false)\n --preid \u5728\u5BF9\u9884\u53D1\u5E03\u7248\u672C\u8FDB\u884C\u7248\u672C\u63A7\u5236\u65F6\u6307\u5B9A\u6807\u8BC6\u7B26 (default: "next")\n --snapshot \u521B\u5EFA\u4E00\u4E2A\u7279\u6B8A\u7248\u672C\u8FDB\u884C\u6D4B\u8BD5 (default: false)\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:["\u6309\u7167 ",(0,d.jsx)(n.a,{href:"https://github.com/changesets/changesets",target:"_blank",rel:"noopener noreferrer",children:"changesets"})," \u751F\u6210\u7684\u53D8\u66F4\u8BB0\u5F55\u7684 Markdown \u6587\u4EF6\u4FEE\u6539 ",(0,d.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684\u7248\u672C\u53F7\uFF0C \u540C\u65F6\u751F\u6210 ",(0,d.jsx)(n.code,{children:"CHANGELOG.md"})," \u6587\u4EF6\u3002"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-release",children:[(0,d.jsx)(n.code,{children:"modern release"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-release",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern release [options]\n\n\u53D1\u5E03 npm \u5305\n\nOptions:\n --tag \u53D1\u5E03 npm \u5305\u4F7F\u7528\u7279\u5B9A\u7684 tag (default: "")\n --ignore-scripts \u53D1\u5E03\u65F6\u5FFD\u7565 package.json \u4E2D\u7684 scripts \u547D\u4EE4\uFF0C\u4EC5\u652F\u6301\u5728 pnpm monorepo\n \u4E2D\u4F7F\u7528 (default: "")\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern release"})," \u547D\u4EE4\u53EF\u4EE5\u5C06\u6A21\u5757\u53D1\u5E03\u5230 ",(0,d.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"})," \u4E0A\u3002"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"--tag"})," \u53C2\u6570\u53EF\u4EE5\u6307\u5B9A\u53D1\u5E03\u65F6\u5177\u4F53\u7684 ",(0,d.jsx)(n.a,{href:"https://docs.npmjs.com/adding-dist-tags-to-packages",target:"_blank",rel:"noopener noreferrer",children:"dist tags"}),"\u3002"]}),"\n"]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-gen-release-note",children:[(0,d.jsx)(n.code,{children:"modern gen-release-note"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-gen-release-note",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:"Usage: modern gen-release-note [options]\n\n\u6839\u636E\u5F53\u524D\u4ED3\u5E93 changeset \u4FE1\u606F\u751F\u6210 Release Note\n\nOptions:\n --repo \u4ED3\u5E93\u540D\u79F0\uFF0C\u7528\u4E8E\u751F\u6210 Pull Request \u94FE\u63A5\uFF0C \u4F8B\u5982\uFF1A web-infra-dev/modern.js\n --custom \u81EA\u5B9A\u4E49 Release Note \u751F\u6210\u51FD\u6570\n -h, --help display help for command\n"})}),"\n",(0,d.jsxs)(n.p,{children:["\u6839\u636E\u5F53\u524D\u4ED3\u5E93\u7684 changeset \u4FE1\u606F\u81EA\u52A8\u751F\u6210 ",(0,d.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Release_notes",target:"_blank",rel:"noopener noreferrer",children:"Release Note"}),"\u3002"]}),"\n",(0,d.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,d.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,d.jsx)(n.div,{className:"rspress-directive-content",children:(0,d.jsxs)(n.p,{children:["\u9700\u8981\u5728 ",(0,d.jsx)(n.code,{children:"bump"})," \u547D\u4EE4\u4E4B\u524D\u6267\u884C\u3002\n"]})})]}),"\n",(0,d.jsxs)(n.h2,{id:"modern-upgrade",children:[(0,d.jsx)(n.code,{children:"modern upgrade"}),(0,d.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#modern-upgrade",children:"#"})]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-bash",children:'Usage: modern upgrade [options]\n\n\u5347\u7EA7 Modern.js \u5230\u6700\u65B0\u7248\u672C\n\nOptions:\n --registry \u5B9A\u5236 npm registry (default: "")\n -d,--debug \u5F00\u542F Debug \u6A21\u5F0F\uFF0C\u6253\u5370\u8C03\u8BD5\u65E5\u5FD7\u4FE1\u606F (default: false)\n --cwd \u9879\u76EE\u8DEF\u5F84 (default: "")\n -h, --help display help for command\n'})}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"modern upgrade"})," \u547D\u4EE4\uFF0C\u7528\u4E8E\u5347\u7EA7\u9879\u76EE Modern.js \u76F8\u5173\u4F9D\u8D56\u81F3\u6700\u65B0\u7248\u672C\u3002"]}),"\n",(0,d.jsxs)(n.p,{children:["\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u6267\u884C\u547D\u4EE4 ",(0,d.jsx)(n.code,{children:"npx modern upgrade"}),"\uFF0C\u4F1A\u9ED8\u8BA4\u5C06\u5F53\u524D\u6267\u884C\u547D\u4EE4\u9879\u76EE\u7684 ",(0,d.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684 Modern.js \u76F8\u5173\u4F9D\u8D56\u66F4\u65B0\u81F3\u6700\u65B0\u7248\u672C\u3002"]})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(o,{...e})}):o(e)}n.default=a,a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fcommand-preview.md"]={toc:[{text:"`modern build`",id:"modern-build",depth:2},{text:"`modern new`",id:"modern-new",depth:2},{text:"`modern dev`",id:"modern-dev",depth:2},{text:"`modern test`",id:"modern-test",depth:2},{text:"`modern lint`",id:"modern-lint",depth:2},{text:"`modern change`",id:"modern-change",depth:2},{text:"`modern pre`",id:"modern-pre",depth:2},{text:"`modern bump`",id:"modern-bump",depth:2},{text:"`modern release`",id:"modern-release",depth:2},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2},{text:"`modern upgrade`",id:"modern-upgrade",depth:2}],title:"CLI \u547D\u4EE4",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9092.35775ebb.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9176.d1a045a2.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/9092.35775ebb.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9176.d1a045a2.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9460.40dea9c9.js b/modern-js/module-tools/static/js/async/9460.40dea9c9.js new file mode 100644 index 0000000000..6035fef5d8 --- /dev/null +++ b/modern-js/module-tools/static/js/async/9460.40dea9c9.js @@ -0,0 +1,2 @@ +/*! For license information please see 9460.40dea9c9.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9460"],{2966:function(n,e,r){"use strict";r.r(e);var i=r("39980"),o=r("9580");function d(n){let e=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",code:"code",ul:"ul",li:"li",pre:"pre",blockquote:"blockquote",h3:"h3"},(0,o.ah)(),n.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(e.h1,{id:"\u4F7F\u7528-copy-\u5DE5\u5177",children:["\u4F7F\u7528 Copy \u5DE5\u5177",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-copy-\u5DE5\u5177",children:"#"})]}),"\n",(0,i.jsx)(e.p,{children:"Modern.js Module \u63D0\u4F9B\u4E86 Copy \u5DE5\u5177\u7528\u4E8E\u5C06\u5DF2\u7ECF\u5B58\u5728\u7684\u5355\u4E2A\u6587\u4EF6\u6216\u6574\u4E2A\u76EE\u5F55\u590D\u5236\u5230\u4EA7\u7269\u76EE\u5F55\u4E2D\u3002\u63A5\u4E0B\u6765\u6211\u4EEC\u5B66\u4E60\u5982\u4F55\u4F7F\u7528\u5B83\u3002"}),"\n",(0,i.jsxs)(e.h2,{id:"\u4E86\u89E3-copy-api",children:["\u4E86\u89E3 Copy API",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E86\u89E3-copy-api",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(e.a,{href:"/api/config/build-config#copy",children:(0,i.jsx)(e.code,{children:"buildConfig.copy"})})," API \u6765\u4F7F\u7528 Copy \u5DE5\u5177\uFF0C\u5B83\u5305\u542B\u4EE5\u4E0B\u4E24\u4E2A\u4E3B\u8981\u914D\u7F6E\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/config/build-config#copypatterns",children:(0,i.jsx)(e.code,{children:"patterns"})})}),"\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"/api/config/build-config#copyoptions",children:(0,i.jsx)(e.code,{children:"options"})})}),"\n"]}),"\n",(0,i.jsxs)(e.h2,{id:"api-\u8BE6\u89E3",children:["API \u8BE6\u89E3",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#api-\u8BE6\u89E3",children:"#"})]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"copy.patterns"})," \u7528\u4E8E\u5BFB\u627E\u590D\u5236\u7684\u6587\u4EF6\u4EE5\u53CA\u914D\u7F6E\u8F93\u51FA\u7684\u8DEF\u5F84\u3002"]}),"\n",(0,i.jsxs)(e.p,{children:["\u5176\u4E2D ",(0,i.jsx)(e.code,{children:"patterns.from"})," \u7528\u4E8E\u6307\u5B9A\u8981\u590D\u5236\u7684\u6587\u4EF6\u6216\u8005\u76EE\u5F55\u3002\u5B83\u63A5\u6536 Glob \u5F62\u5F0F\u5B57\u7B26\u4E32\u6216\u5177\u4F53\u8DEF\u5F84\u3002Glob \u5F62\u5F0F\u5B57\u7B26\u4E32\u662F\u6307 ",(0,i.jsx)(e.a,{href:"https://github.com/mrmlnc/fast-glob#pattern-syntax",target:"_blank",rel:"noopener noreferrer",children:"fast-glob pattern-syntax"}),"\u3002\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u4E24\u79CD\u65B9\u5F0F\u4F7F\u7528\u5B83\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './index.html', to: '' },\n { from: './*.html', to: '' },\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"patterns.context"})," \u4E00\u822C\u548C ",(0,i.jsx)(e.code,{children:"patterns.from"})," \u914D\u5408\u4F7F\u7528\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u5B83\u7684\u503C\u4E0E ",(0,i.jsx)(e.a,{href:"/api/config/build-config#sourcedir",children:(0,i.jsx)(e.code,{children:"buildConfig.sourceDir"})})," \u76F8\u540C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u6307\u5B9A ",(0,i.jsx)(e.code,{children:"src/data.json"})," \u6587\u4EF6\u4E3A\u8981\u590D\u5236\u7684\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsxs)(e.p,{children:["\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C",(0,i.jsx)(e.code,{children:"buildConfig.sourceDir"})," \u4E3A ",(0,i.jsx)(e.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n { from: './data.json' to: ''},\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u5F53\u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5728\u6E90\u7801\u76EE\u5F55\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4FEE\u6539 ",(0,i.jsx)(e.code,{children:"context"})," \u914D\u7F6E\u3002\u4F8B\u5982\u6307\u5B9A\u9879\u76EE\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(e.code,{children:"temp/index.html"})," \u4E3A\u8981\u590D\u5236\u7684\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"import path from 'path';\n\nexport default defineConfig({\n buildConfig: {\n copy: {\n patterns: [\n {\n from: './index.html',\n context: path.join(__dirname, './temp')\n to: '',\n }\n ],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.code,{children:"patterns.to"})," \u7528\u4E8E\u6307\u5B9A\u590D\u5236\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u5B83\u7684\u503C\u4E3A ",(0,i.jsx)(e.a,{href:"/api/config/build-config#outdir",children:(0,i.jsx)(e.code,{children:"buildConfig.outDir"})}),"\u5BF9\u5E94\u7684\u503C\u3002\u56E0\u6B64\u6211\u4EEC\u6309\u7167\u5982\u4E0B\u65B9\u5F0F\u5C06 ",(0,i.jsx)(e.code,{children:"src/index.html"})," \u590D\u5236\u5230 ",(0,i.jsx)(e.code,{children:"dist"})," \u76EE\u5F55\u4E0B\uFF1A"]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './index.html' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(e.p,{children:["\u5F53\u6211\u4EEC\u914D\u7F6E\u4E86 ",(0,i.jsx)(e.code,{children:"patterns.to"})," \u7684\u65F6\u5019\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["\u5982\u679C\u662F\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u5219\u8BE5\u8DEF\u5F84\u4F1A\u76F8\u5BF9\u4E8E ",(0,i.jsx)(e.code,{children:"buildConfig.outDir"})," \u8BA1\u7B97\u51FA\u590D\u5236\u6587\u4EF6\u8F93\u51FA\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002"]}),"\n",(0,i.jsx)(e.li,{children:"\u5982\u679C\u662F\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5219\u4F1A\u76F4\u63A5\u4F7F\u7528\u8BE5\u503C\u3002"}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:["\u6700\u540E ",(0,i.jsx)(e.code,{children:"patterns.globOptions"})," \u7528\u4E8E\u914D\u7F6E\u5BFB\u627E\u590D\u5236\u6587\u4EF6 ",(0,i.jsx)(e.a,{href:"https://github.com/sindresorhus/globby",target:"_blank",rel:"noopener noreferrer",children:"globby"})," \u5BF9\u8C61\uFF0C\u5176\u914D\u7F6E\u53EF\u53C2\u8003\uFF1A"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:(0,i.jsx)(e.a,{href:"https://github.com/sindresorhus/globby#options",target:"_blank",rel:"noopener noreferrer",children:"globby.options"})}),"\n"]}),"\n",(0,i.jsxs)(e.h2,{id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",children:["\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",children:"#"})]}),"\n",(0,i.jsxs)(e.h3,{id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",children:["\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to file\n */\n {\n from: './temp-1/a.png',\n context: __dirname,\n to: './temp-1/b.png',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",children:["\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy file to dir\n */\n {\n from: './temp-2/a.png',\n context: __dirname,\n to: './temp-2',\n },\n ],\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",children:["\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to dir\n */\n {\n from: './temp-3/',\n to: './temp-3',\n context: __dirname,\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",children:["\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy dir to file\n */\n {\n from: './temp-4/',\n context: __dirname,\n to: './temp-4/_index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})}),"\n",(0,i.jsxs)(e.h3,{id:"\u4F7F\u7528-glob",children:["\u4F7F\u7528 Glob",(0,i.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528-glob",children:"#"})]}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: [\n {\n outDir: 'dist',\n copy: {\n patterns: [\n /**\n * copy glob to dir\n */\n {\n from: './*.html',\n to: './temp-5',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n {\n copy: {\n patterns: [\n /**\n * copy glob to file\n */\n {\n from: './*.html',\n to: './temp-6/index.html',\n },\n ],\n options: {\n enableCopySync: true,\n },\n },\n },\n ],\n});\n"})})]})}function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,o.ah)(),n.components);return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(d,{...n})}):d(n)}e.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fcopy.md"]={toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3}],title:"\u4F7F\u7528 Copy \u5DE5\u5177",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9602.5e9dd124.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9460.40dea9c9.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/9602.5e9dd124.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9460.40dea9c9.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9475.6320e3be.js b/modern-js/module-tools/static/js/async/9475.6320e3be.js new file mode 100644 index 0000000000..a8d30907fb --- /dev/null +++ b/modern-js/module-tools/static/js/async/9475.6320e3be.js @@ -0,0 +1,2 @@ +/*! For license information please see 9475.6320e3be.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9475"],{8747:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Ffaq-build-exception.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/978.a32834bd.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9475.6320e3be.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/978.a32834bd.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9475.6320e3be.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/9492.5b48b04b.js b/modern-js/module-tools/static/js/async/9492.5b48b04b.js deleted file mode 100644 index 29e7a79276..0000000000 --- a/modern-js/module-tools/static/js/async/9492.5b48b04b.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 9492.5b48b04b.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9492"],{35457:function(n,e,o){"use strict";o.r(e);var s=o("39980"),l=o("9580");function i(n){let e=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",code:"code",pre:"pre",h2:"h2",strong:"strong"},(0,l.ah)(),n.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(e.h1,{id:"\u63D2\u4EF6\u5BF9\u8C61",children:["\u63D2\u4EF6\u5BF9\u8C61",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u5BF9\u8C61",children:"#"})]}),"\n",(0,s.jsx)(e.p,{children:"Modern.js Module \u7684\u63D2\u4EF6\u662F\u4E00\u4E2A\u5BF9\u8C61\uFF0C\u5BF9\u8C61\u5305\u542B\u4EE5\u4E0B\u5C5E\u6027\uFF1A"}),"\n",(0,s.jsxs)(e.ul,{children:["\n",(0,s.jsxs)(e.li,{children:[(0,s.jsx)(e.code,{children:"name"}),"\uFF1A\u63D2\u4EF6\u7684\u540D\u79F0\uFF0C\u552F\u4E00\u6807\u8BC6\u7B26\u3002"]}),"\n",(0,s.jsxs)(e.li,{children:[(0,s.jsx)(e.code,{children:"setup"}),"\uFF1A\u63D2\u4EF6\u521D\u59CB\u5316\u51FD\u6570\uFF0C\u53EA\u4F1A\u6267\u884C\u4E00\u6B21\u3002setup \u51FD\u6570\u53EF\u4EE5\u8FD4\u56DE\u4E00\u4E2A Hooks \u5BF9\u8C61\uFF0CModern.js Module \u4F1A\u5728\u7279\u5B9A\u7684\u65F6\u673A\u6267\u884C Hooks \u5BF9\u8C61\u4E0A\u5B9A\u4E49\u7684 Hook \u5BF9\u5E94\u7684\u51FD\u6570\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(e.p,{children:["\u4F8B\u5982\u5728\u4E0B\u9762\u7684\u63D2\u4EF6\u4EE3\u7801\u793A\u4F8B\u4E2D\uFF0C\u5728\u9879\u76EE\u5F00\u59CB\u6267\u884C\u6784\u5EFA\u4EFB\u52A1\u4E4B\u524D\u4F1A\u89E6\u53D1 ",(0,s.jsx)(e.code,{children:"beforeBuild"})," \u51FD\u6570\u7684\u6267\u884C\uFF0C\u5E76\u6253\u5370 ",(0,s.jsx)(e.code,{children:"build start"})," \u7684 log \u5185\u5BB9\u3002"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="./plugins/demo.tsx"',children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n return {\n // this is hook\n beforeBuild: () => {\n console.info('build start');\n },\n };\n },\n};\n"})}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { myPlugin } from './plugins/demo';\nexport default {\n plugins: [myPlugin()],\n};\n"})}),"\n",(0,s.jsxs)(e.h2,{id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",children:["\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",children:"#"})]}),"\n",(0,s.jsxs)(e.p,{children:["\u4F7F\u7528 TypeScript \u65F6\uFF0C\u53EF\u4EE5\u5F15\u5165\u5185\u7F6E\u7684 ",(0,s.jsx)(e.code,{children:"CliPlugin"})," \u548C ",(0,s.jsx)(e.code,{children:"ModuleTools"})," \u7C7B\u578B\uFF0C\u4E3A\u63D2\u4EF6\u63D0\u4F9B\u6B63\u786E\u7684\u7C7B\u578B\u63A8\u5BFC\uFF1A"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nconst myPlugin: CliPlugin = {\n name: 'my-plugin',\n\n setup() {\n const foo = '1';\n\n return {\n // this is hook\n afterBuild: () => {\n //...\n },\n };\n },\n};\n"})}),"\n",(0,s.jsxs)(e.h2,{id:"\u63D2\u4EF6\u914D\u7F6E\u9879",children:["\u63D2\u4EF6\u914D\u7F6E\u9879",(0,s.jsx)(e.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E\u9879",children:"#"})]}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.strong,{children:"\u5EFA\u8BAE\u5C06\u63D2\u4EF6\u5199\u6210\u51FD\u6570\u7684\u5F62\u5F0F"}),"\uFF0C\u4F7F\u63D2\u4EF6\u80FD\u901A\u8FC7\u51FD\u6570\u5165\u53C2\u6765\u63A5\u6536\u914D\u7F6E\u9879\uFF1A"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-ts",children:"import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\ntype MyPluginOptions = {\n foo: string;\n};\n\nconst myPlugin = (options: MyPluginOptions): CliPlugin => ({\n name: 'my-plugin',\n\n setup() {\n console.log(options.foo);\n },\n});\n"})})]})}function d(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,l.ah)(),n.components);return e?(0,s.jsx)(e,{...n,children:(0,s.jsx)(i,{...n})}):i(n)}e.default=d,d.__RSPRESS_PAGE_META={},d.__RSPRESS_PAGE_META["zh%2Fplugins%2Fguide%2Fplugin-object.mdx"]={toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2}],title:"\u63D2\u4EF6\u5BF9\u8C61",frontmatter:{sidebar_position:2}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9492.5b48b04b.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9492.5b48b04b.js.LICENSE.txt deleted file mode 100644 index 365fe27962..0000000000 --- a/modern-js/module-tools/static/js/async/9492.5b48b04b.js.LICENSE.txt +++ /dev/null @@ -1,3 +0,0 @@ -/*! react/jsx-runtime */ - -/*! @mdx-js/react */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9549.c3191d68.js b/modern-js/module-tools/static/js/async/9549.c3191d68.js new file mode 100644 index 0000000000..7a0605f48b --- /dev/null +++ b/modern-js/module-tools/static/js/async/9549.c3191d68.js @@ -0,0 +1,2 @@ +/*! For license information please see 9549.c3191d68.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9549"],{4878:function(e,n,t){"use strict";t.r(n);var o=t("39980"),s=t("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,s.ah)(),e.components);return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Fpublish-emo.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9983.fc4a3f3f.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9549.c3191d68.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/9983.fc4a3f3f.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9549.c3191d68.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/952.6c5ac17e.js b/modern-js/module-tools/static/js/async/958.55859902.js similarity index 61% rename from modern-js/module-tools/static/js/async/952.6c5ac17e.js rename to modern-js/module-tools/static/js/async/958.55859902.js index f8141c269a..ade62215e3 100644 --- a/modern-js/module-tools/static/js/async/952.6c5ac17e.js +++ b/modern-js/module-tools/static/js/async/958.55859902.js @@ -1,2 +1,2 @@ -/*! For license information please see 952.6c5ac17e.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["952"],{34550:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["en%2Fcomponents%2Ffaq-build-product.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 958.55859902.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["958"],{22978:function(e,t,n){"use strict";n.r(t);var o=n("39980"),s=n("9580");function _(e){return(0,o.jsx)(o.Fragment,{})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,s.ah)(),e.components);return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(_,{...e})}):_(e)}t.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fcomponents%2Fpublish-emo.mdx"]={toc:[],title:"",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/433.b3f966b6.js.LICENSE.txt b/modern-js/module-tools/static/js/async/958.55859902.js.LICENSE.txt similarity index 75% rename from modern-js/module-tools/static/js/async/433.b3f966b6.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/958.55859902.js.LICENSE.txt index f5b91f224b..c784831ed5 100644 --- a/modern-js/module-tools/static/js/async/433.b3f966b6.js.LICENSE.txt +++ b/modern-js/module-tools/static/js/async/958.55859902.js.LICENSE.txt @@ -1,5 +1,3 @@ /*! @mdx-js/react */ -/*! @theme */ - /*! react/jsx-runtime */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9587.54a19c07.js b/modern-js/module-tools/static/js/async/9587.54a19c07.js deleted file mode 100644 index 3f441f6ab1..0000000000 --- a/modern-js/module-tools/static/js/async/9587.54a19c07.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 9587.54a19c07.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9587"],{46824:function(e,n,l){"use strict";l.r(n);var i=l("39980"),d=l("9580");function s(e){let n=Object.assign({h1:"h1",a:"a",p:"p",strong:"strong",ul:"ul",li:"li",pre:"pre",code:"code",h2:"h2",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"\u6784\u5EFA-umd-\u4EA7\u7269",children:["\u6784\u5EFA umd \u4EA7\u7269",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6784\u5EFA-umd-\u4EA7\u7269",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["umd \u5168\u79F0\u4E3A ",(0,i.jsx)(n.strong,{children:"Universal Module Definition"}),"\uFF0C\u8FD9\u79CD\u683C\u5F0F\u7684 JS \u6587\u4EF6\u53EF\u4EE5\u8FD0\u884C\u5728\u591A\u4E2A\u8FD0\u884C\u73AF\u5883\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6D4F\u89C8\u5668\u73AF\u5883\uFF1A\u57FA\u4E8E AMD \u89C4\u8303\u8FDB\u884C\u6A21\u5757\u52A0\u8F7D"}),"\n",(0,i.jsx)(n.li,{children:"Node.js \u73AF\u5883\uFF1A\u57FA\u4E8E CommonJS \u8FDB\u884C\u6A21\u5757\u52A0\u8F7D"}),"\n",(0,i.jsx)(n.li,{children:"\u5176\u4ED6\u60C5\u51B5\uFF1A\u5C06\u6A21\u5757\u6302\u8F7D\u5728\u5168\u5C40\u5BF9\u8C61\u4E0A\u3002"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4E0B\u9762\u7684\u65B9\u5F0F\uFF0C\u5C06\u9879\u76EE\u7684\u6784\u5EFA\u4EA7\u7269\u6307\u5B9A\u4E3A umd \u4EA7\u7269\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",children:["umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.a,{href:"/guide/advance/external-dependency",children:"\u300C\u5982\u4F55\u5904\u7406\u7B2C\u4E09\u65B9\u4F9D\u8D56\u300D"})," \u7AE0\u8282\u4E2D\uFF0C\u6211\u4EEC\u77E5\u9053\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#autoexternal",children:(0,i.jsx)(n.code,{children:"autoExternals"})})," \u548C ",(0,i.jsx)(n.a,{href:"/api/config/build-config#externals",children:(0,i.jsx)(n.code,{children:"externals"})})," API \u6765\u63A7\u5236\u9879\u76EE\u662F\u5426\u5BF9\u7B2C\u4E09\u65B9\u4F9D\u8D56\u6253\u5305\u3002\n\u56E0\u6B64\u5728\u6784\u5EFA umd \u4EA7\u7269\u7684\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FD9\u6837\u4F7F\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u9879\u76EE\u4F9D\u8D56\u4E86 ",(0,i.jsx)(n.code,{children:"react"}),"\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="package.json"',children:'{\n "dependencies": {\n "react": "^17"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u914D\u7F6E\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n autoExternal: false,\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6B64\u65F6\u4EA7\u7269\u4E2D\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"react"})," \u4EE3\u7801\u6253\u5305\u5230\u4EA7\u7269\u4E2D\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports, require('react'));\n else if (typeof define === 'function' && define.amd)\n define(['exports', 'react'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}), global.react);\n})(this, function (exports, _react) {\n 'use strict';\n Object.defineProperty(exports, '__esModule', {\n value: true,\n });\n _react = /*#__PURE__*/ _interopRequireDefault(_react);\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule\n ? obj\n : {\n default: obj,\n };\n }\n console.info(_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u8FC7\u4E0A\u9762\u7684\u4F8B\u5B50\u6211\u4EEC\u77E5\u9053\uFF0C\u5F53\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"autoExternal"})," \u548C ",(0,i.jsx)(n.code,{children:"externals"})," API \u540E\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5728 Node.js \u73AF\u5883\u4E0B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"require('react')"})," \u83B7\u53D6 react \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5728 \u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.react"})," \u83B7\u53D6 react \u4F9D\u8D56\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:["\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7136\u800C\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u83B7\u53D6\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u65F6\u5019\uFF0C",(0,i.jsx)(n.strong,{children:"\u5168\u5C40\u53D8\u91CF\u540D\u79F0\u4E0D\u4E00\u5B9A\u4E0E\u4F9D\u8D56\u540D\u79F0\u5B8C\u5168\u76F8\u540C"}),"\uFF0C\u6B64\u65F6\u5C31\u8981\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#umdglobals",children:(0,i.jsx)(n.code,{children:"buildConfig.umdGlobals"})})," API\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD8\u662F\u4F7F\u7528\u4E4B\u524D\u7684\u4F8B\u5B50\uFF0C\u5F53 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\u4EE5 ",(0,i.jsx)(n.code,{children:"windows.React"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:"global.React"})," \u5168\u5C40\u53D8\u91CF\u7684\u5F62\u5F0F\u5B58\u5728\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u4E0B\uFF0C\u90A3\u4E48\u6B64\u65F6\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"modern.config.ts"})," \u914D\u7F6E\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdGlobals: {\n react: 'React',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5F53\u6E90\u7801\u4E2D\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"react"})," \u4F9D\u8D56\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-tsx",meta:'title="src/index.ts"',children:"import React from 'react';\nconsole.info(React);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6B64\u65F6\u6211\u4EEC\u4F1A\u770B\u5230\u8FD9\u6837\u7684\u4EA7\u7269\u4EE3\u7801\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory();\n else if (typeof define === 'function' && define.amd) define([], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory();\n})(this, function () {\n // ...\n // libuild:globals:react\n var require_react = __commonJS({\n 'libuild:globals:react'(exports, module1) {\n module1.exports = Function('return this')()['React'];\n },\n });\n // src/index.ts\n var import_react = __toESM(require_react());\n console.info(import_react.default);\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u9879\u76EE\u5C31\u53EF\u4EE5\u8FD0\u884C\u5728\u6D4F\u89C8\u5668\u4E2D\uFF0C\u5E76\u4F7F\u7528\u5B58\u5728\u4E8E\u5168\u5C40\u5BF9\u8C61\u4E0A\u7684 ",(0,i.jsx)(n.code,{children:"React"})," \u53D8\u91CF\u4E86\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:["\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u5C06\u4E0B\u9762\u7684\u4EE3\u7801\u6253\u5305\u6210 umd \u4EA7\u7269\u5E76\u8FD0\u884C\u5728\u6D4F\u89C8\u5668\u7684\u65F6\u5019\uFF0C\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"window.index"})," \u6765\u4F7F\u7528\u8BE5\u6A21\u5757\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="./src/index.ts"',children:"export default () => {\n console.info('hello world');\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4EE5\u6E90\u7801\u6587\u4EF6\u540D\u79F0\u4F5C\u4E3A\u8BE5\u6A21\u5757\u5728\u6D4F\u89C8\u5668\u91CC\u5168\u5C40\u53D8\u91CF\u7684\u540D\u79F0"}),"\u3002\u5BF9\u4E8E\u4E0A\u9762\u7684\u4F8B\u5B50\uFF0C\u5176\u4EA7\u7269\u5185\u5BB9\u5982\u4E0B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.index = {}));\n})(this, function (exports) {\n //...\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u9700\u8981\u4FEE\u6539\u5B83\uFF0C\u5219\u9700\u8981\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"/api/config/build-config#umdmodulename",children:(0,i.jsx)(n.code,{children:"buildConfig.umdModuleName"})})," API\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u4F7F\u7528\u8BE5 API \u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u65F6\u6784\u5EFA\u4EA7\u7269\u7684\u5185\u5BB9\u4E3A\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"(function (global, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object')\n factory(exports);\n else if (typeof define === 'function' && define.amd)\n define(['exports'], factory);\n else if (\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self)\n )\n factory((global.myLib = {}));\n})(this, function (exports) {\n //...\n});\n"})})]})}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(s,{...e})}):s(e)}n.default=r,r.__RSPRESS_PAGE_META={},r.__RSPRESS_PAGE_META["zh%2Fguide%2Fadvance%2Fbuild-umd.mdx"]={toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2}],title:"\u6784\u5EFA umd \u4EA7\u7269",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9587.54a19c07.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9587.54a19c07.js.LICENSE.txt deleted file mode 100644 index 365fe27962..0000000000 --- a/modern-js/module-tools/static/js/async/9587.54a19c07.js.LICENSE.txt +++ /dev/null @@ -1,3 +0,0 @@ -/*! react/jsx-runtime */ - -/*! @mdx-js/react */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8683.7396e81f.js b/modern-js/module-tools/static/js/async/9675.0d4f59ca.js similarity index 98% rename from modern-js/module-tools/static/js/async/8683.7396e81f.js rename to modern-js/module-tools/static/js/async/9675.0d4f59ca.js index cf5fe4d9a8..ff0b93831d 100644 --- a/modern-js/module-tools/static/js/async/8683.7396e81f.js +++ b/modern-js/module-tools/static/js/async/9675.0d4f59ca.js @@ -1,2 +1,2 @@ -/*! For license information please see 8683.7396e81f.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["8683"],{54076:function(e,n,d){"use strict";d.r(n);var s=d("39980"),r=d("9580"),i=d("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",h3:"h3",pre:"pre",code:"code",div:"div",blockquote:"blockquote",ul:"ul",li:"li"},(0,r.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",children:["\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u60F3\u8981\u5B9E\u9645\u4F53\u9A8C Modern.js Module\uFF1F\u9996\u5148\u4F60\u9700\u8981\u5B89\u88C5 ",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"Node.js LTS"}),"\uFF0C\u5E76\u786E\u4FDD Node \u7248\u672C\u5927\u4E8E\u7B49\u4E8E ",(0,s.jsx)(n.strong,{children:"16.0.0"}),"\u3002\u6211\u4EEC\u63A8\u8350\u4F7F\u7528 Node.js 18 \u7684 LTS \u7248\u672C\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u521B\u5EFA\u65B0\u9879\u76EE",children:["\u521B\u5EFA\u65B0\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521B\u5EFA\u65B0\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"\u5982\u679C\u4F60\u60F3\u8981\u521B\u5EFA\u4E00\u4E2A\u5B8C\u6574\u7684 Modern.js Module \u9879\u76EE\uFF0C\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"npx @modern-js/create your-project-dir-name\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive info",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"npx @modern-js/create -h"})," \u67E5\u770B\u66F4\u591A\u547D\u4EE4\u884C\u53C2\u6570\n"]})})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u7740\u5728\u95EE\u9898\u4EA4\u4E92\u4E2D\uFF0C\u6309\u7167\u5982\u4E0B\u9009\u62E9\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"? \u8BF7\u9009\u62E9\u4F60\u60F3\u521B\u5EFA\u7684\u5DE5\u7A0B\u7C7B\u578B\uFF1ANpm \u6A21\u5757\n? \u8BF7\u586B\u5199\u9879\u76EE\u540D\u79F0\uFF1Alibrary\n? \u8BF7\u9009\u62E9\u5F00\u53D1\u8BED\u8A00\uFF1ATS\n? \u8BF7\u9009\u62E9\u5305\u7BA1\u7406\u5DE5\u5177\uFF1Apnpm\n"})}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u9879\u76EE\u540D\u79F0\u4E3A ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684 ",(0,s.jsx)(n.code,{children:'"name"'})," \u5B57\u6BB5\u503C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u7740\u5C31\u4F1A\u5F00\u59CB\u521D\u59CB\u5316\u9879\u76EE\u7684\u6D41\u7A0B\u3002\u5728\u9879\u76EE\u76EE\u5F55\u548C\u6587\u4EF6\u751F\u6210\u4EE5\u53CA\u4F9D\u8D56\u5B89\u88C5\u5B8C\u6BD5\u540E\uFF0C\u6B64\u65F6\u5C31\u521B\u5EFA\u4E86\u4E00\u4E2A\u5B8C\u6574\u7684 Modern.js Module \u9879\u76EE\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u76F4\u63A5\u6267\u884C ",(0,s.jsx)(n.code,{children:"pnpm build"})," \u547D\u4EE4\u542F\u52A8\u9879\u76EE\u7684\u6784\u5EFA\uFF0C\u6267\u884C ",(0,s.jsx)(n.code,{children:"pnpm build --watch"})," \u547D\u4EE4\u5F00\u542F\u6784\u5EFA\u7684\u89C2\u5BDF\u6A21\u5F0F\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",children:["\u63A5\u5165\u5DF2\u6709\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63A5\u5165\u5DF2\u6709\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u4F60\u7684\u9879\u76EE\u91CC\u5B89\u88C5\u4EE5\u4E0B\u4F9D\u8D56\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:'"@modern-js/module-tools"'})}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"typescript"'}),"\uFF08\u5982\u679C\u4E0D\u662F TypeScript \u9879\u76EE\uFF0C\u5219\u7701\u7565\uFF09"]}),"\n"]}),"\n","\n",(0,s.jsx)(i.SU,{command:"add @modern-js/module-tools typescript -D"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u5BF9\u4E8E\u4F7F\u7528 pnpm \u6216\u8005 Yarn \u5305\u7BA1\u7406\u5668\u7684\u9879\u76EE\uFF0C\u53EA\u9700\u8981\u66FF\u6362 npm \u5C31\u53EF\u4EE5\u4E86\u3002",(0,s.jsx)(n.strong,{children:"\u63A8\u8350\u4F7F\u7528 pnpm"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u7740\u5728\u9879\u76EE\u7684\u6839\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"modern.config.(t|j)s"})," \u6587\u4EF6\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u6700\u540E\u5728\u9879\u76EE\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u91CC\u589E\u52A0\u547D\u4EE4 ",(0,s.jsx)(n.code,{children:'"build": "modern build"'}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "build": "modern build"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u7684\u9879\u76EE\u5B58\u5728 ",(0,s.jsx)(n.code,{children:"src/index.(js|jsx)"})," \u6587\u4EF6\u6216\u8005\u540C\u65F6\u5B58\u5728 ",(0,s.jsx)(n.code,{children:"src/index.(ts|tsx)"})," \u548C ",(0,s.jsx)(n.code,{children:"tsconfig.json"})," \u6587\u4EF6\uFF0C\u90A3\u4E48\u606D\u559C\u4F60\u53EF\u4EE5\u8FD0\u884C\u76F4\u63A5\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm run build"})," \u6765\u4F7F\u7528 Modern.js Module \u6784\u5EFA\u4F60\u7684\u9879\u76EE\u4E86\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u6838\u5FC3-npm-\u5305",children:["\u6838\u5FC3 npm \u5305",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6838\u5FC3-npm-\u5305",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," \u662F Modern.js Module \u7684\u6838\u5FC3 npm \u5305\uFF0C\u4E3B\u8981\u63D0\u4F9B\u4EE5\u4E0B\u80FD\u529B\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u63D0\u4F9B ",(0,s.jsx)(n.code,{children:"modern dev"}),", ",(0,s.jsx)(n.code,{children:"modern build"})," \u7B49\u5E38\u7528\u7684 CLI \u547D\u4EE4\u3002"]}),"\n",(0,s.jsx)(n.li,{children:"\u96C6\u6210 Modern.js Core\uFF0C\u63D0\u4F9B\u914D\u7F6E\u89E3\u6790\u3001\u63D2\u4EF6\u52A0\u8F7D\u7B49\u80FD\u529B\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u96C6\u6210 esbuild \u548C SWC\uFF0C\u63D0\u4F9B\u6784\u5EFA\u80FD\u529B\u3002"}),"\n",(0,s.jsxs)(n.li,{children:["\u96C6\u6210\u4E00\u4E9B\u6700\u4E3A\u5E38\u7528\u7684\u63D2\u4EF6\uFF0C\u6BD4\u5982 ",(0,s.jsx)(n.code,{children:"plugin-lint"}),"\u3001",(0,s.jsx)(n.code,{children:"plugin-changeset"})," \u7B49\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," \u662F\u57FA\u4E8E Modern.js \u7684\u63D2\u4EF6\u4F53\u7CFB\u5B9E\u73B0\u7684\uFF0C\u672C\u8D28\u4E0A\u662F\u4E00\u4E2A\u63D2\u4EF6\uFF0C\u56E0\u6B64\u4F60\u9700\u8981\u5728\u914D\u7F6E\u6587\u4EF6\u7684 ",(0,s.jsx)(n.code,{children:"plugins"})," \u5B57\u6BB5\u4E2D\u6CE8\u518C ",(0,s.jsx)(n.code,{children:"moduleTools"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",children:["\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"\u5982\u679C\u4F60\u60F3\u8981\u770B\u770B\u4F7F\u7528\u4E86 Modern.js Module \u7684\u5B8C\u6574\u9879\u76EE\uFF0C\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/web-infra-dev/modern-js-examples\ncd modern-js-examples/examples/basic-module\n\n## \u6267\u884C\u6784\u5EFA\uFF1A\npnpm build\n\n## \u76D1\u542C\u6A21\u5F0F\u6267\u884C\u6784\u5EFA\uFF1A\npnpm build --watch\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",children:["\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u9009\u62E9\u9002\u5408\u4F60\u7684\u6559\u7A0B\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u6211\u662F\u521D\u5B66\u8005\uFF0C\u9700\u8981\u5B66\u4E60 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started",children:"\u57FA\u7840\u4F7F\u7528"}),"\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u6211\u5DF2\u7ECF\u521D\u6B65\u638C\u63E1\u4E86 Modern.js Module \u7684\u4F7F\u7528\uFF0C\u53EF\u4EE5\u5B66\u4E60 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u8FDB\u9636\u6307\u5357"}),"\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u6211\u9700\u8981\u6269\u5C55\u9879\u76EE\u80FD\u529B\uFF0C\u9700\u8981\u5B66\u4E60\u5982\u4F55\u5F00\u53D1 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"\u63D2\u4EF6"}),"\u3002"]}),"\n"]})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fguide%2Fintro%2Fgetting-started.mdx"]={toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2}],title:"\u5FEB\u901F\u5F00\u59CB",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file +/*! For license information please see 9675.0d4f59ca.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9675"],{54257:function(e,n,d){"use strict";d.r(n);var s=d("39980"),r=d("9580"),i=d("23657");function l(e){let n=Object.assign({h1:"h1",a:"a",h2:"h2",p:"p",strong:"strong",h3:"h3",pre:"pre",code:"code",div:"div",blockquote:"blockquote",ul:"ul",li:"li"},(0,r.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5FEB\u901F\u5F00\u59CB",children:["\u5FEB\u901F\u5F00\u59CB",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5FEB\u901F\u5F00\u59CB",children:"#"})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",children:["\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u60F3\u8981\u5B9E\u9645\u4F53\u9A8C Modern.js Module\uFF1F\u9996\u5148\u4F60\u9700\u8981\u5B89\u88C5 ",(0,s.jsx)(n.a,{href:"https://github.com/nodejs/Release",target:"_blank",rel:"noopener noreferrer",children:"Node.js LTS"}),"\uFF0C\u5E76\u786E\u4FDD Node \u7248\u672C\u5927\u4E8E\u7B49\u4E8E ",(0,s.jsx)(n.strong,{children:"16.0.0"}),"\u3002\u6211\u4EEC\u63A8\u8350\u4F7F\u7528 Node.js 18 \u7684 LTS \u7248\u672C\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u521B\u5EFA\u65B0\u9879\u76EE",children:["\u521B\u5EFA\u65B0\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u521B\u5EFA\u65B0\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"\u5982\u679C\u4F60\u60F3\u8981\u521B\u5EFA\u4E00\u4E2A\u5B8C\u6574\u7684 Modern.js Module \u9879\u76EE\uFF0C\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"npx @modern-js/create your-project-dir-name\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive info",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u6267\u884C ",(0,s.jsx)(n.code,{children:"npx @modern-js/create -h"})," \u67E5\u770B\u66F4\u591A\u547D\u4EE4\u884C\u53C2\u6570\n"]})})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u7740\u5728\u95EE\u9898\u4EA4\u4E92\u4E2D\uFF0C\u6309\u7167\u5982\u4E0B\u9009\u62E9\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"? \u8BF7\u9009\u62E9\u4F60\u60F3\u521B\u5EFA\u7684\u5DE5\u7A0B\u7C7B\u578B\uFF1ANpm \u6A21\u5757\n? \u8BF7\u586B\u5199\u9879\u76EE\u540D\u79F0\uFF1Alibrary\n? \u8BF7\u9009\u62E9\u5F00\u53D1\u8BED\u8A00\uFF1ATS\n? \u8BF7\u9009\u62E9\u5305\u7BA1\u7406\u5DE5\u5177\uFF1Apnpm\n"})}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u9879\u76EE\u540D\u79F0\u4E3A ",(0,s.jsx)(n.code,{children:"package.json"})," \u4E2D\u7684 ",(0,s.jsx)(n.code,{children:'"name"'})," \u5B57\u6BB5\u503C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u7740\u5C31\u4F1A\u5F00\u59CB\u521D\u59CB\u5316\u9879\u76EE\u7684\u6D41\u7A0B\u3002\u5728\u9879\u76EE\u76EE\u5F55\u548C\u6587\u4EF6\u751F\u6210\u4EE5\u53CA\u4F9D\u8D56\u5B89\u88C5\u5B8C\u6BD5\u540E\uFF0C\u6B64\u65F6\u5C31\u521B\u5EFA\u4E86\u4E00\u4E2A\u5B8C\u6574\u7684 Modern.js Module \u9879\u76EE\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u76F4\u63A5\u6267\u884C ",(0,s.jsx)(n.code,{children:"pnpm build"})," \u547D\u4EE4\u542F\u52A8\u9879\u76EE\u7684\u6784\u5EFA\uFF0C\u6267\u884C ",(0,s.jsx)(n.code,{children:"pnpm build --watch"})," \u547D\u4EE4\u5F00\u542F\u6784\u5EFA\u7684\u89C2\u5BDF\u6A21\u5F0F\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",children:["\u63A5\u5165\u5DF2\u6709\u9879\u76EE",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63A5\u5165\u5DF2\u6709\u9879\u76EE",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u4F60\u7684\u9879\u76EE\u91CC\u5B89\u88C5\u4EE5\u4E0B\u4F9D\u8D56\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:'"@modern-js/module-tools"'})}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:'"typescript"'}),"\uFF08\u5982\u679C\u4E0D\u662F TypeScript \u9879\u76EE\uFF0C\u5219\u7701\u7565\uFF09"]}),"\n"]}),"\n","\n",(0,s.jsx)(i.SU,{command:"add @modern-js/module-tools typescript -D"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u5BF9\u4E8E\u4F7F\u7528 pnpm \u6216\u8005 Yarn \u5305\u7BA1\u7406\u5668\u7684\u9879\u76EE\uFF0C\u53EA\u9700\u8981\u66FF\u6362 npm \u5C31\u53EF\u4EE5\u4E86\u3002",(0,s.jsx)(n.strong,{children:"\u63A8\u8350\u4F7F\u7528 pnpm"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u7740\u5728\u9879\u76EE\u7684\u6839\u76EE\u5F55\u4E0B\u521B\u5EFA ",(0,s.jsx)(n.code,{children:"modern.config.(t|j)s"})," \u6587\u4EF6\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u6700\u540E\u5728\u9879\u76EE\u7684 ",(0,s.jsx)(n.code,{children:"package.json"})," \u6587\u4EF6\u91CC\u589E\u52A0\u547D\u4EE4 ",(0,s.jsx)(n.code,{children:'"build": "modern build"'}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "scripts": {\n "build": "modern build"\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u7684\u9879\u76EE\u5B58\u5728 ",(0,s.jsx)(n.code,{children:"src/index.(js|jsx)"})," \u6587\u4EF6\u6216\u8005\u540C\u65F6\u5B58\u5728 ",(0,s.jsx)(n.code,{children:"src/index.(ts|tsx)"})," \u548C ",(0,s.jsx)(n.code,{children:"tsconfig.json"})," \u6587\u4EF6\uFF0C\u90A3\u4E48\u606D\u559C\u4F60\u53EF\u4EE5\u8FD0\u884C\u76F4\u63A5\u8FD0\u884C ",(0,s.jsx)(n.code,{children:"npm run build"})," \u6765\u4F7F\u7528 Modern.js Module \u6784\u5EFA\u4F60\u7684\u9879\u76EE\u4E86\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u6838\u5FC3-npm-\u5305",children:["\u6838\u5FC3 npm \u5305",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6838\u5FC3-npm-\u5305",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," \u662F Modern.js Module \u7684\u6838\u5FC3 npm \u5305\uFF0C\u4E3B\u8981\u63D0\u4F9B\u4EE5\u4E0B\u80FD\u529B\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u63D0\u4F9B ",(0,s.jsx)(n.code,{children:"modern dev"}),", ",(0,s.jsx)(n.code,{children:"modern build"})," \u7B49\u5E38\u7528\u7684 CLI \u547D\u4EE4\u3002"]}),"\n",(0,s.jsx)(n.li,{children:"\u96C6\u6210 Modern.js Core\uFF0C\u63D0\u4F9B\u914D\u7F6E\u89E3\u6790\u3001\u63D2\u4EF6\u52A0\u8F7D\u7B49\u80FD\u529B\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u96C6\u6210 esbuild \u548C SWC\uFF0C\u63D0\u4F9B\u6784\u5EFA\u80FD\u529B\u3002"}),"\n",(0,s.jsxs)(n.li,{children:["\u96C6\u6210\u4E00\u4E9B\u6700\u4E3A\u5E38\u7528\u7684\u63D2\u4EF6\uFF0C\u6BD4\u5982 ",(0,s.jsx)(n.code,{children:"plugin-lint"}),"\u3001",(0,s.jsx)(n.code,{children:"plugin-changeset"})," \u7B49\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"@modern-js/module-tools"})," \u662F\u57FA\u4E8E Modern.js \u7684\u63D2\u4EF6\u4F53\u7CFB\u5B9E\u73B0\u7684\uFF0C\u672C\u8D28\u4E0A\u662F\u4E00\u4E2A\u63D2\u4EF6\uFF0C\u56E0\u6B64\u4F60\u9700\u8981\u5728\u914D\u7F6E\u6587\u4EF6\u7684 ",(0,s.jsx)(n.code,{children:"plugins"})," \u5B57\u6BB5\u4E2D\u6CE8\u518C ",(0,s.jsx)(n.code,{children:"moduleTools"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n});\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",children:["\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"\u5982\u679C\u4F60\u60F3\u8981\u770B\u770B\u4F7F\u7528\u4E86 Modern.js Module \u7684\u5B8C\u6574\u9879\u76EE\uFF0C\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4"}),"\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/web-infra-dev/modern-js-examples\ncd modern-js-examples/examples/basic-module\n\n## \u6267\u884C\u6784\u5EFA\uFF1A\npnpm build\n\n## \u76D1\u542C\u6A21\u5F0F\u6267\u884C\u6784\u5EFA\uFF1A\npnpm build --watch\n"})}),"\n",(0,s.jsxs)(n.h2,{id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",children:["\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u9009\u62E9\u9002\u5408\u4F60\u7684\u6559\u7A0B\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u6211\u662F\u521D\u5B66\u8005\uFF0C\u9700\u8981\u5B66\u4E60 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/guide/basic/before-getting-started",children:"\u57FA\u7840\u4F7F\u7528"}),"\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u6211\u5DF2\u7ECF\u521D\u6B65\u638C\u63E1\u4E86 Modern.js Module \u7684\u4F7F\u7528\uFF0C\u53EF\u4EE5\u5B66\u4E60 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/guide/advance/in-depth-about-build",children:"\u8FDB\u9636\u6307\u5357"}),"\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u6211\u9700\u8981\u6269\u5C55\u9879\u76EE\u80FD\u529B\uFF0C\u9700\u8981\u5B66\u4E60\u5982\u4F55\u5F00\u53D1 Modern.js Module \u7684",(0,s.jsx)(n.a,{href:"/plugins/guide/getting-started",children:"\u63D2\u4EF6"}),"\u3002"]}),"\n"]})]})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.default=c,c.__RSPRESS_PAGE_META={},c.__RSPRESS_PAGE_META["zh%2Fguide%2Fintro%2Fgetting-started.mdx"]={toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2}],title:"\u5FEB\u901F\u5F00\u59CB",frontmatter:{sidebar_position:3}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/7524.842b2e3f.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9675.0d4f59ca.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/7524.842b2e3f.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9675.0d4f59ca.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/7586.184e82bf.js b/modern-js/module-tools/static/js/async/9697.411c4dcd.js similarity index 99% rename from modern-js/module-tools/static/js/async/7586.184e82bf.js rename to modern-js/module-tools/static/js/async/9697.411c4dcd.js index 3fd7d1b512..851b2452bf 100644 --- a/modern-js/module-tools/static/js/async/7586.184e82bf.js +++ b/modern-js/module-tools/static/js/async/9697.411c4dcd.js @@ -1,2 +1,2 @@ -/*! For license information please see 7586.184e82bf.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["7586"],{32195:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",h3:"h3",ol:"ol",li:"li",pre:"pre",code:"code",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",img:"img",div:"div",ul:"ul",h4:"h4",strong:"strong"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:["\u5F00\u53D1\u6A21\u5757\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u5982\u4F55\u4E3A\u6A21\u5757\u9879\u76EE\u5FEB\u901F\u642D\u5EFA\u4E00\u4E2A\u9759\u6001\u6587\u6863\u7AD9\u70B9\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u5F00\u59CB\u4E4B\u524D",children:["\u5F00\u59CB\u4E4B\u524D",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u59CB\u4E4B\u524D",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",children:["\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",children:"#"})]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"\u6587\u6863\u7AD9\u70B9\u53EF\u4EE5\u5E2E\u52A9\u6211\u4EEC\u66F4\u597D\u5730\u7EC4\u7EC7\u6587\u6863\u7684\u7ED3\u6784\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u6587\u6863\u7AD9\u70B9\u5177\u6709\u66F4\u597D\u7684\u8868\u73B0\u5F62\u5F0F\uFF0C\u4F8B\u5982\u53EF\u4EE5\u5728\u9875\u9762\u4E2D\u6267\u884C\u51FD\u6570\uFF0C\u6E32\u67D3\u7EC4\u4EF6\u7B49\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u53EF\u4EE5\u66F4\u597D\u5730\u5229\u7528 AI \u641C\u7D22\u7684\u80FD\u529B\u3002"}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u524D\u7F6E\u51C6\u5907",children:["\u524D\u7F6E\u51C6\u5907",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u524D\u7F6E\u51C6\u5907",children:"#"})]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u901A\u8FC7",(0,s.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"\u5FAE\u751F\u6210\u5668"}),"\u5F00\u542F\u6587\u6863\u529F\u80FD\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u9605\u8BFB",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/start/introduction.html",target:"_blank",rel:"noopener noreferrer",children:"Rspress \u4ECB\u7ECD"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5B8C\u6210\u51C6\u5907\u5DE5\u4F5C\u4E4B\u540E\uFF0C\u63A5\u4E0B\u6765\u6211\u4EEC\u4F1A\u57FA\u4E8E Rspress \u4E3A\u6A21\u5757\u9879\u76EE\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",children:["\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u7AD9\u70B9\u6574\u4F53\u5E03\u5C40\u7531\u4E09\u90E8\u5206\u7EC4\u6210\uFF1A\u5BFC\u822A\u680F\u3001\u4FA7\u8FB9\u680F\u4EE5\u53CA\u6B63\u6587\u90E8\u5206\uFF0C\u5176\u4E2D\u6B63\u6587\u8FD8\u5305\u62EC\u4E86 TOC(Table of contents found at the beginning of a book or document)\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["Rspress \u4F7F\u7528\u7684\u662F",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/conventional-route.html",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u7531"}),"\uFF0C\u6A21\u5757\u6587\u6863\u57FA\u4E8E\u6B64\u5B9E\u73B0\u4E86\u4FA7\u8FB9\u680F\u7684\u81EA\u52A8\u751F\u6210\u3002\n\u4F8B\u5982\uFF0C\u5982\u679C\u4F60\u6709\u4EE5\u4E0B\u7684\u6587\u4EF6\u7ED3\u6784\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 foo\n\u2502 \u2514\u2500\u2500 bar.md\n\u2502 \u2514\u2500\u2500 index.md\n\u2514\u2500\u2500 foo.md\n\u2514\u2500\u2500 index.md\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u90A3\u4E48 ",(0,s.jsx)(n.code,{children:"foo/bar.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/foo/bar"}),"\uFF0C",(0,s.jsx)(n.code,{children:"foo.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/foo"}),"\uFF0C",(0,s.jsx)(n.code,{children:"index.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/"}),"\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u5177\u4F53\u6620\u5C04\u89C4\u5219\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsxs)(n.table,{children:["\n",(0,s.jsxs)(n.thead,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.th,{children:"\u6587\u4EF6\u8DEF\u5F84"}),"\n",(0,s.jsx)(n.th,{children:"\u8DEF\u7531\u8DEF\u5F84"}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.tbody,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"index.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/index.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/bar.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/bar"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u4E0E\u4E0A\u8FF0\u6587\u4EF6\u8DEF\u5F84\u548C\u8DEF\u7531\u8DEF\u5F84\u4F9D\u6B21\u5BF9\u5E94\u7684\u4FA7\u8FB9\u680F\u5982\u4E0B\u6240\u793A\uFF1A"}),"\n",(0,s.jsx)("img",{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/rpauheh7nulwbm/edenx-module/docs-blog/autosidebar.png"}),"\n",(0,s.jsxs)(n.h3,{id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",children:["\u914D\u7F6E\u4FA7\u8FB9\u680F",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u4FA7\u8FB9\u680F",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u4E0A\u56FE\u6240\u793A\uFF0C\u6A21\u5757\u6587\u6863\u5DF2\u7ECF\u4E3A\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u7531\u81EA\u52A8\u751F\u6210\u4E86\u4FA7\u8FB9\u680F\uFF0C\u5176\u4E2D\u4FA7\u8FB9\u680F\u6BCF\u4E00\u680F\u7684\u6587\u672C\u662F\u7531\u6587\u4EF6\u7684\u4E00\u7EA7\u6807\u9898\u6216\u8005\u76EE\u5F55\u540D\u51B3\u5B9A\u3002\n\u5982\u679C\u4F60\u9700\u8981\u81EA\u5B9A\u4E49\u4FA7\u8FB9\u680F\uFF0C\u8BF7\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"})," \u6216\u8005\u76F4\u63A5\u914D\u7F6E ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"}),"\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive info",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5982\u679C\u4F60\u7684\u6587\u6863\u76EE\u5F55\u7ED3\u6784\u662F\u7B26\u5408\u56FD\u9645\u5316\u7684\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 en\n\u2502 \u251C\u2500\u2500 button.mdx\n\u2502 \u251C\u2500\u2500 index.mdx\n\u2514\u2500\u2500 zh\n \u251C\u2500\u2500 button.mdx\n \u251C\u2500\u2500 index.mdx\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4F60\u9700\u8981\u6309\u7167",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"\u56FD\u9645\u5316"}),"\u7AE0\u8282\uFF0C\u540C\u65F6\u914D\u7F6E ",(0,s.jsx)(n.code,{children:"lang"})," \u548C ",(0,s.jsx)(n.code,{children:"locales"}),"\uFF0C\u5426\u5219\u6A21\u5757\u81EA\u52A8\u751F\u6210\u7684\u4FA7\u8FB9\u680F\u4E0D\u4F1A\u5904\u7406 ",(0,s.jsx)(n.code,{children:"zh"})," \u548C ",(0,s.jsx)(n.code,{children:"en"})," \u8FD9\u4E24\u4E2A\u76EE\u5F55\u3002\n"]})]})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7F16\u5199\u6587\u6863",children:["\u7F16\u5199\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7F16\u5199\u6587\u6863",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u53EF\u4EE5\u4E13\u6CE8\u4E8E\u6587\u6863\u5185\u5BB9\u7684\u7F16\u5199\u4E86\u3002\u9664\u4E86\u6700\u57FA\u672C\u7684\u7F16\u5199 markdown \u4EE5\u5916\uFF0C\u4F60\u53EF\u80FD\u8FD8\u9700\u8981\u4E86\u89E3\u4EE5\u4E0B\u8FDB\u9636\u5185\u5BB9\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/use-mdx.html",target:"_blank",rel:"noopener noreferrer",children:"\u4F7F\u7528 MDX"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/static-assets.html",target:"_blank",rel:"noopener noreferrer",children:"\u4F7F\u7528\u9759\u6001\u8D44\u6E90"})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7EC4\u4EF6\u9884\u89C8",children:["\u7EC4\u4EF6\u9884\u89C8",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7EC4\u4EF6\u9884\u89C8",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u6A21\u5757\u6587\u6863\u4E3A\u7EC4\u4EF6\u5E93\u63D0\u4F9B\u4E86\u9884\u89C8\u80FD\u529B\uFF0C",(0,s.jsx)(n.code,{children:"jsx"}),"\u548C",(0,s.jsx)(n.code,{children:"tsx"}),"\u7684\u4EE3\u7801\u5757\u91CC\u7684\u5185\u5BB9\u5C06\u4F1A\u88AB\u89E3\u6790\u4E3A React \u7EC4\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5047\u8BBE\u6211\u4EEC\u7684\u9879\u76EE\u540D\u662F",(0,s.jsx)(n.code,{children:"demo"}),"\uFF0C\u5E76\u5BFC\u51FA\u4E86\u4E00\u4E2A Button \u7EC4\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u9996\u5148\u65B0\u589E ",(0,s.jsx)(n.code,{children:"docs/Button.mdx"})," \u6587\u4EF6\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",meta:'title="Button.mdx"',children:"# Button\n\n## \u57FA\u672C\u7528\u6CD5\n\n\u6309\u94AE\u5206\u4E3A\uFF1A \u5C0F\u3001\u4E2D\u3001\u5927\u56DB\u79CD\u5C3A\u5BF8\n\n```tsx\nimport React from 'react';\nimport { Button } from 'demo';\n\nexport default () => {\n return ;\n};\n```\n"})}),"\n",(0,s.jsxs)(n.ol,{start:"2",children:["\n",(0,s.jsxs)(n.li,{children:["\u5728",(0,s.jsx)(n.code,{children:"tsconfig.json"}),"\u91CC\u914D\u7F6E\u522B\u540D\uFF0C\u5C06\u5305\u540D\u6307\u5411\u5F53\u524D\u9879\u76EE\u76EE\u5F55\uFF0C\u4F7F\u5F97\u6587\u6863\u5F00\u53D1\u8005\u548C\u7528\u6237\u4F7F\u7528\u7EC4\u4EF6\u65B9\u5F0F\u4E00\u81F4\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="tsconfig.json"',children:'{\n "compilerOptions": {\n "paths": {\n "demo": ["."]\n }\n }\n}\n'})}),"\n",(0,s.jsxs)(n.ol,{start:"3",children:["\n",(0,s.jsxs)(n.li,{children:["\u5728 ",(0,s.jsx)(n.code,{children:".gitignore"})," \u6587\u4EF6\u4E0B\u6DFB\u52A0 ",(0,s.jsx)(n.code,{children:"doc_build/"}),"\uFF0C\u6587\u6863\u4EA7\u7269\u5C06\u4F1A\u751F\u6210\u5728\u6B64\u76EE\u5F55\u4E0B\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",meta:'title=".gitignore"',children:"doc_build/\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u606D\u559C\u4F60\uFF0C\u5DF2\u7ECF\u5B8C\u6210\u4E86\u4E00\u4E2A\u7EC4\u4EF6\u6587\u6863\u7684\u7F16\u5199\uFF0C\u6267\u884C",(0,s.jsx)(n.code,{children:"pnpm run dev"}),"\u770B\u770B\u6548\u679C\u5427\uFF0C\u8BB0\u5F97\u5148\u6784\u5EFA\u4E00\u4E0B\u7EC4\u4EF6\u5E93\uFF0C\u786E\u4FDD\u7EC4\u4EF6\u4EA7\u7269\u5B58\u5728\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u79FB\u52A8\u7AEF\u9884\u89C8",children:["\u79FB\u52A8\u7AEF\u9884\u89C8",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u79FB\u52A8\u7AEF\u9884\u89C8",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u540C\u65F6\uFF0C\u6211\u4EEC\u4E5F\u652F\u6301\u4E86\u79FB\u52A8\u7AEF\u9884\u89C8\u7684\u65B9\u5F0F\uFF0C\u5373\u4F7F\u7528 iframe \u6E32\u67D3\u79FB\u52A8\u7AEF\u7EC4\u4EF6\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"iframePosition"})," \u8BBE\u7F6E iframe \u7684\u4F4D\u7F6E\uFF0C\u652F\u6301\u626B\u7801\u9884\u89C8\u4EE5\u53CA\u65B0\u9875\u9762\u6253\u5F00\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n /**\n * \u9009\u62E9\u9884\u89C8\u65B9\u5F0F\n * @default internal\n */\n previewMode: 'iframe',\n /**\n * \u8BBE\u7F6E iframe \u7684\u4F4D\u7F6E\n * @default 'follow'\n */\n iframePosition: 'fixed',\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsxs)(n.p,{children:["\u5982\u679C\u53EA\u60F3\u8981\u6539\u53D8\u67D0\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"jsx"})," \u548C ",(0,s.jsx)(n.code,{children:"tsx"})," \u4EE3\u7801\u5757\u7684\u9884\u89C8\u65B9\u5F0F\uFF0C\u53EF\u4EE5\u4F7F\u7528\u4E0D\u540C\u7684\u4FEE\u9970\u7B26\u8FDB\u884C\u6807\u8BC6\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:"```jsx pure\n// \u8FD9\u91CC\u7684\u5185\u5BB9\u4E0D\u4F1A\u88AB\u6E32\u67D3\n```\n\n```jsx internal\n// \u5185\u7F6E\u5728\u6587\u6863\u5185\u5BB9\u91CC\u6E32\u67D3\n```\n\n```jsx iframe\n// \u4F7F\u7528 iframe \u6E32\u67D3\n```\n"})}),"\n"]})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u4F7F\u7528\u5916\u90E8-demo",children:["\u4F7F\u7528\u5916\u90E8 demo",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5916\u90E8-demo",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u6211\u4EEC\u7684 demo \u975E\u5E38\u590D\u6742\uFF0C\u90A3\u4E48\u5EFA\u8BAE\u5355\u72EC\u7F16\u5199 demo\uFF0C\u7136\u540E\u5728 MDX \u4E2D\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"code"})," \u6807\u7B7E\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,s.jsx)(n.p,{children:"\u8FD9\u540C\u6837\u652F\u6301\u5355\u72EC\u8BBE\u7F6E\u4EE3\u7801\u5757\u7684\u9884\u89C8\u65B9\u5F0F\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,s.jsxs)(n.h2,{id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",children:["\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63D2\u4EF6\u5185\u90E8\u5B9E\u73B0\u4E86\u4E00\u90E8\u5206\u5185\u7F6E\u7EC4\u4EF6\uFF0C\u4EE5\u4FBF\u4E8E\u4F60\u53EF\u4EE5\u66F4\u8F7B\u677E\u5730\u5F00\u53D1\u6A21\u5757\u6587\u6863\u3002"}),"\n",(0,s.jsxs)(n.h3,{id:"api",children:["API",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5C55\u793A\u6A21\u5757\u7684 API \u5185\u5BB9"}),"\n",(0,s.jsxs)(n.h4,{id:"\u89E3\u6790\u6587\u4EF6",children:["\u89E3\u6790\u6587\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u89E3\u6790\u6587\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u4F7F\u7528 API \u7EC4\u4EF6\u4E4B\u524D\uFF0C\u9996\u5148\u6211\u4EEC\u9700\u8981\u6307\u5B9A\u89E3\u6790\u7684\u6587\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n Button: './src/button.tsx',\n },\n apiParseTool: 'react-docgen-typescript',\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h4,{id:"\u5185\u5BB9\u751F\u6210",children:["\u5185\u5BB9\u751F\u6210",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5185\u5BB9\u751F\u6210",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u4E86\u89E3\u4E00\u4E0B\u6839\u636E\u89E3\u6790\u7684\u6587\u4EF6\u4F1A\u751F\u6210\u4EC0\u4E48\u6837\u7684 markdown \u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u5185\u5BB9\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.a,{href:"https://github.com/styleguidist/react-docgen-typescript",target:"_blank",rel:"noopener noreferrer",children:"react-docgen-typescript"})," \u6216\u8005 ",(0,s.jsx)(n.a,{href:"https://github.com/documentationjs/documentation",target:"_blank",rel:"noopener noreferrer",children:"documentation"})," \u4E24\u4E2A\u4E0D\u540C\u7684\u5DE5\u5177\u751F\u6210\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"react-docgen-typescript"}),"\u9488\u5BF9\u4E8E\u7EC4\u4EF6\u5E93\u573A\u666F\uFF0C\u4EC5\u4F1A\u89E3\u6790 props \u751F\u6210\u8868\u683C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"export type ButtonProps = {\n /**\n * Whether to disable the button\n */\n disabled?: boolean;\n /**\n * Type of Button\n * @default 'default'\n */\n size?: 'mini' | 'small' | 'default' | 'large';\n};\nexport const Button = (props?: ButtonProps) => {};\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4E0A\u9762\u662F\u4E00\u4E2A\u6807\u51C6\u5199\u6CD5\uFF0C\u5176\u4E2D ",(0,s.jsx)(n.code,{children:"ButtonProps"})," \u5C06\u88AB\u63D0\u53D6\u81F3\u8868\u683C\u4E2D\uFF0C ",(0,s.jsx)(n.code,{children:"Button"})," \u4F5C\u4E3A\u8868\u683C\u7684\u6807\u9898\u3002\u5982\u679C\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\uFF0C\u6587\u4EF6\u540D\u5C06\u4F5C\u4E3A\u8868\u683C\u6807\u9898\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u9700\u8981\u6CE8\u610F\u7684\u662F\uFF0Cexport \u5BFC\u51FA\u4E8B\u5148\u5B9A\u4E49\u7684\u7279\u6027\u5C06\u4E0D\u4F1A\u88AB\u89E3\u6790\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"const A = () => {};\n\nexport { A }; // wrong\nexport default A; // wrong\nexport const B = () => {}; // right\nexport default () => {}; // right\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u751F\u6210\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'### ButtonTest\n\n| \u5C5E\u6027 | \u8BF4\u660E | \u7C7B\u578B | \u9ED8\u8BA4\u503C |\n| :------: | :---------------------------: | :-----------------------------------------: | :---------: |\n| disabled | Whether to disable the button | `boolean` | `-` |\n| size | Type of Button | `"mini" \\| "small" \\| "default" \\| "large"` | `\'default\'` |\n'})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5982\u679C Props \u91CC\u4F7F\u7528\u4E86 React \u7684\u7C7B\u578B\uFF0C\u4F60\u9700\u8981\u5728 tsconfig.json \u91CC\u6DFB\u52A0 types \uFF0C\u5426\u5219\u4F1A\u89E3\u6790\u4E0D\u5230 React \u547D\u540D\u7A7A\u95F4\u4E0B\u7684\u7C7B\u578B\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "compilerOptions": {\n "types": ["react"]\n }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"\u66F4\u597D\u7684\u65B9\u5F0F\u662F\u76F4\u63A5\u5F15\u7528\u7C7B\u578B\uFF0C\u4F8B\u5982"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"import { FC } from 'react';\n"})}),"\n"]})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"documentation"}),"\u9002\u7528\u4E8E\u5DE5\u5177\u5E93\u573A\u666F\uFF0C\u7528\u6765\u89E3\u6790 JSDoc \u6CE8\u91CA\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"/**\n * Greet function that returns a greeting message.\n * @param {string} name - The name of the person to greet.\n * @param {string} [greeting='Hello'] - The greeting to use.\n * @returns {string} The greeting message.\n */\nfunction greet(name: string, greeting = 'Hello') {\n return `${greeting}, ${name}!`;\n}\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u4E0A\u9762\u662F\u4E00\u4E2A\u5E26\u6709 JSDoc \u6CE8\u91CA\u7684 greet \u51FD\u6570\u3002\u751F\u6210\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-md",children:"\x3c!-- Generated by documentation.js. Update this documentation by updating the source code. --\x3e\n\n## greet\n\nGreet function that returns a greeting message.\n\n### Parameters\n\n- `name` **[string][1]** The name of the person to greet.\n- `greeting` **[string][1]** The greeting to use. (optional, default `'Hello'`)\n\nReturns **[string][1]** The greeting message.\n\n[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n"})}),"\n",(0,s.jsxs)(n.h4,{id:"\u7EC4\u4EF6\u4F7F\u7528",children:["\u7EC4\u4EF6\u4F7F\u7528",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7EC4\u4EF6\u4F7F\u7528",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u4E0B\u6765\uFF0C\u4F60\u4FBF\u53EF\u4EE5\u5728\u6587\u6863\u91CC\u4F7F\u7528\u6211\u4EEC\u7684\u5185\u7F6E API \u7EC4\u4EF6\u4E86\uFF0C\u5C06",(0,s.jsx)(n.code,{children:"key"}),"\u503C\u4F20\u5165",(0,s.jsx)(n.code,{children:"moduleName"}),"\u5C5E\u6027\u91CC"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",meta:'title="Button.mdx"',children:'# Button\n\n## API\n\n\n'})}),"\n",(0,s.jsxs)(n.h3,{id:"overview",children:["Overview",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5C55\u793A\u6A21\u5757\u5217\u8868\uFF0C\u53EF\u4EE5\u653E\u5728\u9996\u9875\u7528\u6765\u5C55\u793A\u6240\u6709\u6A21\u5757\u3002"}),"\n",(0,s.jsx)(n.p,{children:"Overview \u7EC4\u4EF6\u53EA\u6709\u4E00\u4E2A list \u5C5E\u6027\uFF0C\u63A5\u6536\u4E00\u4E2A\u5BF9\u8C61\u6570\u7EC4\uFF0C\u4E0B\u9762\u662F\u5BF9\u8C61\u7684\u5C5E\u6027"}),"\n",(0,s.jsxs)(n.table,{children:["\n",(0,s.jsxs)(n.thead,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.th,{align:"center",children:"\u5C5E\u6027"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u8BF4\u660E"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u7C7B\u578B"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u9ED8\u8BA4\u503C"}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.tbody,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"\u56FE\u6807"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"React.ReactNode"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"text"}),"\n",(0,s.jsxs)(n.td,{align:"center",children:["\u6587\u672C(",(0,s.jsx)(n.strong,{children:"\u5FC5\u586B"}),")"]}),"\n",(0,s.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"link"}),"\n",(0,s.jsxs)(n.td,{align:"center",children:["\u94FE\u63A5(",(0,s.jsx)(n.strong,{children:"\u5FC5\u586B"}),")"]}),"\n",(0,s.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"arrow"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"\u662F\u5426\u5C55\u793A\u7BAD\u5934"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"boolean"}),"\n",(0,s.jsx)(n.td,{align:"center",children:(0,s.jsx)(n.code,{children:"false"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u63D2\u4EF6\u914D\u7F6E",children:["\u63D2\u4EF6\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"apiparsetool",children:["apiParseTool",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiparsetool",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"API \u89E3\u6790\u5DE5\u5177"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'react-docgen-typescript' | 'documentation'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"'react-docgen-typescript'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"doc",children:["doc",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#doc",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/index.html",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u6846\u67B6\u914D\u7F6E"})}),"\n",(0,s.jsxs)(n.h3,{id:"entries",children:["entries",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#entries",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u81EA\u52A8\u751F\u6210\u6587\u6863\u7684\u6A21\u5757\u540D\u79F0\u53CA\u76F8\u5BF9\u8DEF\u5F84"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"Entries | ToolEntries"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Entries = Record;\ntype ToolEntries = {\n documentation: Entries;\n 'react-docgen-typescript': Entries;\n};\n"})}),"\n",(0,s.jsx)(n.p,{children:"Entries \u540C\u65F6\u652F\u6301\u9488\u5BF9\u4E0D\u540C\u7684\u6587\u4EF6\u4F7F\u7528\u4E0D\u540C\u7684\u89E3\u6790\u5DE5\u5177\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n documentation: {\n Add: './src/utils/add.ts',\n },\n 'react-docgen-typescript': {\n Button: './src/components/button.tsx',\n },\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"iframeposition",children:["iframePosition",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#iframeposition",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"iframe \u6240\u5904\u9875\u9762\u4F4D\u7F6E"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'follow' | 'fixed'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,s.jsx)(n.code,{children:"'follow'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"follow"}),"\u65F6\uFF0C\u6BCF\u4E00\u4E2A\u4EE3\u7801\u5757\u90FD\u4F1A\u6709\u4E00\u4E2A iframe \u5C55\u793A\u5176\u6E32\u67D3\u89C6\u56FE\u3002\n",(0,s.jsx)(n.code,{children:"fixed"}),"\u65F6\uFF0Ciframe \u5C06\u4F1A\u56FA\u5B9A\u5728\u9875\u9762\u53F3\u4FA7\uFF0C\u5C55\u793A\u5F53\u524D\u9875\u9762\u6240\u6709\u4EE3\u7801\u5757\u7684\u89C6\u56FE\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"parsetooloptions",children:["parseToolOptions",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parsetooloptions",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"API \u89E3\u6790\u5DE5\u5177\u7684\u53C2\u6570"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"ParseToolOptions"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type ParseToolOptions = {\n // https://github.com/styleguidist/react-docgen-typescript#options\n 'react-docgen-typescript'?: ParserOptions;\n // https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md#parameters-1\n documentation?: DocumentationArgs;\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"previewmode",children:["previewMode",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#previewmode",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u4EE3\u7801\u5757\u9884\u89C8\u65B9\u5F0F\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'internal' | 'iframe'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,s.jsx)(n.code,{children:"'internal'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"internal"}),"\u65F6\uFF0C\u4EE3\u7801\u5757\u5185\u5BB9\u5C06\u4F1A\u76F4\u63A5\u6E32\u67D3\u5728\u9875\u9762\u4E2D\uFF0C\u53CD\u4E4B\u5C06\u4F1A\u901A\u8FC7 iframe \u52A0\u8F7D\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"deprecated-languages",children:["deprecated: languages",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-languages",children:"#"})]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE 2.44.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BF7\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"\u56FD\u9645\u5316"})," \u7AE0\u8282\u6765\u5B9E\u73B0\u591A\u8BED\u8A00\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h3,{id:"deprecated-usemodulesidebar",children:["deprecated: useModuleSidebar",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-usemodulesidebar",children:"#"})]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE 2.44.0 \u7248\u672C\u5F00\u59CB\uFF0C\u5185\u90E8\u5B9E\u73B0\u4E86\u55C5\u63A2\u673A\u5236\uFF0C\u8BF7\u76F4\u63A5\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"}),"\n\u6216\u8005\u76F4\u63A5\u914D\u7F6E ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"})," \u6765\u5B9E\u73B0\u81EA\u5B9A\u4E49\u4FA7\u8FB9\u680F\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u547D\u4EE4\u884C",children:["\u547D\u4EE4\u884C",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u547D\u4EE4\u884C",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"modern dev"}),": \u542F\u52A8\u6587\u6863\u7AD9\u672C\u5730\u5F00\u53D1\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"modern build --platform"}),": \u6784\u5EFA\u751F\u4EA7\u73AF\u5883\u4EA7\u7269\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u8FDB\u9636\u6307\u5357",children:["\u8FDB\u9636\u6307\u5357",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8FDB\u9636\u6307\u5357",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4EE5\u4E0A\u5DF2\u7ECF\u4ECB\u7ECD\u5B8C\u4E86\u5F00\u53D1\u6A21\u5757\u6587\u6863\u7684\u57FA\u672C\u5185\u5BB9\uFF0C\u4F46\u662F\u8FD9\u5BF9\u4E8E\u5F00\u53D1\u4E00\u4E2A\u5B8C\u6574\u7684\u6587\u6863\u7AD9\u662F\u4E0D\u591F\u7684\u3002\u67E5\u770B",(0,s.jsx)(n.a,{href:"https://rspress.dev",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\u4EE5\u6DF1\u5165\u4E86\u89E3\u6211\u4EEC\u7684\u6587\u6863\u6846\u67B6\u3002\n\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"doc"})," \u914D\u7F6E\u6765\u4FEE\u6539\u6587\u6863\u6846\u67B6\u914D\u7F6E\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n doc: {\n // \u81EA\u5B9A\u4E49\u6587\u6863\u7AD9\u70B9\u914D\u7F6E\n },\n }),\n ],\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fuse-module-doc.mdx"]={toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2},{text:"API",id:"api",depth:3},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4},{text:"Overview",id:"overview",depth:3},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2},{text:"apiParseTool",id:"apiparsetool",depth:3},{text:"doc",id:"doc",depth:3},{text:"entries",id:"entries",depth:3},{text:"iframePosition",id:"iframeposition",depth:3},{text:"parseToolOptions",id:"parsetooloptions",depth:3},{text:"previewMode",id:"previewmode",depth:3},{text:"deprecated: languages",id:"deprecated-languages",depth:3},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2}],title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file +/*! For license information please see 9697.411c4dcd.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9697"],{28097:function(e,n,r){"use strict";r.r(n);var s=r("39980"),d=r("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",h2:"h2",h3:"h3",ol:"ol",li:"li",pre:"pre",code:"code",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",img:"img",div:"div",ul:"ul",h4:"h4",strong:"strong"},(0,d.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.h1,{id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:["\u5F00\u53D1\u6A21\u5757\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u53D1\u6A21\u5757\u6587\u6863",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u672C\u7AE0\u4ECB\u7ECD\u5982\u4F55\u4E3A\u6A21\u5757\u9879\u76EE\u5FEB\u901F\u642D\u5EFA\u4E00\u4E2A\u9759\u6001\u6587\u6863\u7AD9\u70B9\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u5F00\u59CB\u4E4B\u524D",children:["\u5F00\u59CB\u4E4B\u524D",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5F00\u59CB\u4E4B\u524D",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",children:["\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",children:"#"})]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"\u6587\u6863\u7AD9\u70B9\u53EF\u4EE5\u5E2E\u52A9\u6211\u4EEC\u66F4\u597D\u5730\u7EC4\u7EC7\u6587\u6863\u7684\u7ED3\u6784\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u6587\u6863\u7AD9\u70B9\u5177\u6709\u66F4\u597D\u7684\u8868\u73B0\u5F62\u5F0F\uFF0C\u4F8B\u5982\u53EF\u4EE5\u5728\u9875\u9762\u4E2D\u6267\u884C\u51FD\u6570\uFF0C\u6E32\u67D3\u7EC4\u4EF6\u7B49\u3002"}),"\n",(0,s.jsx)(n.li,{children:"\u53EF\u4EE5\u66F4\u597D\u5730\u5229\u7528 AI \u641C\u7D22\u7684\u80FD\u529B\u3002"}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u524D\u7F6E\u51C6\u5907",children:["\u524D\u7F6E\u51C6\u5907",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u524D\u7F6E\u51C6\u5907",children:"#"})]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u901A\u8FC7",(0,s.jsx)(n.a,{href:"/guide/basic/use-micro-generator",children:"\u5FAE\u751F\u6210\u5668"}),"\u5F00\u542F\u6587\u6863\u529F\u80FD\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:["\u9605\u8BFB",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/start/introduction.html",target:"_blank",rel:"noopener noreferrer",children:"Rspress \u4ECB\u7ECD"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5B8C\u6210\u51C6\u5907\u5DE5\u4F5C\u4E4B\u540E\uFF0C\u63A5\u4E0B\u6765\u6211\u4EEC\u4F1A\u57FA\u4E8E Rspress \u4E3A\u6A21\u5757\u9879\u76EE\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9\u3002"}),"\n",(0,s.jsxs)(n.h2,{id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",children:["\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u7AD9\u70B9\u6574\u4F53\u5E03\u5C40\u7531\u4E09\u90E8\u5206\u7EC4\u6210\uFF1A\u5BFC\u822A\u680F\u3001\u4FA7\u8FB9\u680F\u4EE5\u53CA\u6B63\u6587\u90E8\u5206\uFF0C\u5176\u4E2D\u6B63\u6587\u8FD8\u5305\u62EC\u4E86 TOC(Table of contents found at the beginning of a book or document)\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["Rspress \u4F7F\u7528\u7684\u662F",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/conventional-route.html",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u7531"}),"\uFF0C\u6A21\u5757\u6587\u6863\u57FA\u4E8E\u6B64\u5B9E\u73B0\u4E86\u4FA7\u8FB9\u680F\u7684\u81EA\u52A8\u751F\u6210\u3002\n\u4F8B\u5982\uFF0C\u5982\u679C\u4F60\u6709\u4EE5\u4E0B\u7684\u6587\u4EF6\u7ED3\u6784\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 foo\n\u2502 \u2514\u2500\u2500 bar.md\n\u2502 \u2514\u2500\u2500 index.md\n\u2514\u2500\u2500 foo.md\n\u2514\u2500\u2500 index.md\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u90A3\u4E48 ",(0,s.jsx)(n.code,{children:"foo/bar.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/foo/bar"}),"\uFF0C",(0,s.jsx)(n.code,{children:"foo.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/foo"}),"\uFF0C",(0,s.jsx)(n.code,{children:"index.md"})," \u7684\u8DEF\u7531\u8DEF\u5F84\u4F1A\u662F ",(0,s.jsx)(n.code,{children:"/"}),"\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u5177\u4F53\u6620\u5C04\u89C4\u5219\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsxs)(n.table,{children:["\n",(0,s.jsxs)(n.thead,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.th,{children:"\u6587\u4EF6\u8DEF\u5F84"}),"\n",(0,s.jsx)(n.th,{children:"\u8DEF\u7531\u8DEF\u5F84"}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.tbody,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"index.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/index.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/"})}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/bar.md"})}),"\n",(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"/foo/bar"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u4E0E\u4E0A\u8FF0\u6587\u4EF6\u8DEF\u5F84\u548C\u8DEF\u7531\u8DEF\u5F84\u4F9D\u6B21\u5BF9\u5E94\u7684\u4FA7\u8FB9\u680F\u5982\u4E0B\u6240\u793A\uFF1A"}),"\n",(0,s.jsx)("img",{src:"https://lf3-static.bytednsdoc.com/obj/eden-cn/rpauheh7nulwbm/edenx-module/docs-blog/autosidebar.png"}),"\n",(0,s.jsxs)(n.h3,{id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",children:["\u914D\u7F6E\u4FA7\u8FB9\u680F",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u914D\u7F6E\u4FA7\u8FB9\u680F",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u4E0A\u56FE\u6240\u793A\uFF0C\u6A21\u5757\u6587\u6863\u5DF2\u7ECF\u4E3A\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u7531\u81EA\u52A8\u751F\u6210\u4E86\u4FA7\u8FB9\u680F\uFF0C\u5176\u4E2D\u4FA7\u8FB9\u680F\u6BCF\u4E00\u680F\u7684\u6587\u672C\u662F\u7531\u6587\u4EF6\u7684\u4E00\u7EA7\u6807\u9898\u6216\u8005\u76EE\u5F55\u540D\u51B3\u5B9A\u3002\n\u5982\u679C\u4F60\u9700\u8981\u81EA\u5B9A\u4E49\u4FA7\u8FB9\u680F\uFF0C\u8BF7\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"})," \u6216\u8005\u76F4\u63A5\u914D\u7F6E ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"}),"\u3002"]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive info",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5982\u679C\u4F60\u7684\u6587\u6863\u76EE\u5F55\u7ED3\u6784\u662F\u7B26\u5408\u56FD\u9645\u5316\u7684\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"docs\n\u251C\u2500\u2500 en\n\u2502 \u251C\u2500\u2500 button.mdx\n\u2502 \u251C\u2500\u2500 index.mdx\n\u2514\u2500\u2500 zh\n \u251C\u2500\u2500 button.mdx\n \u251C\u2500\u2500 index.mdx\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4F60\u9700\u8981\u6309\u7167",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"\u56FD\u9645\u5316"}),"\u7AE0\u8282\uFF0C\u540C\u65F6\u914D\u7F6E ",(0,s.jsx)(n.code,{children:"lang"})," \u548C ",(0,s.jsx)(n.code,{children:"locales"}),"\uFF0C\u5426\u5219\u6A21\u5757\u81EA\u52A8\u751F\u6210\u7684\u4FA7\u8FB9\u680F\u4E0D\u4F1A\u5904\u7406 ",(0,s.jsx)(n.code,{children:"zh"})," \u548C ",(0,s.jsx)(n.code,{children:"en"})," \u8FD9\u4E24\u4E2A\u76EE\u5F55\u3002\n"]})]})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7F16\u5199\u6587\u6863",children:["\u7F16\u5199\u6587\u6863",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7F16\u5199\u6587\u6863",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u53EF\u4EE5\u4E13\u6CE8\u4E8E\u6587\u6863\u5185\u5BB9\u7684\u7F16\u5199\u4E86\u3002\u9664\u4E86\u6700\u57FA\u672C\u7684\u7F16\u5199 markdown \u4EE5\u5916\uFF0C\u4F60\u53EF\u80FD\u8FD8\u9700\u8981\u4E86\u89E3\u4EE5\u4E0B\u8FDB\u9636\u5185\u5BB9\uFF1A"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/use-mdx.html",target:"_blank",rel:"noopener noreferrer",children:"\u4F7F\u7528 MDX"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/static-assets.html",target:"_blank",rel:"noopener noreferrer",children:"\u4F7F\u7528\u9759\u6001\u8D44\u6E90"})}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u7EC4\u4EF6\u9884\u89C8",children:["\u7EC4\u4EF6\u9884\u89C8",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7EC4\u4EF6\u9884\u89C8",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u6A21\u5757\u6587\u6863\u4E3A\u7EC4\u4EF6\u5E93\u63D0\u4F9B\u4E86\u9884\u89C8\u80FD\u529B\uFF0C",(0,s.jsx)(n.code,{children:"jsx"}),"\u548C",(0,s.jsx)(n.code,{children:"tsx"}),"\u7684\u4EE3\u7801\u5757\u91CC\u7684\u5185\u5BB9\u5C06\u4F1A\u88AB\u89E3\u6790\u4E3A React \u7EC4\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u793A\u4F8B",children:["\u793A\u4F8B",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u793A\u4F8B",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5047\u8BBE\u6211\u4EEC\u7684\u9879\u76EE\u540D\u662F",(0,s.jsx)(n.code,{children:"demo"}),"\uFF0C\u5E76\u5BFC\u51FA\u4E86\u4E00\u4E2A Button \u7EC4\u4EF6\u3002"]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u9996\u5148\u65B0\u589E ",(0,s.jsx)(n.code,{children:"docs/Button.mdx"})," \u6587\u4EF6\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",meta:'title="Button.mdx"',children:"# Button\n\n## \u57FA\u672C\u7528\u6CD5\n\n\u6309\u94AE\u5206\u4E3A\uFF1A \u5C0F\u3001\u4E2D\u3001\u5927\u56DB\u79CD\u5C3A\u5BF8\n\n```tsx\nimport React from 'react';\nimport { Button } from 'demo';\n\nexport default () => {\n return ;\n};\n```\n"})}),"\n",(0,s.jsxs)(n.ol,{start:"2",children:["\n",(0,s.jsxs)(n.li,{children:["\u5728",(0,s.jsx)(n.code,{children:"tsconfig.json"}),"\u91CC\u914D\u7F6E\u522B\u540D\uFF0C\u5C06\u5305\u540D\u6307\u5411\u5F53\u524D\u9879\u76EE\u76EE\u5F55\uFF0C\u4F7F\u5F97\u6587\u6863\u5F00\u53D1\u8005\u548C\u7528\u6237\u4F7F\u7528\u7EC4\u4EF6\u65B9\u5F0F\u4E00\u81F4\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",meta:'title="tsconfig.json"',children:'{\n "compilerOptions": {\n "paths": {\n "demo": ["."]\n }\n }\n}\n'})}),"\n",(0,s.jsxs)(n.ol,{start:"3",children:["\n",(0,s.jsxs)(n.li,{children:["\u5728 ",(0,s.jsx)(n.code,{children:".gitignore"})," \u6587\u4EF6\u4E0B\u6DFB\u52A0 ",(0,s.jsx)(n.code,{children:"doc_build/"}),"\uFF0C\u6587\u6863\u4EA7\u7269\u5C06\u4F1A\u751F\u6210\u5728\u6B64\u76EE\u5F55\u4E0B\uFF1A"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",meta:'title=".gitignore"',children:"doc_build/\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u606D\u559C\u4F60\uFF0C\u5DF2\u7ECF\u5B8C\u6210\u4E86\u4E00\u4E2A\u7EC4\u4EF6\u6587\u6863\u7684\u7F16\u5199\uFF0C\u6267\u884C",(0,s.jsx)(n.code,{children:"pnpm run dev"}),"\u770B\u770B\u6548\u679C\u5427\uFF0C\u8BB0\u5F97\u5148\u6784\u5EFA\u4E00\u4E0B\u7EC4\u4EF6\u5E93\uFF0C\u786E\u4FDD\u7EC4\u4EF6\u4EA7\u7269\u5B58\u5728\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"\u79FB\u52A8\u7AEF\u9884\u89C8",children:["\u79FB\u52A8\u7AEF\u9884\u89C8",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u79FB\u52A8\u7AEF\u9884\u89C8",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u540C\u65F6\uFF0C\u6211\u4EEC\u4E5F\u652F\u6301\u4E86\u79FB\u52A8\u7AEF\u9884\u89C8\u7684\u65B9\u5F0F\uFF0C\u5373\u4F7F\u7528 iframe \u6E32\u67D3\u79FB\u52A8\u7AEF\u7EC4\u4EF6\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"iframePosition"})," \u8BBE\u7F6E iframe \u7684\u4F4D\u7F6E\uFF0C\u652F\u6301\u626B\u7801\u9884\u89C8\u4EE5\u53CA\u65B0\u9875\u9762\u6253\u5F00\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n /**\n * \u9009\u62E9\u9884\u89C8\u65B9\u5F0F\n * @default internal\n */\n previewMode: 'iframe',\n /**\n * \u8BBE\u7F6E iframe \u7684\u4F4D\u7F6E\n * @default 'follow'\n */\n iframePosition: 'fixed',\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsxs)(n.p,{children:["\u5982\u679C\u53EA\u60F3\u8981\u6539\u53D8\u67D0\u4E00\u4E2A ",(0,s.jsx)(n.code,{children:"jsx"})," \u548C ",(0,s.jsx)(n.code,{children:"tsx"})," \u4EE3\u7801\u5757\u7684\u9884\u89C8\u65B9\u5F0F\uFF0C\u53EF\u4EE5\u4F7F\u7528\u4E0D\u540C\u7684\u4FEE\u9970\u7B26\u8FDB\u884C\u6807\u8BC6\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:"```jsx pure\n// \u8FD9\u91CC\u7684\u5185\u5BB9\u4E0D\u4F1A\u88AB\u6E32\u67D3\n```\n\n```jsx internal\n// \u5185\u7F6E\u5728\u6587\u6863\u5185\u5BB9\u91CC\u6E32\u67D3\n```\n\n```jsx iframe\n// \u4F7F\u7528 iframe \u6E32\u67D3\n```\n"})}),"\n"]})]}),"\n",(0,s.jsxs)(n.h3,{id:"\u4F7F\u7528\u5916\u90E8-demo",children:["\u4F7F\u7528\u5916\u90E8 demo",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5916\u90E8-demo",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679C\u6211\u4EEC\u7684 demo \u975E\u5E38\u590D\u6742\uFF0C\u90A3\u4E48\u5EFA\u8BAE\u5355\u72EC\u7F16\u5199 demo\uFF0C\u7136\u540E\u5728 MDX \u4E2D\u4F7F\u7528 ",(0,s.jsx)(n.code,{children:"code"})," \u6807\u7B7E\uFF1A"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,s.jsx)(n.p,{children:"\u8FD9\u540C\u6837\u652F\u6301\u5355\u72EC\u8BBE\u7F6E\u4EE3\u7801\u5757\u7684\u9884\u89C8\u65B9\u5F0F\uFF0C\u4F8B\u5982\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'\n'})}),"\n",(0,s.jsxs)(n.h2,{id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",children:["\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63D2\u4EF6\u5185\u90E8\u5B9E\u73B0\u4E86\u4E00\u90E8\u5206\u5185\u7F6E\u7EC4\u4EF6\uFF0C\u4EE5\u4FBF\u4E8E\u4F60\u53EF\u4EE5\u66F4\u8F7B\u677E\u5730\u5F00\u53D1\u6A21\u5757\u6587\u6863\u3002"}),"\n",(0,s.jsxs)(n.h3,{id:"api",children:["API",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#api",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5C55\u793A\u6A21\u5757\u7684 API \u5185\u5BB9"}),"\n",(0,s.jsxs)(n.h4,{id:"\u89E3\u6790\u6587\u4EF6",children:["\u89E3\u6790\u6587\u4EF6",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u89E3\u6790\u6587\u4EF6",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5728\u4F7F\u7528 API \u7EC4\u4EF6\u4E4B\u524D\uFF0C\u9996\u5148\u6211\u4EEC\u9700\u8981\u6307\u5B9A\u89E3\u6790\u7684\u6587\u4EF6\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n Button: './src/button.tsx',\n },\n apiParseTool: 'react-docgen-typescript',\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h4,{id:"\u5185\u5BB9\u751F\u6210",children:["\u5185\u5BB9\u751F\u6210",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u5185\u5BB9\u751F\u6210",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u63A5\u4E0B\u6765\u6211\u4EEC\u4E86\u89E3\u4E00\u4E0B\u6839\u636E\u89E3\u6790\u7684\u6587\u4EF6\u4F1A\u751F\u6210\u4EC0\u4E48\u6837\u7684 markdown \u5185\u5BB9\u3002"}),"\n",(0,s.jsxs)(n.p,{children:["\u5185\u5BB9\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.a,{href:"https://github.com/styleguidist/react-docgen-typescript",target:"_blank",rel:"noopener noreferrer",children:"react-docgen-typescript"})," \u6216\u8005 ",(0,s.jsx)(n.a,{href:"https://github.com/documentationjs/documentation",target:"_blank",rel:"noopener noreferrer",children:"documentation"})," \u4E24\u4E2A\u4E0D\u540C\u7684\u5DE5\u5177\u751F\u6210\uFF1A"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"react-docgen-typescript"}),"\u9488\u5BF9\u4E8E\u7EC4\u4EF6\u5E93\u573A\u666F\uFF0C\u4EC5\u4F1A\u89E3\u6790 props \u751F\u6210\u8868\u683C\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"export type ButtonProps = {\n /**\n * Whether to disable the button\n */\n disabled?: boolean;\n /**\n * Type of Button\n * @default 'default'\n */\n size?: 'mini' | 'small' | 'default' | 'large';\n};\nexport const Button = (props?: ButtonProps) => {};\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u4E0A\u9762\u662F\u4E00\u4E2A\u6807\u51C6\u5199\u6CD5\uFF0C\u5176\u4E2D ",(0,s.jsx)(n.code,{children:"ButtonProps"})," \u5C06\u88AB\u63D0\u53D6\u81F3\u8868\u683C\u4E2D\uFF0C ",(0,s.jsx)(n.code,{children:"Button"})," \u4F5C\u4E3A\u8868\u683C\u7684\u6807\u9898\u3002\u5982\u679C\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\uFF0C\u6587\u4EF6\u540D\u5C06\u4F5C\u4E3A\u8868\u683C\u6807\u9898\u3002"]}),"\n",(0,s.jsx)(n.p,{children:"\u9700\u8981\u6CE8\u610F\u7684\u662F\uFF0Cexport \u5BFC\u51FA\u4E8B\u5148\u5B9A\u4E49\u7684\u7279\u6027\u5C06\u4E0D\u4F1A\u88AB\u89E3\u6790\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"const A = () => {};\n\nexport { A }; // wrong\nexport default A; // wrong\nexport const B = () => {}; // right\nexport default () => {}; // right\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u751F\u6210\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",children:'### ButtonTest\n\n| \u5C5E\u6027 | \u8BF4\u660E | \u7C7B\u578B | \u9ED8\u8BA4\u503C |\n| :------: | :---------------------------: | :-----------------------------------------: | :---------: |\n| disabled | Whether to disable the button | `boolean` | `-` |\n| size | Type of Button | `"mini" \\| "small" \\| "default" \\| "large"` | `\'default\'` |\n'})}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,s.jsx)(n.p,{children:"\u5982\u679C Props \u91CC\u4F7F\u7528\u4E86 React \u7684\u7C7B\u578B\uFF0C\u4F60\u9700\u8981\u5728 tsconfig.json \u91CC\u6DFB\u52A0 types \uFF0C\u5426\u5219\u4F1A\u89E3\u6790\u4E0D\u5230 React \u547D\u540D\u7A7A\u95F4\u4E0B\u7684\u7C7B\u578B\u3002"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "compilerOptions": {\n "types": ["react"]\n }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"\u66F4\u597D\u7684\u65B9\u5F0F\u662F\u76F4\u63A5\u5F15\u7528\u7C7B\u578B\uFF0C\u4F8B\u5982"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",children:"import { FC } from 'react';\n"})}),"\n"]})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"documentation"}),"\u9002\u7528\u4E8E\u5DE5\u5177\u5E93\u573A\u666F\uFF0C\u7528\u6765\u89E3\u6790 JSDoc \u6CE8\u91CA\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"/**\n * Greet function that returns a greeting message.\n * @param {string} name - The name of the person to greet.\n * @param {string} [greeting='Hello'] - The greeting to use.\n * @returns {string} The greeting message.\n */\nfunction greet(name: string, greeting = 'Hello') {\n return `${greeting}, ${name}!`;\n}\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u4E0A\u9762\u662F\u4E00\u4E2A\u5E26\u6709 JSDoc \u6CE8\u91CA\u7684 greet \u51FD\u6570\u3002\u751F\u6210\u7684\u5185\u5BB9\u5982\u4E0B\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-md",children:"\x3c!-- Generated by documentation.js. Update this documentation by updating the source code. --\x3e\n\n## greet\n\nGreet function that returns a greeting message.\n\n### Parameters\n\n- `name` **[string][1]** The name of the person to greet.\n- `greeting` **[string][1]** The greeting to use. (optional, default `'Hello'`)\n\nReturns **[string][1]** The greeting message.\n\n[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n"})}),"\n",(0,s.jsxs)(n.h4,{id:"\u7EC4\u4EF6\u4F7F\u7528",children:["\u7EC4\u4EF6\u4F7F\u7528",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7EC4\u4EF6\u4F7F\u7528",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u63A5\u4E0B\u6765\uFF0C\u4F60\u4FBF\u53EF\u4EE5\u5728\u6587\u6863\u91CC\u4F7F\u7528\u6211\u4EEC\u7684\u5185\u7F6E API \u7EC4\u4EF6\u4E86\uFF0C\u5C06",(0,s.jsx)(n.code,{children:"key"}),"\u503C\u4F20\u5165",(0,s.jsx)(n.code,{children:"moduleName"}),"\u5C5E\u6027\u91CC"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-mdx",meta:'title="Button.mdx"',children:'# Button\n\n## API\n\n\n'})}),"\n",(0,s.jsxs)(n.h3,{id:"overview",children:["Overview",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#overview",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u5C55\u793A\u6A21\u5757\u5217\u8868\uFF0C\u53EF\u4EE5\u653E\u5728\u9996\u9875\u7528\u6765\u5C55\u793A\u6240\u6709\u6A21\u5757\u3002"}),"\n",(0,s.jsx)(n.p,{children:"Overview \u7EC4\u4EF6\u53EA\u6709\u4E00\u4E2A list \u5C5E\u6027\uFF0C\u63A5\u6536\u4E00\u4E2A\u5BF9\u8C61\u6570\u7EC4\uFF0C\u4E0B\u9762\u662F\u5BF9\u8C61\u7684\u5C5E\u6027"}),"\n",(0,s.jsxs)(n.table,{children:["\n",(0,s.jsxs)(n.thead,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.th,{align:"center",children:"\u5C5E\u6027"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u8BF4\u660E"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u7C7B\u578B"}),"\n",(0,s.jsx)(n.th,{align:"center",children:"\u9ED8\u8BA4\u503C"}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.tbody,{children:["\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"icon"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"\u56FE\u6807"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"React.ReactNode"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"text"}),"\n",(0,s.jsxs)(n.td,{align:"center",children:["\u6587\u672C(",(0,s.jsx)(n.strong,{children:"\u5FC5\u586B"}),")"]}),"\n",(0,s.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"link"}),"\n",(0,s.jsxs)(n.td,{align:"center",children:["\u94FE\u63A5(",(0,s.jsx)(n.strong,{children:"\u5FC5\u586B"}),")"]}),"\n",(0,s.jsx)(n.td,{align:"center",children:"string"}),"\n",(0,s.jsx)(n.td,{align:"center"}),"\n"]}),"\n",(0,s.jsxs)(n.tr,{children:["\n",(0,s.jsx)(n.td,{align:"center",children:"arrow"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"\u662F\u5426\u5C55\u793A\u7BAD\u5934"}),"\n",(0,s.jsx)(n.td,{align:"center",children:"boolean"}),"\n",(0,s.jsx)(n.td,{align:"center",children:(0,s.jsx)(n.code,{children:"false"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u63D2\u4EF6\u914D\u7F6E",children:["\u63D2\u4EF6\u914D\u7F6E",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u63D2\u4EF6\u914D\u7F6E",children:"#"})]}),"\n",(0,s.jsxs)(n.h3,{id:"apiparsetool",children:["apiParseTool",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#apiparsetool",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"API \u89E3\u6790\u5DE5\u5177"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'react-docgen-typescript' | 'documentation'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"'react-docgen-typescript'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.h3,{id:"doc",children:["doc",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#doc",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/index.html",target:"_blank",rel:"noopener noreferrer",children:"\u6587\u6863\u6846\u67B6\u914D\u7F6E"})}),"\n",(0,s.jsxs)(n.h3,{id:"entries",children:["entries",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#entries",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u81EA\u52A8\u751F\u6210\u6587\u6863\u7684\u6A21\u5757\u540D\u79F0\u53CA\u76F8\u5BF9\u8DEF\u5F84"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"Entries | ToolEntries"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type Entries = Record;\ntype ToolEntries = {\n documentation: Entries;\n 'react-docgen-typescript': Entries;\n};\n"})}),"\n",(0,s.jsx)(n.p,{children:"Entries \u540C\u65F6\u652F\u6301\u9488\u5BF9\u4E0D\u540C\u7684\u6587\u4EF6\u4F7F\u7528\u4E0D\u540C\u7684\u89E3\u6790\u5DE5\u5177\uFF1A"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n entries: {\n documentation: {\n Add: './src/utils/add.ts',\n },\n 'react-docgen-typescript': {\n Button: './src/components/button.tsx',\n },\n },\n }),\n ],\n});\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"iframeposition",children:["iframePosition",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#iframeposition",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"iframe \u6240\u5904\u9875\u9762\u4F4D\u7F6E"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'follow' | 'fixed'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,s.jsx)(n.code,{children:"'follow'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"follow"}),"\u65F6\uFF0C\u6BCF\u4E00\u4E2A\u4EE3\u7801\u5757\u90FD\u4F1A\u6709\u4E00\u4E2A iframe \u5C55\u793A\u5176\u6E32\u67D3\u89C6\u56FE\u3002\n",(0,s.jsx)(n.code,{children:"fixed"}),"\u65F6\uFF0Ciframe \u5C06\u4F1A\u56FA\u5B9A\u5728\u9875\u9762\u53F3\u4FA7\uFF0C\u5C55\u793A\u5F53\u524D\u9875\u9762\u6240\u6709\u4EE3\u7801\u5757\u7684\u89C6\u56FE\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"parsetooloptions",children:["parseToolOptions",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#parsetooloptions",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"API \u89E3\u6790\u5DE5\u5177\u7684\u53C2\u6570"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"ParseToolOptions"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,s.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"type ParseToolOptions = {\n // https://github.com/styleguidist/react-docgen-typescript#options\n 'react-docgen-typescript'?: ParserOptions;\n // https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md#parameters-1\n documentation?: DocumentationArgs;\n};\n"})}),"\n",(0,s.jsxs)(n.h3,{id:"previewmode",children:["previewMode",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#previewmode",children:"#"})]}),"\n",(0,s.jsx)(n.p,{children:"\u4EE3\u7801\u5757\u9884\u89C8\u65B9\u5F0F\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,s.jsx)(n.code,{children:"'internal' | 'iframe'"})]}),"\n",(0,s.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,s.jsx)(n.code,{children:"'internal'"})]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"internal"}),"\u65F6\uFF0C\u4EE3\u7801\u5757\u5185\u5BB9\u5C06\u4F1A\u76F4\u63A5\u6E32\u67D3\u5728\u9875\u9762\u4E2D\uFF0C\u53CD\u4E4B\u5C06\u4F1A\u901A\u8FC7 iframe \u52A0\u8F7D\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"deprecated-languages",children:["deprecated: languages",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-languages",children:"#"})]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE 2.44.0 \u7248\u672C\u5F00\u59CB\uFF0C\u8BF7\u53C2\u8003 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/default-theme/i18n.html",target:"_blank",rel:"noopener noreferrer",children:"\u56FD\u9645\u5316"})," \u7AE0\u8282\u6765\u5B9E\u73B0\u591A\u8BED\u8A00\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h3,{id:"deprecated-usemodulesidebar",children:["deprecated: useModuleSidebar",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#deprecated-usemodulesidebar",children:"#"})]}),"\n",(0,s.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,s.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,s.jsx)(n.div,{className:"rspress-directive-content",children:(0,s.jsxs)(n.p,{children:["\u4ECE 2.44.0 \u7248\u672C\u5F00\u59CB\uFF0C\u5185\u90E8\u5B9E\u73B0\u4E86\u55C5\u63A2\u673A\u5236\uFF0C\u8BF7\u76F4\u63A5\u4F7F\u7528 ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/guide/basic/auto-nav-sidebar.html",target:"_blank",rel:"noopener noreferrer",children:"_meta.json"}),"\n\u6216\u8005\u76F4\u63A5\u914D\u7F6E ",(0,s.jsx)(n.a,{href:"https://rspress.dev/zh/api/config/config-theme.html#sidebar",target:"_blank",rel:"noopener noreferrer",children:"sidebar"})," \u6765\u5B9E\u73B0\u81EA\u5B9A\u4E49\u4FA7\u8FB9\u680F\u3002\n"]})})]}),"\n",(0,s.jsxs)(n.h2,{id:"\u547D\u4EE4\u884C",children:["\u547D\u4EE4\u884C",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u547D\u4EE4\u884C",children:"#"})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"modern dev"}),": \u542F\u52A8\u6587\u6863\u7AD9\u672C\u5730\u5F00\u53D1\u3002"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"modern build --platform"}),": \u6784\u5EFA\u751F\u4EA7\u73AF\u5883\u4EA7\u7269\u3002"]}),"\n"]}),"\n",(0,s.jsxs)(n.h2,{id:"\u8FDB\u9636\u6307\u5357",children:["\u8FDB\u9636\u6307\u5357",(0,s.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u8FDB\u9636\u6307\u5357",children:"#"})]}),"\n",(0,s.jsxs)(n.p,{children:["\u4EE5\u4E0A\u5DF2\u7ECF\u4ECB\u7ECD\u5B8C\u4E86\u5F00\u53D1\u6A21\u5757\u6587\u6863\u7684\u57FA\u672C\u5185\u5BB9\uFF0C\u4F46\u662F\u8FD9\u5BF9\u4E8E\u5F00\u53D1\u4E00\u4E2A\u5B8C\u6574\u7684\u6587\u6863\u7AD9\u662F\u4E0D\u591F\u7684\u3002\u67E5\u770B",(0,s.jsx)(n.a,{href:"https://rspress.dev",target:"_blank",rel:"noopener noreferrer",children:"Rspress"}),"\u4EE5\u6DF1\u5165\u4E86\u89E3\u6211\u4EEC\u7684\u6587\u6863\u6846\u67B6\u3002\n\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,s.jsx)(n.code,{children:"doc"})," \u914D\u7F6E\u6765\u4FEE\u6539\u6587\u6863\u6846\u67B6\u914D\u7F6E\u3002"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginDoc } from '@modern-js/plugin-rspress';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginDoc({\n doc: {\n // \u81EA\u5B9A\u4E49\u6587\u6863\u7AD9\u70B9\u914D\u7F6E\n },\n }),\n ],\n});\n"})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(i,{...e})}):i(e)}n.default=t,t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["zh%2Fguide%2Fbasic%2Fuse-module-doc.mdx"]={toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2},{text:"API",id:"api",depth:3},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4},{text:"Overview",id:"overview",depth:3},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2},{text:"apiParseTool",id:"apiparsetool",depth:3},{text:"doc",id:"doc",depth:3},{text:"entries",id:"entries",depth:3},{text:"iframePosition",id:"iframeposition",depth:3},{text:"parseToolOptions",id:"parsetooloptions",depth:3},{text:"previewMode",id:"previewmode",depth:3},{text:"deprecated: languages",id:"deprecated-languages",depth:3},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2}],title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",frontmatter:{sidebar_position:5}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6408.2dffc699.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9697.411c4dcd.js.LICENSE.txt similarity index 75% rename from modern-js/module-tools/static/js/async/6408.2dffc699.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9697.411c4dcd.js.LICENSE.txt index f5b91f224b..c784831ed5 100644 --- a/modern-js/module-tools/static/js/async/6408.2dffc699.js.LICENSE.txt +++ b/modern-js/module-tools/static/js/async/9697.411c4dcd.js.LICENSE.txt @@ -1,5 +1,3 @@ /*! @mdx-js/react */ -/*! @theme */ - /*! react/jsx-runtime */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/972.16544374.js b/modern-js/module-tools/static/js/async/972.16544374.js new file mode 100644 index 0000000000..07ad4f9919 --- /dev/null +++ b/modern-js/module-tools/static/js/async/972.16544374.js @@ -0,0 +1,2 @@ +/*! For license information please see 972.16544374.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["972"],{59032:function(e,n,s){"use strict";s.r(n);var r=s("39980"),a=s("9580");function i(e){let n=Object.assign({h1:"h1",a:"a",p:"p",ul:"ul",li:"li",h2:"h2",strong:"strong",code:"code",pre:"pre",blockquote:"blockquote"},(0,a.ah)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"versioning-and-publishing",children:["Versioning and Publishing",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#versioning-and-publishing",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"An npm-type module project release process consists of two phases."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The first phase is during development, where the developer needs to provide a change file to record changes that need to be released."}),"\n",(0,r.jsxs)(n.li,{children:["The second phase is during release, collect all the change files to update the version, update the release log, and release new packages to the ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/",target:"_blank",rel:"noopener noreferrer",children:"npm Registry"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Modern.js Module provides a set of version management and release solutions, which are suitable for single-package scenarios. For npm packages in monorepo, you need to follow the strategies provided by various monorepo solutions."}),"\n",(0,r.jsxs)(n.h2,{id:"tracking-changes",children:["Tracking changes",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tracking-changes",children:"#"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Changes need to be logged when they happen to the project"}),". Changes that occur in a project are typically."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"New features"}),"\n",(0,r.jsx)(n.li,{children:"Fixes to issues"}),"\n",(0,r.jsx)(n.li,{children:"Configuration file changes"}),"\n",(0,r.jsx)(n.li,{children:"..."}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Once these changes have been made, the current changes need to be documented with the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-change",children:(0,r.jsx)(n.code,{children:"modern change"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Executing the ",(0,r.jsx)(n.code,{children:"modern change"})," command asks the developer several questions and generates a change log based on the developer's answers. The changelog file contains the type of change and its description, and is committed to the git repository."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern change\n\uD83E\uDD8B What kind of change is this for module-example? (current version is 0.1.0) - patch\n\uD83E\uDD8B Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor\n\uD83E\uDD8B Summary - publish test\n\uD83E\uDD8B === Releasing the following packages ===\n\uD83E\uDD8B [Patch]\n\uD83E\uDD8B module\n\uD83E\uDD8B Is this your desired changeset? (Y/n) - true\n\uD83E\uDD8B Changeset added! - you can now commit it\n\uD83E\uDD8B\n\uD83E\uDD8B If you want to modify or expand on the changeset summary, you can find it here\n\uD83E\uDD8B info /xxxxxx/module/.changeset/brave-dryers-agree.md\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When executed successfully, the resulting Markdown file containing the change log is saved in the project's ",(0,r.jsx)(n.code,{children:".changeset"})," directory. The contents will look like the following."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-markdown",meta:'title=".changeset/brave-dryers-agree.md"',children:"---\n\"``module-example'': patch\n---\n\npublish test\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"version-update",children:["Version update",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#version-update",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When the project version needs to be updated, execute the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-bump",children:(0,r.jsx)(n.code,{children:"modern bump"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Executing ",(0,r.jsx)(n.code,{children:"modern bump"})," will modify the version number in ",(0,r.jsx)(n.code,{children:"package.json"})," based on the contents of the Markdown file in the ",(0,r.jsx)(n.code,{children:".changeset/"})," directory where the changes were recorded, and generate the ",(0,r.jsx)(n.code,{children:"CHANGELOG.md"})," file. ",(0,r.jsx)(n.strong,{children:'These Markdown files are also deleted when the version update is complete, so they are "consumed "'}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-markdown",meta:'title="CHANGELOG.md"',children:"# module\n\n## 0.1.1\n\n### Patch Changes\n\n- publish test\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"publish",children:["Publish",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#publish",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"To publish a project, you can execute the following command."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-release",children:(0,r.jsx)(n.code,{children:"modern publish"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"modern release"})," command publishes the project to the npm Registry."]}),"\n",(0,r.jsxs)(n.p,{children:["The release is the ",(0,r.jsx)(n.code,{children:"latest"})," version, which is also the official version. If you want to change the ",(0,r.jsx)(n.code,{children:"dist-tag"}),", you can specify it with the ",(0,r.jsx)(n.code,{children:"modern release --tag"})," command. For example."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"modern release --tag beta\n"})}),"\n",(0,r.jsxs)(n.p,{children:["However, if you want to change the version number of the current project to a pre-release as well, you need to use the ",(0,r.jsx)(n.code,{children:"modern pre"})," command."]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"dist-tag"})," can be understood as: tagging the current release. Generally speaking, the ",(0,r.jsx)(n.code,{children:"dist-tag"})," for the default release is ",(0,r.jsx)(n.code,{children:"latest"}),", so you can consider ",(0,r.jsx)(n.code,{children:"latest"})," as the ",(0,r.jsx)(n.code,{children:"dist-tag"})," for the official release."]}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"pre-releases",children:["Pre-releases",(0,r.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#pre-releases",children:"#"})]}),"\n",(0,r.jsx)(n.p,{children:"When a pre-release is needed before the official release, the following command is executed."}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/guide/basic/command-preview#modern-pre",children:(0,r.jsx)(n.code,{children:"modern pre"})})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["First ",(0,r.jsx)(n.code,{children:"modern pre enter "})," to enter pre-release mode, ",(0,r.jsx)(n.code,{children:""})," can be the same as the ",(0,r.jsx)(n.code,{children:"tag"})," specified with the ",(0,r.jsx)(n.code,{children:"modern release --tag"})," command when releasing the project."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern pre enter next\n\uD83E\uDD8B success Entered pre mode with tag next\n\uD83E\uDD8B info Run `changeset version` to version packages with prerelease versions\n\u2728 Done in 5.30s.\nDone in 5.30s.\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Then you can update the specific version number with the ",(0,r.jsx)(n.code,{children:"modern bump"})," command, ",(0,r.jsx)(n.strong,{children:'which doesn\'t actually "consume" the Markdown file that records the changes'}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"$ npx modern bump\n\uD83E\uDD8B warn ===============================IMPORTANT!===============================\n\uD83E\uDD8B warn You are in prerelease mode\n\uD83E\uDD8B warn If you meant to do a normal release you should revert these changes and run `changeset pre exit`\n\uD83E\uDD8B warn You can then run `changeset version` again to do a normal release\n\uD83E\uDD8B warn ----------------------------------------------------------------------\n\uD83E\uDD8B All files have been updated. review them and commit at your leisure\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Then you can see that the updated version number in ",(0,r.jsx)(n.code,{children:"package.json"})," will look like this: ",(0,r.jsx)(n.code,{children:"0.1.2-next.0"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Finally, ",(0,r.jsxs)(n.strong,{children:["if you don't need to do a pre-release anymore, be sure to run the ",(0,r.jsx)(n.code,{children:"modern pre exit"})," command"]})," to exit the pre-release state and to release the official version when you run the ",(0,r.jsx)(n.code,{children:"modern bump"})," command again."]})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,a.ah)(),e.components);return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(i,{...e})}):i(e)}n.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fguide%2Fbasic%2Fpublish-your-project.mdx"]={toc:[{text:"Tracking changes",id:"tracking-changes",depth:2},{text:"Version update",id:"version-update",depth:2},{text:"Publish",id:"publish",depth:2},{text:"Pre-releases",id:"pre-releases",depth:2}],title:"Versioning and Publishing",frontmatter:{sidebar_position:7}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8484.8075cc5a.js.LICENSE.txt b/modern-js/module-tools/static/js/async/972.16544374.js.LICENSE.txt similarity index 75% rename from modern-js/module-tools/static/js/async/8484.8075cc5a.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/972.16544374.js.LICENSE.txt index f5b91f224b..c784831ed5 100644 --- a/modern-js/module-tools/static/js/async/8484.8075cc5a.js.LICENSE.txt +++ b/modern-js/module-tools/static/js/async/972.16544374.js.LICENSE.txt @@ -1,5 +1,3 @@ /*! @mdx-js/react */ -/*! @theme */ - /*! react/jsx-runtime */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/9826.e8ebb4aa.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9826.e8ebb4aa.js.LICENSE.txt deleted file mode 100644 index 365fe27962..0000000000 --- a/modern-js/module-tools/static/js/async/9826.e8ebb4aa.js.LICENSE.txt +++ /dev/null @@ -1,3 +0,0 @@ -/*! react/jsx-runtime */ - -/*! @mdx-js/react */ \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/6917.5162bac3.js b/modern-js/module-tools/static/js/async/9931.b2327126.js similarity index 98% rename from modern-js/module-tools/static/js/async/6917.5162bac3.js rename to modern-js/module-tools/static/js/async/9931.b2327126.js index 34d3f96f27..8b71aa92f3 100644 --- a/modern-js/module-tools/static/js/async/6917.5162bac3.js +++ b/modern-js/module-tools/static/js/async/9931.b2327126.js @@ -1,2 +1,2 @@ -/*! For license information please see 6917.5162bac3.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["6917"],{88364:function(e,l,n){"use strict";n.r(l);var i=n("39980"),d=n("9580"),s=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",ul:"ul",li:"li",strong:"strong"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l.h1,{id:"node-polyfill-plugin",children:["Node Polyfill Plugin",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfill-plugin",children:"#"})]}),"\n",(0,i.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,i.jsx)(l.div,{className:"rspress-directive-title",children:"About Node Polyfill"}),(0,i.jsx)(l.div,{className:"rspress-directive-content",children:(0,i.jsx)(l.p,{children:"Normally, we don't need to use Node libs on the browser side. However, it is possible to use some Node libs when the code will run on both the Node side and the browser side, and Node Polyfill provides browser versions of polyfills for these Node libs."})})]}),"\n",(0,i.jsx)(l.p,{children:"By using the Node Polyfill plugin, Node core libs polyfills are automatically injected into the browser-side, allowing you to use these modules on the browser side with confidence."}),"\n",(0,i.jsxs)(l.h2,{id:"quick-start",children:["Quick Start",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(l.h3,{id:"install",children:["Install",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-node-polyfill -D"}),"\n",(0,i.jsxs)(l.h3,{id:"register",children:["Register",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginNodePolyfill()],\n});\n"})}),"\n",(0,i.jsxs)(l.h2,{id:"configurations",children:["Configurations",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#configurations",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsxs)(l.li,{children:[(0,i.jsx)(l.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"type NodePolyfillOptions = {\n exclude?: string[];\n overrides?: Record;\n};\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"exclude",children:["exclude",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"Exclude the Node Polyfill to be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n exclude: ['console'],\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"overrides",children:["overrides",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#overrides",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"Override the built-in Node Polyfill."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n overrides: {\n fs: path.join(__dirname, './custom-fs.js'),\n },\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(l.h2,{id:"node-polyfills",children:["Node Polyfills",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfills",children:"#"})]}),"\n",(0,i.jsxs)(l.h3,{id:"globals",children:["Globals",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#globals",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"Buffer"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"console"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"When the above global variables are used directly in code, the corresponding polyfill will be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"const bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"modules",children:["Modules",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#modules",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"assert"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"buffer"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"console"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"constants"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"crypto"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"domain"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"events"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"http"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"https"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"os"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"path"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"punycode"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"querystring"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"stream"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_duplex"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_passthrough"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_readable"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_transform"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_writable"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"string_decoder"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"sys"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"timers"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"tty"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"url"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"util"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"vm"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"zlib"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"When the above module is referenced in code via import / require syntax, the corresponding polyfill will be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { Buffer } from 'buffer';\n\nconst bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"fallbacks",children:["Fallbacks",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#fallbacks",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"child_process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"cluster"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"dgram"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"dns"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"fs"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"module"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"net"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"readline"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"repl"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"tls"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"Currently there is no polyfill for the above modules on the browser side, so when you import the above modules, it will automatically fallback to an empty object."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import fs from 'fs';\n\nconsole.log(fs); // -> {}\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,d.ah)(),e.components);return l?(0,i.jsx)(l,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}l.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-node-polyfill.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Configurations",id:"configurations",depth:2},{text:"exclude",id:"exclude",depth:3},{text:"overrides",id:"overrides",depth:3},{text:"Node Polyfills",id:"node-polyfills",depth:2},{text:"Globals",id:"globals",depth:3},{text:"Modules",id:"modules",depth:3},{text:"Fallbacks",id:"fallbacks",depth:3}],title:"Node Polyfill Plugin",frontmatter:{}}}}]); \ No newline at end of file +/*! For license information please see 9931.b2327126.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["9931"],{15719:function(e,l,n){"use strict";n.r(l);var i=n("39980"),d=n("9580"),s=n("23657");function r(e){let l=Object.assign({h1:"h1",a:"a",div:"div",p:"p",h2:"h2",h3:"h3",pre:"pre",code:"code",ul:"ul",li:"li",strong:"strong"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l.h1,{id:"node-polyfill-plugin",children:["Node Polyfill Plugin",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfill-plugin",children:"#"})]}),"\n",(0,i.jsxs)(l.div,{className:"rspress-directive tip",children:[(0,i.jsx)(l.div,{className:"rspress-directive-title",children:"About Node Polyfill"}),(0,i.jsx)(l.div,{className:"rspress-directive-content",children:(0,i.jsx)(l.p,{children:"Normally, we don't need to use Node libs on the browser side. However, it is possible to use some Node libs when the code will run on both the Node side and the browser side, and Node Polyfill provides browser versions of polyfills for these Node libs."})})]}),"\n",(0,i.jsx)(l.p,{children:"By using the Node Polyfill plugin, Node core libs polyfills are automatically injected into the browser-side, allowing you to use these modules on the browser side with confidence."}),"\n",(0,i.jsxs)(l.h2,{id:"quick-start",children:["Quick Start",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#quick-start",children:"#"})]}),"\n",(0,i.jsxs)(l.h3,{id:"install",children:["Install",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#install",children:"#"})]}),"\n","\n",(0,i.jsx)(s.SU,{command:"add @modern-js/plugin-module-node-polyfill -D"}),"\n",(0,i.jsxs)(l.h3,{id:"register",children:["Register",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#register",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"In Modern.js Module, you can register plugins in the following way:"}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [moduleTools(), modulePluginNodePolyfill()],\n});\n"})}),"\n",(0,i.jsxs)(l.h2,{id:"configurations",children:["Configurations",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#configurations",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsxs)(l.li,{children:[(0,i.jsx)(l.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"type NodePolyfillOptions = {\n exclude?: string[];\n overrides?: Record;\n};\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"exclude",children:["exclude",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#exclude",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"Exclude the Node Polyfill to be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n exclude: ['console'],\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"overrides",children:["overrides",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#overrides",children:"#"})]}),"\n",(0,i.jsx)(l.p,{children:"Override the built-in Node Polyfill."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@modern-js/module-tools';\nimport { modulePluginNodePolyfill } from '@modern-js/plugin-module-node-polyfill';\n\nexport default defineConfig({\n plugins: [\n moduleTools(),\n modulePluginNodePolyfill({\n overrides: {\n fs: path.join(__dirname, './custom-fs.js'),\n },\n }),\n ],\n});\n"})}),"\n",(0,i.jsxs)(l.h2,{id:"node-polyfills",children:["Node Polyfills",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#node-polyfills",children:"#"})]}),"\n",(0,i.jsxs)(l.h3,{id:"globals",children:["Globals",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#globals",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"Buffer"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"console"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"When the above global variables are used directly in code, the corresponding polyfill will be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"const bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"modules",children:["Modules",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#modules",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"assert"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"buffer"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"console"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"constants"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"crypto"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"domain"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"events"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"http"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"https"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"os"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"path"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"punycode"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"querystring"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"stream"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_duplex"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_passthrough"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_readable"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_transform"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"_stream_writable"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"string_decoder"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"sys"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"timers"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"tty"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"url"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"util"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"vm"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"zlib"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"When the above module is referenced in code via import / require syntax, the corresponding polyfill will be injected."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import { Buffer } from 'buffer';\n\nconst bufferData = Buffer.from('xxxx');\n"})}),"\n",(0,i.jsxs)(l.h3,{id:"fallbacks",children:["Fallbacks",(0,i.jsx)(l.a,{className:"header-anchor","aria-hidden":"true",href:"#fallbacks",children:"#"})]}),"\n",(0,i.jsxs)(l.ul,{children:["\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"child_process"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"cluster"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"dgram"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"dns"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"fs"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"module"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"net"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"readline"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"repl"})}),"\n",(0,i.jsx)(l.li,{children:(0,i.jsx)(l.code,{children:"tls"})}),"\n"]}),"\n",(0,i.jsx)(l.p,{children:"Currently there is no polyfill for the above modules on the browser side, so when you import the above modules, it will automatically fallback to an empty object."}),"\n",(0,i.jsx)(l.pre,{children:(0,i.jsx)(l.code,{className:"language-ts",children:"import fs from 'fs';\n\nconsole.log(fs); // -> {}\n"})})]})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:l}=Object.assign({},(0,d.ah)(),e.components);return l?(0,i.jsx)(l,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}l.default=o,o.__RSPRESS_PAGE_META={},o.__RSPRESS_PAGE_META["en%2Fplugins%2Fofficial-list%2Fplugin-node-polyfill.mdx"]={toc:[{text:"Quick Start",id:"quick-start",depth:2},{text:"Install",id:"install",depth:3},{text:"Register",id:"register",depth:3},{text:"Configurations",id:"configurations",depth:2},{text:"exclude",id:"exclude",depth:3},{text:"overrides",id:"overrides",depth:3},{text:"Node Polyfills",id:"node-polyfills",depth:2},{text:"Globals",id:"globals",depth:3},{text:"Modules",id:"modules",depth:3},{text:"Fallbacks",id:"fallbacks",depth:3}],title:"Node Polyfill Plugin",frontmatter:{}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/8683.7396e81f.js.LICENSE.txt b/modern-js/module-tools/static/js/async/9931.b2327126.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/async/8683.7396e81f.js.LICENSE.txt rename to modern-js/module-tools/static/js/async/9931.b2327126.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/index.5a5eef94.js b/modern-js/module-tools/static/js/index.5a5eef94.js new file mode 100644 index 0000000000..cecd271205 --- /dev/null +++ b/modern-js/module-tools/static/js/index.5a5eef94.js @@ -0,0 +1,2 @@ +/*! For license information please see index.5a5eef94.js.LICENSE.txt */ +!function(){var e,t,n,r,o,u,i,c,a,f,d,l,s,b,p={92919:function(e,t,n){"use strict";n.r(t),n.d(t,{Aside:function(){return r.xN},Badge:function(){return r.Ct},Button:function(){return r.zx},DocFooter:function(){return r.Qn},DocLayout:function(){return r.RY},EditLink:function(){return r.mi},HomeFeature:function(){return r.BZ},HomeFooter:function(){return r.xK},HomeHero:function(){return r.xB},HomeLayout:function(){return r.Os},LastUpdated:function(){return r.O9},Layout:function(){return r.Ar},Link:function(){return r.rU},Nav:function(){return r.JL},NotFoundLayout:function(){return r.qx},Overview:function(){return r.g2},PackageManagerTabs:function(){return r.SU},PrevNextPage:function(){return r.Qe},RenderType:function(){return r.y2},ScrollToTop:function(){return r.pU},Search:function(){return r.ol},SearchPanel:function(){return r.EG},Sidebar:function(){return r.YE},SocialLinks:function(){return r.WG},SourceCode:function(){return r.ZB},Steps:function(){return r.Rg},SwitchAppearance:function(){return r.KO},Tab:function(){return r.OK},Tabs:function(){return r.mQ},Tag:function(){return r.Vp},Toc:function(){return r.of},bindingAsideScroll:function(){return r.UQ},default:function(){return r.ZP},getCustomMDXComponent:function(){return r.TJ},isActive:function(){return r.zh},isMobileDevice:function(){return r.s2},renderHtmlOrText:function(){return r.NG},renderInlineMarkdown:function(){return r.VA},scrollToTarget:function(){return r.eF},setup:function(){return r.cY},useEditLink:function(){return r.CU},useEnableNav:function(){return r.CF},useFullTextSearch:function(){return r.YS},useHiddenNav:function(){return r.Vl},useLocaleSiteData:function(){return r.M4},usePathUtils:function(){return r.eE},usePrevNextPage:function(){return r.WS},useRedirect4FirstVisit:function(){return r.AV},useSidebarData:function(){return r.tx},useThemeState:function(){return r.ls}});var r=n("78958")}},v={};function m(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return p[e].call(n.exports,n,n.exports,m),n.exports}m.m=p,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},m.t=function(n,r){if(1&r&&(n=this(n)),8&r||"object"==typeof n&&n&&(4&r&&n.__esModule||16&r&&"function"==typeof n.then))return n;var o=Object.create(null);m.r(o);var u={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(function(e){u[e]=function(){return n[e]}});return u.default=function(){return n},m.d(o,u),o},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.k=function(e){return""+e+".css"},m.u=function(e){return"static/js/async/"+e+"."+({1005:"8757a931",1095:"ab4639f9",1166:"fadfc0d7",1297:"5bb5922c",131:"7e780f65",1310:"d1270024",1563:"bf6e86c1",1586:"aa3224bf",1600:"854a5d28",1684:"f3977b44",1711:"1e576c94",1800:"6e537275",1819:"ba3c2c1e",1867:"578d6a53",187:"5dd663d0",1877:"d5f98786",19:"bb39e9ef",1960:"b65fe81c",2259:"dd01802f",2263:"7762b818",2414:"362edd76",2551:"a606f1c1",270:"312ebb2e",2814:"23f25c63",2913:"2b145c76",310:"4253327a",3104:"877feaa0",330:"0937e30f",347:"49ac8f09",3535:"ebab774e",3635:"7f1cd7bc",3691:"8143e3bf",3900:"4969da18",3937:"df16bfbb",3969:"12bd3b87",4131:"e7c23464",4191:"ec0c85d1",4306:"aa23082a",4344:"57789f12",4523:"5b0b69f9",4575:"0ddcba6d",4607:"a515024b",4699:"75859fc3",4764:"26a6f511",4887:"e31f697b",5188:"3f3d6165",5269:"379402a1",5305:"1ac532a7",538:"b354267e",5800:"88e53b08",5898:"258bd4d1",6051:"9006d708",6167:"59abe9e8",6201:"18880672",6275:"ceb5ba13",6512:"35d7bc4d",6566:"3ab6b5d9",6573:"8c6b5e09",6658:"aeef8790",6800:"b1b81661",705:"8b38f041",7115:"001bfea1",7287:"f2f905cd",7321:"63e4af77",7334:"2b4d109f",737:"8eedae12",7426:"32bc11b9",7534:"4139a31a",7565:"d04bd6d3",7664:"c654123f",7698:"3cc8e11f",7782:"70e3e8e1",7929:"5d0e4c1f",7947:"1bc4e2fe",803:"9bccdc9e",8058:"a1f19999",8067:"3cf6d68d",8104:"66e49f69",8269:"4ed5a426",8409:"1be93ad7",8528:"1ccd4f8d",8571:"1705338e",8580:"1a78ef5f",8612:"6fdbde84",8741:"507fd5f7",8746:"f85b2010",8914:"a2a0b7b9",8975:"5404cc56",9016:"43a2da2a",9176:"d1a045a2",9460:"40dea9c9",9475:"6320e3be",9549:"c3191d68",958:"55859902",9675:"0d4f59ca",9697:"411c4dcd",972:"16544374",9931:"b2327126"})[e]+".js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n={},r="@modern-js/module-tools-docs:",m.l=function(e,t,o,u){if(n[e]){n[e].push(t);return}if(void 0!==o){for(var i,c,a=document.getElementsByTagName("script"),f=0;f0&&o[u-1][2]>r;u--)o[u]=o[u-1];o[u]=[t,n,r];return}for(var i=1/0,u=0;u=r&&Object.keys(m.O).every(function(e){return m.O[e](t[a])})?t.splice(a--,1):(c=!1,r0&&o[u-1][2]>r;u--)o[u]=o[u-1];o[u]=[t,n,r];return}for(var i=1/0,u=0;u=r&&Object.keys(m.O).every(function(e){return m.O[e](t[c])})?t.splice(c--,1):(a=!1,rf;)if((c=s[f++])!=c)return!0}else for(;a>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},81123:function(t,r,n){"use strict";var e=n("44230"),o=n("56466"),i=n("69922");t.exports=function(t,r,n,u){try{var c=i(t,"return");if(c)return o("Promise").resolve(e(c,t)).then(function(){r(n)},function(t){u(t)})}catch(t){return u(t)}r(n)}},57442:function(t,r,n){"use strict";var e=n("44230"),o=n("84737"),i=n("58401"),u=n("85298"),c=n("5870"),s=n("69763"),a=n("62932"),f=n("63827"),p=n("56466"),l=n("69922"),v=n("60181"),y=n("78002"),h=n("60015"),d=p("Promise"),b=a("toStringTag"),g="AsyncIteratorHelper",m="WrapForValidAsyncIterator",x=f.set,w=function(t){var r=!t,n=f.getterFor(t?m:g),c=function(t){var e=o(function(){return n(t)}),i=e.error,u=e.value;return i||r&&u.done?{exit:!0,value:i?d.reject(u):d.resolve(y(void 0,!0))}:{exit:!1,value:u}};return s(u(v),{next:function(){var t=c(this),r=t.value;if(t.exit)return r;var n=o(function(){return i(r.nextHandler(d))}),e=n.error,u=n.value;return e&&(r.done=!0),e?d.reject(u):d.resolve(u)},return:function(){var r,n,u=c(this),s=u.value;if(u.exit)return s;s.done=!0;var a=s.iterator,f=o(function(){if(s.inner)try{h(s.inner.iterator,"normal")}catch(t){return h(a,"throw",t)}return l(a,"return")});return(r=n=f.value,f.error)?d.reject(n):void 0===r?d.resolve(y(void 0,!0)):(n=(f=o(function(){return e(r,a)})).value,f.error)?d.reject(n):t?d.resolve(n):d.resolve(n).then(function(t){return i(t),y(void 0,!0)})}})},O=w(!0),S=w(!1);c(S,b,"Async Iterator Helper"),t.exports=function(t,r){var n=function(n,e){e?(e.iterator=n.iterator,e.next=n.next):e=n,e.type=r?m:g,e.nextHandler=t,e.counter=0,e.done=!1,x(this,e)};return n.prototype=r?O:S,n}},88012:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("16621"),c=n("32916"),s=n("56466"),a=n("41377"),f=n("81123"),p=function(t){var r=0===t,n=1===t,p=2===t,l=3===t;return function(t,v,y){i(t);var h=void 0!==v;(h||!r)&&o(v);var d=a(t),b=s("Promise"),g=d.iterator,m=d.next,x=0;return new b(function(t,o){var s=function(t){f(g,o,t,o)},a=function(){try{if(h)try{c(x)}catch(t){s(t)}b.resolve(i(e(m,g))).then(function(e){try{if(i(e).done)r?(y.length=x,t(y)):t(!l&&(p||void 0));else{var c=e.value;try{if(h){var d=v(c,x),m=function(e){if(n)a();else if(p)e?a():f(g,t,!1,o);else if(r)try{y[x++]=e,a()}catch(t){s(t)}else e?f(g,t,l||c,o):a()};u(d)?b.resolve(d).then(m,s):m(d)}else y[x++]=c,a()}catch(t){s(t)}}}catch(t){o(t)}},o)}catch(t){o(t)}};a()})}};t.exports={toArray:p(0),forEach:p(1),every:p(2),some:p(3),find:p(4)}},2403:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("16621"),c=n("41377"),s=n("57442"),a=n("78002"),f=n("81123"),p=s(function(t){var r=this,n=r.iterator,o=r.mapper;return new t(function(c,s){var p=function(t){r.done=!0,s(t)},l=function(t){f(n,p,t,p)};t.resolve(i(e(r.next,n))).then(function(n){try{if(i(n).done)r.done=!0,c(a(void 0,!0));else{var e=n.value;try{var s=o(e,r.counter++),f=function(t){c(a(t,!1))};u(s)?t.resolve(s).then(f,l):f(s)}catch(t){l(t)}}}catch(t){p(t)}},p)})});t.exports=function(t){return i(this),o(t),new p(c(this),{mapper:t})}},60181:function(t,r,n){"use strict";var e,o,i=n("2029"),u=n("90733"),c=n("10929"),s=n("85298"),a=n("4957"),f=n("73216"),p=n("62932"),l=n("20571"),v="USE_FUNCTION_CONSTRUCTOR",y=p("asyncIterator"),h=i.AsyncIterator,d=u.AsyncIteratorPrototype;if(d)e=d;else if(c(h))e=h.prototype;else if(u[v]||i[v])try{o=a(a(a(Function("return async function*(){}()")()))),a(o)===Object.prototype&&(e=o)}catch(t){}e?l&&(e=s(e)):e={},!c(e[y])&&f(e,y,function(){return this}),t.exports=e},2590:function(t,r,n){"use strict";var e=n("58401"),o=n("60015");t.exports=function(t,r,n,i){try{return i?r(e(n)[0],n[1]):r(n)}catch(r){o(t,"throw",r)}}},89399:function(t,r,n){"use strict";var e=n("50139"),o=e({}.toString),i=e("".slice);t.exports=function(t){return i(o(t),8,-1)}},20800:function(t,r,n){"use strict";var e=n("31595"),o=n("10929"),i=n("89399"),u=n("62932")("toStringTag"),c=Object,s="Arguments"===i(function(){return arguments}()),a=function(t,r){try{return t[r]}catch(t){}};t.exports=e?i:function(t){var r,n,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=a(r=c(t),u))?n:s?i(r):"Object"===(e=i(r))&&o(r.callee)?"Arguments":e}},94260:function(t,r,n){"use strict";var e=n("90794"),o=n("84693"),i=n("83389"),u=n("90221");t.exports=function(t,r,n){for(var c=o(r),s=u.f,a=i.f,f=0;f9007199254740991)throw r("Maximum allowed index exceeded");return t}},61758:function(t){"use strict";t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},83341:function(t,r,n){"use strict";var e,o,i=n("2029"),u=n("61758"),c=i.process,s=i.Deno,a=c&&c.versions||s&&s.version,f=a&&a.v8;f&&(o=(e=f.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!o&&u&&(!(e=u.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=u.match(/Chrome\/(\d+)/))&&(o=+e[1]),t.exports=o},5310:function(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30745:function(t,r,n){"use strict";var e=n("2029"),o=n("83389").f,i=n("5870"),u=n("73216"),c=n("46735"),s=n("94260"),a=n("23743");t.exports=function(t,r){var n,f,p,l,v,y=t.target,h=t.global,d=t.stat;if(n=h?e:d?e[y]||c(y,{}):e[y]&&e[y].prototype)for(f in r){if(l=r[f],p=t.dontCallGetSet?(v=o(n,f))&&v.value:n[f],!a(h?f:y+(d?".":"#")+f,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;s(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(n,f,l,t)}}},31491:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},55875:function(t,r,n){"use strict";var e=n("96144"),o=n("10038"),i=n("41693"),u=e(e.bind);t.exports=function(t,r){return o(t),void 0===r?t:i?u(t,r):function(){return t.apply(r,arguments)}}},41693:function(t,r,n){"use strict";var e=n("31491");t.exports=!e(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},44230:function(t,r,n){"use strict";var e=n("41693"),o=Function.prototype.call;t.exports=e?o.bind(o):function(){return o.apply(o,arguments)}},73820:function(t,r,n){"use strict";var e=n("25430"),o=n("90794"),i=Function.prototype,u=e&&Object.getOwnPropertyDescriptor,c=o(i,"name"),s=c&&(!e||e&&u(i,"name").configurable);t.exports={EXISTS:c,PROPER:c&&"something"===(function(){}).name,CONFIGURABLE:s}},96144:function(t,r,n){"use strict";var e=n("89399"),o=n("50139");t.exports=function(t){if("Function"===e(t))return o(t)}},50139:function(t,r,n){"use strict";var e=n("41693"),o=Function.prototype,i=o.call,u=e&&o.bind.bind(i,i);t.exports=e?u:function(t){return function(){return i.apply(t,arguments)}}},56466:function(t,r,n){"use strict";var e=n("2029"),o=n("10929");t.exports=function(t,r){var n;return arguments.length<2?o(n=e[t])?n:void 0:e[t]&&e[t][r]}},41377:function(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},60614:function(t,r,n){"use strict";var e=n("20800"),o=n("69922"),i=n("27266"),u=n("63141"),c=n("62932")("iterator");t.exports=function(t){if(!i(t))return o(t,c)||o(t,"@@iterator")||u[e(t)]}},23791:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("20226"),c=n("60614"),s=TypeError;t.exports=function(t,r){var n=arguments.length<2?c(t):r;if(o(n))return i(e(n,t));throw new s(u(t)+" is not iterable")}},69922:function(t,r,n){"use strict";var e=n("10038"),o=n("27266");t.exports=function(t,r){var n=t[r];return o(n)?void 0:e(n)}},2029:function(t,r,n){"use strict";var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof n.g&&n.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},90794:function(t,r,n){"use strict";var e=n("50139"),o=n("84962"),i=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return i(o(t),r)}},61477:function(t){"use strict";t.exports={}},19578:function(t,r,n){"use strict";var e=n("56466");t.exports=e("document","documentElement")},63391:function(t,r,n){"use strict";var e=n("25430"),o=n("31491"),i=n("7175");t.exports=!e&&!o(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},98485:function(t,r,n){"use strict";var e=n("50139"),o=n("31491"),i=n("89399"),u=Object,c=e("".split);t.exports=o(function(){return!u("z").propertyIsEnumerable(0)})?function(t){return"String"===i(t)?c(t,""):u(t)}:u},863:function(t,r,n){"use strict";var e=n("50139"),o=n("10929"),i=n("90733"),u=e(Function.toString);!o(i.inspectSource)&&(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},63827:function(t,r,n){"use strict";var e,o,i,u=n("2468"),c=n("2029"),s=n("16621"),a=n("5870"),f=n("90794"),p=n("90733"),l=n("14523"),v=n("61477"),y="Object already initialized",h=c.TypeError,d=c.WeakMap;if(u||p.state){var b=p.state||(p.state=new d);b.get=b.get,b.has=b.has,b.set=b.set,e=function(t,r){if(b.has(t))throw new h(y);return r.facade=t,b.set(t,r),r},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var g=l("state");v[g]=!0,e=function(t,r){if(f(t,g))throw new h(y);return r.facade=t,a(t,g,r),r},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!s(r)||(n=o(r)).type!==t)throw new h("Incompatible receiver, "+t+" required");return n}}}},18849:function(t,r,n){"use strict";var e=n("62932"),o=n("63141"),i=e("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[i]===t)}},10929:function(t){"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},23743:function(t,r,n){"use strict";var e=n("31491"),o=n("10929"),i=/#|\.prototype\./,u=function(t,r){var n=s[c(t)];return n===f||n!==a&&(o(r)?e(r):!!r)},c=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=u.data={},a=u.NATIVE="N",f=u.POLYFILL="P";t.exports=u},27266:function(t){"use strict";t.exports=function(t){return null==t}},16621:function(t,r,n){"use strict";var e=n("10929");t.exports=function(t){return"object"==typeof t?null!==t:e(t)}},20571:function(t){"use strict";t.exports=!1},15290:function(t,r,n){"use strict";var e=n("56466"),o=n("10929"),i=n("30882"),u=n("53209"),c=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=e("Symbol");return o(r)&&i(r.prototype,c(t))}},91524:function(t,r,n){"use strict";var e=n("55875"),o=n("44230"),i=n("58401"),u=n("20226"),c=n("18849"),s=n("56251"),a=n("30882"),f=n("23791"),p=n("60614"),l=n("60015"),v=TypeError,y=function(t,r){this.stopped=t,this.result=r},h=y.prototype;t.exports=function(t,r,n){var d,b,g,m,x,w,O,S=n&&n.that,j=!!(n&&n.AS_ENTRIES),P=!!(n&&n.IS_RECORD),E=!!(n&&n.IS_ITERATOR),I=!!(n&&n.INTERRUPTED),T=e(r,S),A=function(t){return d&&l(d,"normal",t),new y(!0,t)},Z=function(t){return j?(i(t),I?T(t[0],t[1],A):T(t[0],t[1])):I?T(t,A):T(t)};if(P)d=t.iterator;else if(E)d=t;else{if(!(b=p(t)))throw new v(u(t)+" is not iterable");if(c(b)){for(g=0,m=s(t);m>g;g++)if((x=Z(t[g]))&&a(h,x))return x;return new y(!1)}d=f(t,b)}for(w=P?t.next:d.next;!(O=o(w,d)).done;){try{x=Z(O.value)}catch(t){l(d,"throw",t)}if("object"==typeof x&&x&&a(h,x))return x}return new y(!1)}},60015:function(t,r,n){"use strict";var e=n("44230"),o=n("58401"),i=n("69922");t.exports=function(t,r,n){var u,c;o(t);try{if(!(u=i(t,"return"))){if("throw"===r)throw n;return n}u=e(u,t)}catch(t){c=!0,u=t}if("throw"===r)throw n;if(c)throw u;return o(u),n}},67498:function(t,r,n){"use strict";var e=n("44230"),o=n("85298"),i=n("5870"),u=n("69763"),c=n("62932"),s=n("63827"),a=n("69922"),f=n("44999").IteratorPrototype,p=n("78002"),l=n("60015"),v=c("toStringTag"),y="IteratorHelper",h="WrapForValidIterator",d=s.set,b=function(t){var r=s.getterFor(t?h:y);return u(o(f),{next:function(){var n=r(this);if(t)return n.nextHandler();try{var e=n.done?void 0:n.nextHandler();return p(e,n.done)}catch(t){throw n.done=!0,t}},return:function(){var n=r(this),o=n.iterator;if(n.done=!0,t){var i=a(o,"return");return i?e(i,o):p(void 0,!0)}if(n.inner)try{l(n.inner.iterator,"normal")}catch(t){return l(o,"throw",t)}return l(o,"normal"),p(void 0,!0)}})},g=b(!0),m=b(!1);i(m,v,"Iterator Helper"),t.exports=function(t,r){var n=function(n,e){e?(e.iterator=n.iterator,e.next=n.next):e=n,e.type=r?h:y,e.nextHandler=t,e.counter=0,e.done=!1,d(this,e)};return n.prototype=r?g:m,n}},24138:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("41377"),c=n("67498"),s=n("2590"),a=c(function(){var t=this.iterator,r=i(e(this.next,t));if(!(this.done=!!r.done))return s(t,this.mapper,[r.value,this.counter++],!0)});t.exports=function(t){return i(this),o(t),new a(u(this),{mapper:t})}},44999:function(t,r,n){"use strict";var e,o,i,u=n("31491"),c=n("10929"),s=n("16621"),a=n("85298"),f=n("4957"),p=n("73216"),l=n("62932"),v=n("20571"),y=l("iterator"),h=!1;[].keys&&("next"in(i=[].keys())?(o=f(f(i)))!==Object.prototype&&(e=o):h=!0),!s(e)||u(function(){var t={};return e[y].call(t)!==t})?e={}:v&&(e=a(e)),!c(e[y])&&p(e,y,function(){return this}),t.exports={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:h}},63141:function(t){"use strict";t.exports={}},56251:function(t,r,n){"use strict";var e=n("27572");t.exports=function(t){return e(t.length)}},27623:function(t,r,n){"use strict";var e=n("50139"),o=n("31491"),i=n("10929"),u=n("90794"),c=n("25430"),s=n("73820").CONFIGURABLE,a=n("863"),f=n("63827"),p=f.enforce,l=f.get,v=String,y=Object.defineProperty,h=e("".slice),d=e("".replace),b=e([].join),g=c&&!o(function(){return 8!==y(function(){},"length",{value:8}).length}),m=String(String).split("String"),x=t.exports=function(t,r,n){"Symbol("===h(v(r),0,7)&&(r="["+d(v(r),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!u(t,"name")||s&&t.name!==r)&&(c?y(t,"name",{value:r,configurable:!0}):t.name=r),g&&n&&u(n,"arity")&&t.length!==n.arity&&y(t,"length",{value:n.arity});try{n&&u(n,"constructor")&&n.constructor?c&&y(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var e=p(t);return!u(e,"source")&&(e.source=b(m,"string"==typeof r?r:"")),t};Function.prototype.toString=x(function(){return i(this)&&l(this).source||a(this)},"toString")},22309:function(t){"use strict";var r=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?n:r)(e)}},85298:function(t,r,n){"use strict";var e,o=n("58401"),i=n("33342"),u=n("5310"),c=n("61477"),s=n("19578"),a=n("7175"),f=n("14523"),p="prototype",l="script",v=f("IE_PROTO"),y=function(){},h=function(t){return"<"+l+">"+t+""},d=function(t){t.write(h("")),t.close();var r=t.parentWindow.Object;return t=null,r},b=function(){var t,r=a("iframe");return r.style.display="none",s.appendChild(r),r.src=String("java"+l+":"),(t=r.contentWindow.document).open(),t.write(h("document.F=Object")),t.close(),t.F},g=function(){try{e=new ActiveXObject("htmlfile")}catch(t){}g="undefined"!=typeof document?document.domain&&e?d(e):b():d(e);for(var t=u.length;t--;)delete g[p][u[t]];return g()};c[v]=!0,t.exports=Object.create||function(t,r){var n;return null!==t?(y[p]=o(t),n=new y,y[p]=null,n[v]=t):n=g(),void 0===r?n:i.f(n,r)}},33342:function(t,r,n){"use strict";var e=n("25430"),o=n("31757"),i=n("90221"),u=n("58401"),c=n("65852"),s=n("51387");r.f=e&&!o?Object.defineProperties:function(t,r){u(t);for(var n,e=c(r),o=s(r),a=o.length,f=0;a>f;)i.f(t,n=o[f++],e[n]);return t}},90221:function(t,r,n){"use strict";var e=n("25430"),o=n("63391"),i=n("31757"),u=n("58401"),c=n("76248"),s=TypeError,a=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",v="writable";r.f=e?i?function(t,r,n){if(u(t),r=c(r),u(n),"function"==typeof t&&"prototype"===r&&"value"in n&&v in n&&!n[v]){var e=f(t,r);e&&e[v]&&(t[r]=n.value,n={configurable:l in n?n[l]:e[l],enumerable:p in n?n[p]:e[p],writable:!1})}return a(t,r,n)}:a:function(t,r,n){if(u(t),r=c(r),u(n),o)try{return a(t,r,n)}catch(t){}if("get"in n||"set"in n)throw new s("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},83389:function(t,r,n){"use strict";var e=n("25430"),o=n("44230"),i=n("38574"),u=n("79855"),c=n("65852"),s=n("76248"),a=n("90794"),f=n("63391"),p=Object.getOwnPropertyDescriptor;r.f=e?p:function(t,r){if(t=c(t),r=s(r),f)try{return p(t,r)}catch(t){}if(a(t,r))return u(!o(i.f,t,r),t[r])}},21046:function(t,r,n){"use strict";var e=n("76565"),o=n("5310").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},90505:function(t,r){"use strict";r.f=Object.getOwnPropertySymbols},4957:function(t,r,n){"use strict";var e=n("90794"),o=n("10929"),i=n("84962"),u=n("14523"),c=n("97011"),s=u("IE_PROTO"),a=Object,f=a.prototype;t.exports=c?a.getPrototypeOf:function(t){var r=i(t);if(e(r,s))return r[s];var n=r.constructor;return o(n)&&r instanceof n?n.prototype:r instanceof a?f:null}},30882:function(t,r,n){"use strict";var e=n("50139");t.exports=e({}.isPrototypeOf)},76565:function(t,r,n){"use strict";var e=n("50139"),o=n("90794"),i=n("65852"),u=n("20047").indexOf,c=n("61477"),s=e([].push);t.exports=function(t,r){var n,e=i(t),a=0,f=[];for(n in e)!o(c,n)&&o(e,n)&&s(f,n);for(;r.length>a;)o(e,n=r[a++])&&(~u(f,n)||s(f,n));return f}},51387:function(t,r,n){"use strict";var e=n("76565"),o=n("5310");t.exports=Object.keys||function(t){return e(t,o)}},38574:function(t,r){"use strict";var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!n.call({1:2},1);r.f=o?function(t){var r=e(this,t);return!!r&&r.enumerable}:n},20775:function(t,r,n){"use strict";var e=n("44230"),o=n("10929"),i=n("16621"),u=TypeError;t.exports=function(t,r){var n,c;if("string"===r&&o(n=t.toString)&&!i(c=e(n,t))||o(n=t.valueOf)&&!i(c=e(n,t))||"string"!==r&&o(n=t.toString)&&!i(c=e(n,t)))return c;throw new u("Can't convert object to primitive value")}},84693:function(t,r,n){"use strict";var e=n("56466"),o=n("50139"),i=n("21046"),u=n("90505"),c=n("58401"),s=o([].concat);t.exports=e("Reflect","ownKeys")||function(t){var r=i.f(c(t)),n=u.f;return n?s(r,n(t)):r}},84737:function(t){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},38982:function(t,r,n){"use strict";var e=n("27266"),o=TypeError;t.exports=function(t){if(e(t))throw new o("Can't call method on "+t);return t}},14523:function(t,r,n){"use strict";var e=n("79683"),o=n("60211"),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},90733:function(t,r,n){"use strict";var e=n("20571"),o=n("2029"),i=n("46735"),u="__core-js_shared__",c=t.exports=o[u]||i(u,{});(c.versions||(c.versions=[])).push({version:"3.36.0",mode:e?"pure":"global",copyright:"\xa9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE",source:"https://github.com/zloirock/core-js"})},79683:function(t,r,n){"use strict";var e=n("90733");t.exports=function(t,r){return e[t]||(e[t]=r||{})}},6532:function(t,r,n){"use strict";var e=n("83341"),o=n("31491"),i=n("2029").String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t) instanceof Symbol)||!Symbol.sham&&e&&e<41})},58602:function(t,r,n){"use strict";var e=n("68811"),o=Math.max,i=Math.min;t.exports=function(t,r){var n=e(t);return n<0?o(n+r,0):i(n,r)}},65852:function(t,r,n){"use strict";var e=n("98485"),o=n("38982");t.exports=function(t){return e(o(t))}},68811:function(t,r,n){"use strict";var e=n("22309");t.exports=function(t){var r=+t;return r!=r||0===r?0:e(r)}},27572:function(t,r,n){"use strict";var e=n("68811"),o=Math.min;t.exports=function(t){var r=e(t);return r>0?o(r,9007199254740991):0}},84962:function(t,r,n){"use strict";var e=n("38982"),o=Object;t.exports=function(t){return o(e(t))}},28466:function(t,r,n){"use strict";var e=n("44230"),o=n("16621"),i=n("15290"),u=n("69922"),c=n("20775"),s=n("62932"),a=TypeError,f=s("toPrimitive");t.exports=function(t,r){if(!o(t)||i(t))return t;var n,s=u(t,f);if(s){if(void 0===r&&(r="default"),!o(n=e(s,t,r))||i(n))return n;throw new a("Can't convert object to primitive value")}return void 0===r&&(r="number"),c(t,r)}},76248:function(t,r,n){"use strict";var e=n("28466"),o=n("15290");t.exports=function(t){var r=e(t,"string");return o(r)?r:r+""}},31595:function(t,r,n){"use strict";var e=n("62932")("toStringTag"),o={};o[e]="z",t.exports="[object z]"===String(o)},49347:function(t,r,n){"use strict";var e=n("20800"),o=String;t.exports=function(t){if("Symbol"===e(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},20226:function(t){"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},60211:function(t,r,n){"use strict";var e=n("50139"),o=0,i=Math.random(),u=e(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},53209:function(t,r,n){"use strict";var e=n("6532");t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},31757:function(t,r,n){"use strict";var e=n("25430"),o=n("31491");t.exports=e&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},12922:function(t){"use strict";var r=TypeError;t.exports=function(t,n){if(t=0)continue;n[e]=t[e]}return n}n.d(r,{Z:function(){return e}})},66834:function(t,r,n){"use strict";function e(t,r){return(e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t})(t,r)}n.d(r,{Z:function(){return e}})},17701:function(t,r,n){"use strict";function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n=0||({}).propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},7358:function(t,r,n){"use strict";function e(t,r){if(null==t)return{};var n={};for(var e in t)if(({}).hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}n.d(r,{Z:function(){return e}})},29618:function(t,r,n){"use strict";n.d(r,{Z:function(){return c}});var e=n("77748"),o=n("73014"),i=n("93318"),u=n("29500");function c(t){return(0,e.Z)(t)||(0,o.Z)(t)||(0,i.Z)(t)||(0,u.Z)()}},64735:function(t,r,n){"use strict";n.d(r,{Z:function(){return o}});var e=n("74929");function o(t,r){if("object"!=(0,e.Z)(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=(0,e.Z)(o))return o;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}},32693:function(t,r,n){"use strict";n.d(r,{Z:function(){return i}});var e=n("74929"),o=n("64735");function i(t){var r=(0,o.Z)(t,"string");return"symbol"==(0,e.Z)(r)?r:r+""}},74929:function(t,r,n){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.d(r,{Z:function(){return e}})},93318:function(t,r,n){"use strict";n.d(r,{Z:function(){return o}});var e=n("17701");function o(t,r){if(t){if("string"==typeof t)return(0,e.Z)(t,r);var n=({}).toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,e.Z)(t,r):void 0}}}}]); \ No newline at end of file +/*! For license information please see lib-polyfill.d1077309.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2126"],{10038:function(t,r,n){"use strict";var e=n("10929"),o=n("20226"),i=TypeError;t.exports=function(t){if(e(t))return t;throw new i(o(t)+" is not a function")}},62830:function(t,r,n){"use strict";var e=n("30882"),o=TypeError;t.exports=function(t,r){if(e(r,t))return t;throw new o("Incorrect invocation")}},58401:function(t,r,n){"use strict";var e=n("16621"),o=String,i=TypeError;t.exports=function(t){if(e(t))return t;throw new i(o(t)+" is not an object")}},20047:function(t,r,n){"use strict";var e=n("65852"),o=n("58602"),i=n("56251"),u=function(t){return function(r,n,u){var c,s=e(r),a=i(s);if(0===a)return!t&&-1;var f=o(u,a);if(t&&n!=n){for(;a>f;)if((c=s[f++])!=c)return!0}else for(;a>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},81123:function(t,r,n){"use strict";var e=n("44230"),o=n("56466"),i=n("69922");t.exports=function(t,r,n,u){try{var c=i(t,"return");if(c)return o("Promise").resolve(e(c,t)).then(function(){r(n)},function(t){u(t)})}catch(t){return u(t)}r(n)}},57442:function(t,r,n){"use strict";var e=n("44230"),o=n("84737"),i=n("58401"),u=n("85298"),c=n("5870"),s=n("69763"),a=n("62932"),f=n("63827"),p=n("56466"),l=n("69922"),v=n("60181"),y=n("78002"),h=n("60015"),d=p("Promise"),b=a("toStringTag"),g="AsyncIteratorHelper",m="WrapForValidAsyncIterator",x=f.set,w=function(t){var r=!t,n=f.getterFor(t?m:g),c=function(t){var e=o(function(){return n(t)}),i=e.error,u=e.value;return i||r&&u.done?{exit:!0,value:i?d.reject(u):d.resolve(y(void 0,!0))}:{exit:!1,value:u}};return s(u(v),{next:function(){var t=c(this),r=t.value;if(t.exit)return r;var n=o(function(){return i(r.nextHandler(d))}),e=n.error,u=n.value;return e&&(r.done=!0),e?d.reject(u):d.resolve(u)},return:function(){var r,n,u=c(this),s=u.value;if(u.exit)return s;s.done=!0;var a=s.iterator,f=o(function(){if(s.inner)try{h(s.inner.iterator,"normal")}catch(t){return h(a,"throw",t)}return l(a,"return")});return(r=n=f.value,f.error)?d.reject(n):void 0===r?d.resolve(y(void 0,!0)):(n=(f=o(function(){return e(r,a)})).value,f.error)?d.reject(n):t?d.resolve(n):d.resolve(n).then(function(t){return i(t),y(void 0,!0)})}})},O=w(!0),S=w(!1);c(S,b,"Async Iterator Helper"),t.exports=function(t,r){var n=function(n,e){e?(e.iterator=n.iterator,e.next=n.next):e=n,e.type=r?m:g,e.nextHandler=t,e.counter=0,e.done=!1,x(this,e)};return n.prototype=r?O:S,n}},88012:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("16621"),c=n("32916"),s=n("56466"),a=n("41377"),f=n("81123"),p=function(t){var r=0===t,n=1===t,p=2===t,l=3===t;return function(t,v,y){i(t);var h=void 0!==v;(h||!r)&&o(v);var d=a(t),b=s("Promise"),g=d.iterator,m=d.next,x=0;return new b(function(t,o){var s=function(t){f(g,o,t,o)},a=function(){try{if(h)try{c(x)}catch(t){s(t)}b.resolve(i(e(m,g))).then(function(e){try{if(i(e).done)r?(y.length=x,t(y)):t(!l&&(p||void 0));else{var c=e.value;try{if(h){var d=v(c,x),m=function(e){if(n)a();else if(p)e?a():f(g,t,!1,o);else if(r)try{y[x++]=e,a()}catch(t){s(t)}else e?f(g,t,l||c,o):a()};u(d)?b.resolve(d).then(m,s):m(d)}else y[x++]=c,a()}catch(t){s(t)}}}catch(t){o(t)}},o)}catch(t){o(t)}};a()})}};t.exports={toArray:p(0),forEach:p(1),every:p(2),some:p(3),find:p(4)}},2403:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("16621"),c=n("41377"),s=n("57442"),a=n("78002"),f=n("81123"),p=s(function(t){var r=this,n=r.iterator,o=r.mapper;return new t(function(c,s){var p=function(t){r.done=!0,s(t)},l=function(t){f(n,p,t,p)};t.resolve(i(e(r.next,n))).then(function(n){try{if(i(n).done)r.done=!0,c(a(void 0,!0));else{var e=n.value;try{var s=o(e,r.counter++),f=function(t){c(a(t,!1))};u(s)?t.resolve(s).then(f,l):f(s)}catch(t){l(t)}}}catch(t){p(t)}},p)})});t.exports=function(t){return i(this),o(t),new p(c(this),{mapper:t})}},60181:function(t,r,n){"use strict";var e,o,i=n("2029"),u=n("90733"),c=n("10929"),s=n("85298"),a=n("4957"),f=n("73216"),p=n("62932"),l=n("20571"),v="USE_FUNCTION_CONSTRUCTOR",y=p("asyncIterator"),h=i.AsyncIterator,d=u.AsyncIteratorPrototype;if(d)e=d;else if(c(h))e=h.prototype;else if(u[v]||i[v])try{o=a(a(a(Function("return async function*(){}()")()))),a(o)===Object.prototype&&(e=o)}catch(t){}e?l&&(e=s(e)):e={},!c(e[y])&&f(e,y,function(){return this}),t.exports=e},2590:function(t,r,n){"use strict";var e=n("58401"),o=n("60015");t.exports=function(t,r,n,i){try{return i?r(e(n)[0],n[1]):r(n)}catch(r){o(t,"throw",r)}}},89399:function(t,r,n){"use strict";var e=n("50139"),o=e({}.toString),i=e("".slice);t.exports=function(t){return i(o(t),8,-1)}},20800:function(t,r,n){"use strict";var e=n("31595"),o=n("10929"),i=n("89399"),u=n("62932")("toStringTag"),c=Object,s="Arguments"===i(function(){return arguments}()),a=function(t,r){try{return t[r]}catch(t){}};t.exports=e?i:function(t){var r,n,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=a(r=c(t),u))?n:s?i(r):"Object"===(e=i(r))&&o(r.callee)?"Arguments":e}},94260:function(t,r,n){"use strict";var e=n("90794"),o=n("84693"),i=n("83389"),u=n("90221");t.exports=function(t,r,n){for(var c=o(r),s=u.f,a=i.f,f=0;f9007199254740991)throw r("Maximum allowed index exceeded");return t}},61758:function(t){"use strict";t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},83341:function(t,r,n){"use strict";var e,o,i=n("2029"),u=n("61758"),c=i.process,s=i.Deno,a=c&&c.versions||s&&s.version,f=a&&a.v8;f&&(o=(e=f.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!o&&u&&(!(e=u.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=u.match(/Chrome\/(\d+)/))&&(o=+e[1]),t.exports=o},5310:function(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30745:function(t,r,n){"use strict";var e=n("2029"),o=n("83389").f,i=n("5870"),u=n("73216"),c=n("46735"),s=n("94260"),a=n("23743");t.exports=function(t,r){var n,f,p,l,v,y=t.target,h=t.global,d=t.stat;if(n=h?e:d?e[y]||c(y,{}):e[y]&&e[y].prototype)for(f in r){if(l=r[f],p=t.dontCallGetSet?(v=o(n,f))&&v.value:n[f],!a(h?f:y+(d?".":"#")+f,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;s(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(n,f,l,t)}}},31491:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},55875:function(t,r,n){"use strict";var e=n("96144"),o=n("10038"),i=n("41693"),u=e(e.bind);t.exports=function(t,r){return o(t),void 0===r?t:i?u(t,r):function(){return t.apply(r,arguments)}}},41693:function(t,r,n){"use strict";var e=n("31491");t.exports=!e(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},44230:function(t,r,n){"use strict";var e=n("41693"),o=Function.prototype.call;t.exports=e?o.bind(o):function(){return o.apply(o,arguments)}},73820:function(t,r,n){"use strict";var e=n("25430"),o=n("90794"),i=Function.prototype,u=e&&Object.getOwnPropertyDescriptor,c=o(i,"name"),s=c&&(!e||e&&u(i,"name").configurable);t.exports={EXISTS:c,PROPER:c&&"something"===(function(){}).name,CONFIGURABLE:s}},96144:function(t,r,n){"use strict";var e=n("89399"),o=n("50139");t.exports=function(t){if("Function"===e(t))return o(t)}},50139:function(t,r,n){"use strict";var e=n("41693"),o=Function.prototype,i=o.call,u=e&&o.bind.bind(i,i);t.exports=e?u:function(t){return function(){return i.apply(t,arguments)}}},56466:function(t,r,n){"use strict";var e=n("2029"),o=n("10929");t.exports=function(t,r){var n;return arguments.length<2?o(n=e[t])?n:void 0:e[t]&&e[t][r]}},41377:function(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},60614:function(t,r,n){"use strict";var e=n("20800"),o=n("69922"),i=n("27266"),u=n("63141"),c=n("62932")("iterator");t.exports=function(t){if(!i(t))return o(t,c)||o(t,"@@iterator")||u[e(t)]}},23791:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("20226"),c=n("60614"),s=TypeError;t.exports=function(t,r){var n=arguments.length<2?c(t):r;if(o(n))return i(e(n,t));throw new s(u(t)+" is not iterable")}},69922:function(t,r,n){"use strict";var e=n("10038"),o=n("27266");t.exports=function(t,r){var n=t[r];return o(n)?void 0:e(n)}},2029:function(t,r,n){"use strict";var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof n.g&&n.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},90794:function(t,r,n){"use strict";var e=n("50139"),o=n("84962"),i=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return i(o(t),r)}},61477:function(t){"use strict";t.exports={}},19578:function(t,r,n){"use strict";var e=n("56466");t.exports=e("document","documentElement")},63391:function(t,r,n){"use strict";var e=n("25430"),o=n("31491"),i=n("7175");t.exports=!e&&!o(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},98485:function(t,r,n){"use strict";var e=n("50139"),o=n("31491"),i=n("89399"),u=Object,c=e("".split);t.exports=o(function(){return!u("z").propertyIsEnumerable(0)})?function(t){return"String"===i(t)?c(t,""):u(t)}:u},863:function(t,r,n){"use strict";var e=n("50139"),o=n("10929"),i=n("90733"),u=e(Function.toString);!o(i.inspectSource)&&(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},63827:function(t,r,n){"use strict";var e,o,i,u=n("2468"),c=n("2029"),s=n("16621"),a=n("5870"),f=n("90794"),p=n("90733"),l=n("14523"),v=n("61477"),y="Object already initialized",h=c.TypeError,d=c.WeakMap;if(u||p.state){var b=p.state||(p.state=new d);b.get=b.get,b.has=b.has,b.set=b.set,e=function(t,r){if(b.has(t))throw new h(y);return r.facade=t,b.set(t,r),r},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var g=l("state");v[g]=!0,e=function(t,r){if(f(t,g))throw new h(y);return r.facade=t,a(t,g,r),r},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!s(r)||(n=o(r)).type!==t)throw new h("Incompatible receiver, "+t+" required");return n}}}},18849:function(t,r,n){"use strict";var e=n("62932"),o=n("63141"),i=e("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[i]===t)}},10929:function(t){"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},23743:function(t,r,n){"use strict";var e=n("31491"),o=n("10929"),i=/#|\.prototype\./,u=function(t,r){var n=s[c(t)];return n===f||n!==a&&(o(r)?e(r):!!r)},c=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=u.data={},a=u.NATIVE="N",f=u.POLYFILL="P";t.exports=u},27266:function(t){"use strict";t.exports=function(t){return null==t}},16621:function(t,r,n){"use strict";var e=n("10929");t.exports=function(t){return"object"==typeof t?null!==t:e(t)}},20571:function(t){"use strict";t.exports=!1},15290:function(t,r,n){"use strict";var e=n("56466"),o=n("10929"),i=n("30882"),u=n("53209"),c=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=e("Symbol");return o(r)&&i(r.prototype,c(t))}},91524:function(t,r,n){"use strict";var e=n("55875"),o=n("44230"),i=n("58401"),u=n("20226"),c=n("18849"),s=n("56251"),a=n("30882"),f=n("23791"),p=n("60614"),l=n("60015"),v=TypeError,y=function(t,r){this.stopped=t,this.result=r},h=y.prototype;t.exports=function(t,r,n){var d,b,g,m,x,w,O,S=n&&n.that,j=!!(n&&n.AS_ENTRIES),P=!!(n&&n.IS_RECORD),E=!!(n&&n.IS_ITERATOR),I=!!(n&&n.INTERRUPTED),T=e(r,S),A=function(t){return d&&l(d,"normal",t),new y(!0,t)},_=function(t){return j?(i(t),I?T(t[0],t[1],A):T(t[0],t[1])):I?T(t,A):T(t)};if(P)d=t.iterator;else if(E)d=t;else{if(!(b=p(t)))throw new v(u(t)+" is not iterable");if(c(b)){for(g=0,m=s(t);m>g;g++)if((x=_(t[g]))&&a(h,x))return x;return new y(!1)}d=f(t,b)}for(w=P?t.next:d.next;!(O=o(w,d)).done;){try{x=_(O.value)}catch(t){l(d,"throw",t)}if("object"==typeof x&&x&&a(h,x))return x}return new y(!1)}},60015:function(t,r,n){"use strict";var e=n("44230"),o=n("58401"),i=n("69922");t.exports=function(t,r,n){var u,c;o(t);try{if(!(u=i(t,"return"))){if("throw"===r)throw n;return n}u=e(u,t)}catch(t){c=!0,u=t}if("throw"===r)throw n;if(c)throw u;return o(u),n}},67498:function(t,r,n){"use strict";var e=n("44230"),o=n("85298"),i=n("5870"),u=n("69763"),c=n("62932"),s=n("63827"),a=n("69922"),f=n("44999").IteratorPrototype,p=n("78002"),l=n("60015"),v=c("toStringTag"),y="IteratorHelper",h="WrapForValidIterator",d=s.set,b=function(t){var r=s.getterFor(t?h:y);return u(o(f),{next:function(){var n=r(this);if(t)return n.nextHandler();try{var e=n.done?void 0:n.nextHandler();return p(e,n.done)}catch(t){throw n.done=!0,t}},return:function(){var n=r(this),o=n.iterator;if(n.done=!0,t){var i=a(o,"return");return i?e(i,o):p(void 0,!0)}if(n.inner)try{l(n.inner.iterator,"normal")}catch(t){return l(o,"throw",t)}return l(o,"normal"),p(void 0,!0)}})},g=b(!0),m=b(!1);i(m,v,"Iterator Helper"),t.exports=function(t,r){var n=function(n,e){e?(e.iterator=n.iterator,e.next=n.next):e=n,e.type=r?h:y,e.nextHandler=t,e.counter=0,e.done=!1,d(this,e)};return n.prototype=r?g:m,n}},24138:function(t,r,n){"use strict";var e=n("44230"),o=n("10038"),i=n("58401"),u=n("41377"),c=n("67498"),s=n("2590"),a=c(function(){var t=this.iterator,r=i(e(this.next,t));if(!(this.done=!!r.done))return s(t,this.mapper,[r.value,this.counter++],!0)});t.exports=function(t){return i(this),o(t),new a(u(this),{mapper:t})}},44999:function(t,r,n){"use strict";var e,o,i,u=n("31491"),c=n("10929"),s=n("16621"),a=n("85298"),f=n("4957"),p=n("73216"),l=n("62932"),v=n("20571"),y=l("iterator"),h=!1;[].keys&&("next"in(i=[].keys())?(o=f(f(i)))!==Object.prototype&&(e=o):h=!0),!s(e)||u(function(){var t={};return e[y].call(t)!==t})?e={}:v&&(e=a(e)),!c(e[y])&&p(e,y,function(){return this}),t.exports={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:h}},63141:function(t){"use strict";t.exports={}},56251:function(t,r,n){"use strict";var e=n("27572");t.exports=function(t){return e(t.length)}},27623:function(t,r,n){"use strict";var e=n("50139"),o=n("31491"),i=n("10929"),u=n("90794"),c=n("25430"),s=n("73820").CONFIGURABLE,a=n("863"),f=n("63827"),p=f.enforce,l=f.get,v=String,y=Object.defineProperty,h=e("".slice),d=e("".replace),b=e([].join),g=c&&!o(function(){return 8!==y(function(){},"length",{value:8}).length}),m=String(String).split("String"),x=t.exports=function(t,r,n){"Symbol("===h(v(r),0,7)&&(r="["+d(v(r),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!u(t,"name")||s&&t.name!==r)&&(c?y(t,"name",{value:r,configurable:!0}):t.name=r),g&&n&&u(n,"arity")&&t.length!==n.arity&&y(t,"length",{value:n.arity});try{n&&u(n,"constructor")&&n.constructor?c&&y(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var e=p(t);return!u(e,"source")&&(e.source=b(m,"string"==typeof r?r:"")),t};Function.prototype.toString=x(function(){return i(this)&&l(this).source||a(this)},"toString")},22309:function(t){"use strict";var r=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?n:r)(e)}},85298:function(t,r,n){"use strict";var e,o=n("58401"),i=n("33342"),u=n("5310"),c=n("61477"),s=n("19578"),a=n("7175"),f=n("14523"),p="prototype",l="script",v=f("IE_PROTO"),y=function(){},h=function(t){return"<"+l+">"+t+""},d=function(t){t.write(h("")),t.close();var r=t.parentWindow.Object;return t=null,r},b=function(){var t,r=a("iframe");return r.style.display="none",s.appendChild(r),r.src=String("java"+l+":"),(t=r.contentWindow.document).open(),t.write(h("document.F=Object")),t.close(),t.F},g=function(){try{e=new ActiveXObject("htmlfile")}catch(t){}g="undefined"!=typeof document?document.domain&&e?d(e):b():d(e);for(var t=u.length;t--;)delete g[p][u[t]];return g()};c[v]=!0,t.exports=Object.create||function(t,r){var n;return null!==t?(y[p]=o(t),n=new y,y[p]=null,n[v]=t):n=g(),void 0===r?n:i.f(n,r)}},33342:function(t,r,n){"use strict";var e=n("25430"),o=n("31757"),i=n("90221"),u=n("58401"),c=n("65852"),s=n("51387");r.f=e&&!o?Object.defineProperties:function(t,r){u(t);for(var n,e=c(r),o=s(r),a=o.length,f=0;a>f;)i.f(t,n=o[f++],e[n]);return t}},90221:function(t,r,n){"use strict";var e=n("25430"),o=n("63391"),i=n("31757"),u=n("58401"),c=n("76248"),s=TypeError,a=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",v="writable";r.f=e?i?function(t,r,n){if(u(t),r=c(r),u(n),"function"==typeof t&&"prototype"===r&&"value"in n&&v in n&&!n[v]){var e=f(t,r);e&&e[v]&&(t[r]=n.value,n={configurable:l in n?n[l]:e[l],enumerable:p in n?n[p]:e[p],writable:!1})}return a(t,r,n)}:a:function(t,r,n){if(u(t),r=c(r),u(n),o)try{return a(t,r,n)}catch(t){}if("get"in n||"set"in n)throw new s("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},83389:function(t,r,n){"use strict";var e=n("25430"),o=n("44230"),i=n("38574"),u=n("79855"),c=n("65852"),s=n("76248"),a=n("90794"),f=n("63391"),p=Object.getOwnPropertyDescriptor;r.f=e?p:function(t,r){if(t=c(t),r=s(r),f)try{return p(t,r)}catch(t){}if(a(t,r))return u(!o(i.f,t,r),t[r])}},21046:function(t,r,n){"use strict";var e=n("76565"),o=n("5310").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},90505:function(t,r){"use strict";r.f=Object.getOwnPropertySymbols},4957:function(t,r,n){"use strict";var e=n("90794"),o=n("10929"),i=n("84962"),u=n("14523"),c=n("97011"),s=u("IE_PROTO"),a=Object,f=a.prototype;t.exports=c?a.getPrototypeOf:function(t){var r=i(t);if(e(r,s))return r[s];var n=r.constructor;return o(n)&&r instanceof n?n.prototype:r instanceof a?f:null}},30882:function(t,r,n){"use strict";var e=n("50139");t.exports=e({}.isPrototypeOf)},76565:function(t,r,n){"use strict";var e=n("50139"),o=n("90794"),i=n("65852"),u=n("20047").indexOf,c=n("61477"),s=e([].push);t.exports=function(t,r){var n,e=i(t),a=0,f=[];for(n in e)!o(c,n)&&o(e,n)&&s(f,n);for(;r.length>a;)o(e,n=r[a++])&&(~u(f,n)||s(f,n));return f}},51387:function(t,r,n){"use strict";var e=n("76565"),o=n("5310");t.exports=Object.keys||function(t){return e(t,o)}},38574:function(t,r){"use strict";var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!n.call({1:2},1);r.f=o?function(t){var r=e(this,t);return!!r&&r.enumerable}:n},20775:function(t,r,n){"use strict";var e=n("44230"),o=n("10929"),i=n("16621"),u=TypeError;t.exports=function(t,r){var n,c;if("string"===r&&o(n=t.toString)&&!i(c=e(n,t))||o(n=t.valueOf)&&!i(c=e(n,t))||"string"!==r&&o(n=t.toString)&&!i(c=e(n,t)))return c;throw new u("Can't convert object to primitive value")}},84693:function(t,r,n){"use strict";var e=n("56466"),o=n("50139"),i=n("21046"),u=n("90505"),c=n("58401"),s=o([].concat);t.exports=e("Reflect","ownKeys")||function(t){var r=i.f(c(t)),n=u.f;return n?s(r,n(t)):r}},84737:function(t){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},38982:function(t,r,n){"use strict";var e=n("27266"),o=TypeError;t.exports=function(t){if(e(t))throw new o("Can't call method on "+t);return t}},14523:function(t,r,n){"use strict";var e=n("79683"),o=n("60211"),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},90733:function(t,r,n){"use strict";var e=n("20571"),o=n("2029"),i=n("46735"),u="__core-js_shared__",c=t.exports=o[u]||i(u,{});(c.versions||(c.versions=[])).push({version:"3.36.0",mode:e?"pure":"global",copyright:"\xa9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE",source:"https://github.com/zloirock/core-js"})},79683:function(t,r,n){"use strict";var e=n("90733");t.exports=function(t,r){return e[t]||(e[t]=r||{})}},6532:function(t,r,n){"use strict";var e=n("83341"),o=n("31491"),i=n("2029").String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t) instanceof Symbol)||!Symbol.sham&&e&&e<41})},58602:function(t,r,n){"use strict";var e=n("68811"),o=Math.max,i=Math.min;t.exports=function(t,r){var n=e(t);return n<0?o(n+r,0):i(n,r)}},65852:function(t,r,n){"use strict";var e=n("98485"),o=n("38982");t.exports=function(t){return e(o(t))}},68811:function(t,r,n){"use strict";var e=n("22309");t.exports=function(t){var r=+t;return r!=r||0===r?0:e(r)}},27572:function(t,r,n){"use strict";var e=n("68811"),o=Math.min;t.exports=function(t){var r=e(t);return r>0?o(r,9007199254740991):0}},84962:function(t,r,n){"use strict";var e=n("38982"),o=Object;t.exports=function(t){return o(e(t))}},28466:function(t,r,n){"use strict";var e=n("44230"),o=n("16621"),i=n("15290"),u=n("69922"),c=n("20775"),s=n("62932"),a=TypeError,f=s("toPrimitive");t.exports=function(t,r){if(!o(t)||i(t))return t;var n,s=u(t,f);if(s){if(void 0===r&&(r="default"),!o(n=e(s,t,r))||i(n))return n;throw new a("Can't convert object to primitive value")}return void 0===r&&(r="number"),c(t,r)}},76248:function(t,r,n){"use strict";var e=n("28466"),o=n("15290");t.exports=function(t){var r=e(t,"string");return o(r)?r:r+""}},31595:function(t,r,n){"use strict";var e=n("62932")("toStringTag"),o={};o[e]="z",t.exports="[object z]"===String(o)},49347:function(t,r,n){"use strict";var e=n("20800"),o=String;t.exports=function(t){if("Symbol"===e(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},20226:function(t){"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},60211:function(t,r,n){"use strict";var e=n("50139"),o=0,i=Math.random(),u=e(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},53209:function(t,r,n){"use strict";var e=n("6532");t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},31757:function(t,r,n){"use strict";var e=n("25430"),o=n("31491");t.exports=e&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},12922:function(t){"use strict";var r=TypeError;t.exports=function(t,n){if(tt.length)&&(r=t.length);for(var n=0,e=Array(r);n=0||({}).propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},7358:function(t,r,n){"use strict";function e(t,r){if(null==t)return{};var n={};for(var e in t)if(({}).hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}n.d(r,{Z:function(){return e}})},77871:function(t,r,n){"use strict";function e(t,r){return(e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t})(t,r)}n.d(r,{Z:function(){return e}})},29618:function(t,r,n){"use strict";n.d(r,{Z:function(){return c}});var e=n("77748"),o=n("73014"),i=n("93318"),u=n("29500");function c(t){return(0,e.Z)(t)||(0,o.Z)(t)||(0,i.Z)(t)||(0,u.Z)()}},64735:function(t,r,n){"use strict";n.d(r,{Z:function(){return o}});var e=n("74929");function o(t,r){if("object"!=(0,e.Z)(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=(0,e.Z)(o))return o;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}},32693:function(t,r,n){"use strict";n.d(r,{Z:function(){return i}});var e=n("74929"),o=n("64735");function i(t){var r=(0,o.Z)(t,"string");return"symbol"==(0,e.Z)(r)?r:r+""}},74929:function(t,r,n){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.d(r,{Z:function(){return e}})},93318:function(t,r,n){"use strict";n.d(r,{Z:function(){return o}});var e=n("17701");function o(t,r){if(t){if("string"==typeof t)return(0,e.Z)(t,r);var n=({}).toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,e.Z)(t,r):void 0}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/lib-polyfill.7aec7d99.js.LICENSE.txt b/modern-js/module-tools/static/js/lib-polyfill.d1077309.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/lib-polyfill.7aec7d99.js.LICENSE.txt rename to modern-js/module-tools/static/js/lib-polyfill.d1077309.js.LICENSE.txt index 74ef9a2fa0..488666b27c 100644 --- a/modern-js/module-tools/static/js/lib-polyfill.7aec7d99.js.LICENSE.txt +++ b/modern-js/module-tools/static/js/lib-polyfill.d1077309.js.LICENSE.txt @@ -18,8 +18,6 @@ /*! ../internals/global */ -/*! ./arrayLikeToArray.js */ - /*! ../internals/v8-prototype-define-bug */ /*! ../internals/define-built-in */ @@ -28,8 +26,6 @@ /*! ../internals/internal-state */ -/*! ./toPropertyKey.js */ - /*! ../internals/export */ /*! ../internals/is-pure */ @@ -66,12 +62,12 @@ /*! ../internals/get-method */ -/*! ./arrayWithoutHoles.js */ - /*! ../internals/define-built-in */ /*! ../internals/document-create-element */ +/*! ./nonIterableSpread.js */ + /*! ../internals/export */ /*! ../internals/define-built-in-accessor */ @@ -90,8 +86,6 @@ /*! ../internals/an-instance */ -/*! ./typeof.js */ - /*! ../internals/iterators-core */ /*! ../internals/export */ @@ -102,6 +96,8 @@ /*! ../internals/is-forced */ +/*! ./objectWithoutPropertiesLoose.js */ + /*! ../internals/well-known-symbol */ /*! ../internals/get-method */ @@ -120,8 +116,6 @@ /*! ../internals/function-call */ -/*! ./toPrimitive.js */ - /*! ../internals/global */ /*! ../internals/to-indexed-object */ @@ -154,6 +148,8 @@ /*! ../internals/is-callable */ +/*! ./arrayLikeToArray.js */ + /*! ../internals/function-uncurry-this */ /*! ../internals/fails */ @@ -206,8 +202,6 @@ /*! ../internals/use-symbol-as-uid */ -/*! ./iterableToArray.js */ - /*! ../internals/shared-key */ /*! ../internals/define-global-property */ @@ -222,6 +216,8 @@ /*! ../internals/well-known-symbol */ +/*! ./unsupportedIterableToArray.js */ + /*! ../internals/length-of-array-like */ /*! ../internals/an-object */ @@ -340,8 +336,6 @@ /*! ../internals/get-iterator-direct */ -/*! ./setPrototypeOf.js */ - /*! ../internals/function-call */ /*! ../internals/function-call */ @@ -350,8 +344,6 @@ /*! ../internals/indexed-object */ -/*! ./nonIterableSpread.js */ - /*! ../internals/descriptors */ /*! ../internals/create-iter-result-object */ @@ -394,6 +386,8 @@ /*! ../internals/try-to-string */ +/*! ./setPrototypeOf.js */ + /*! ../internals/is-object */ /*! ../internals/a-callable */ @@ -404,9 +398,9 @@ /*! ../internals/has-own-property */ -/*! ../internals/get-built-in */ +/*! ./typeof.js */ -/*! ./arrayLikeToArray.js */ +/*! ../internals/get-built-in */ /*! ../internals/create-property */ @@ -444,6 +438,8 @@ /*! ../internals/shared-key */ +/*! ./arrayWithoutHoles.js */ + /*! ../internals/ordinary-to-primitive */ /*! ../internals/object-keys-internal */ @@ -452,8 +448,6 @@ /*! ../internals/a-callable */ -/*! ./unsupportedIterableToArray.js */ - /*! ../internals/an-object */ /*! ../internals/object-get-own-property-names */ @@ -462,6 +456,8 @@ /*! ../internals/an-object */ +/*! ./typeof.js */ + /*! ../internals/object-define-property */ /*! ../internals/object-is-prototype-of */ @@ -490,7 +486,7 @@ /*! ../internals/is-callable */ -/*! ./objectWithoutPropertiesLoose.js */ +/*! ./toPrimitive.js */ /*! ../internals/global */ @@ -578,6 +574,8 @@ /*! ../internals/html */ +/*! ./iterableToArray.js */ + /*! ../internals/try-to-string */ /*! ../internals/object-get-prototype-of */ @@ -592,8 +590,12 @@ /*! ../internals/fails */ +/*! ./arrayLikeToArray.js */ + /*! ../internals/iterators-core */ +/*! ./toPropertyKey.js */ + /*! ../internals/function-call */ /*! ../internals/hidden-keys */ @@ -634,8 +636,6 @@ /*! ../internals/to-object */ -/*! ./typeof.js */ - /*! ../internals/define-global-property */ /*! ../internals/global */ \ No newline at end of file diff --git a/modern-js/module-tools/static/search_index.en.2cd9fa42.json b/modern-js/module-tools/static/search_index.en.ea8d594a.json similarity index 78% rename from modern-js/module-tools/static/search_index.en.2cd9fa42.json rename to modern-js/module-tools/static/search_index.en.ea8d594a.json index 917af4dd84..ba0f15ea47 100644 --- a/modern-js/module-tools/static/search_index.en.2cd9fa42.json +++ b/modern-js/module-tools/static/search_index.en.ea8d594a.json @@ -1 +1 @@ -[{"id":0,"title":"buildConfig","content":"#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. It contains all the configurations related to the build\nprocess.\n\n * Type: object | object[]\n\nTIP\n\nBefore start using buildConfig, please read the following documentation to\nunderstand its purpose:\n\n * Modifying Output Artifacts\n * In-Depth Understanding of the Build Process\n\n\nalias#\n\n * Type: Record | Function\n * Default: {'@': 'src',}\n\nTIP\n\nFor TypeScript projects, you only need to configure compilerOptions.paths in\ntsconfig.json, Modern.js Module will automatically recognize the alias in\ntsconfig.json, so there is no need to configure the alias field additionally.\n\n\n\nAfter the above configuration is done, if @common/Foo.tsx is referenced in the\ncode, it will map to the /src/common/Foo.tsx path.\n\nWhen the value of alias is defined as a function, you can accept the pre-defined\nalias object and modify it.\n\n\n\nIt is also possible to return a new object as the final result in the function,\nwhich will override the pre-defined alias object.\n\n\n\n\nasset#\n\nContains configuration related to static assets.\n\n\nasset.name#\n\nStatic resource output file name.\n\n * Type: string | ((assetPath) => name)\n * Default: [name].[hash].[ext]\n\nWhen asset.name is a string, it will automatically replace [name], [ext], and\n[hash], respectively replaced by the file name, extension, and file hash.\n\nAlso you can use asset.name as a function, and the return is output asset name.\nAt this time, this function receives a parameter assetPath, which corresponds to\nthe resource path.\n\n\n\n\nasset.limit#\n\nUsed to set the threshold for static assets to be automatically inlined as\nbase64.\n\nBy default, Modern.js Module will inline assets such as images, fonts and media\nsmaller than 10KB during bundling. They are Base64 encoded and inlined in the\nbundles, eliminating the need for separate HTTP requests.\n\nYou can adjust this threshold by modifying the limit config.\n\n * Type: number\n * Default: 10 * 1024\n\nFor example, set limit to 0 to avoid assets inlining:\n\n\n\n\nasset.path#\n\nStatic resource output path, will be based on outDir\n\n * Type: string\n * Default: assets\n\n\nasset.publicPath#\n\nThe CDN prefix given to unlinked assets when bundling.\n\n * Type: string\n * Default: undefined\n\n\n\nAt this point, all static assets will be prefixed with https://xxx/.\n\n\nasset.svgr#\n\nPackaged to handle svg as a React component, options reference svgr, plus\nsupport for two configuration options include and exclude to match the svg file\nto be handled\n\n * Type: boolean | object\n * Default: false\n\nWhen svgr feature is enabled, you can use svg as a component using the default\nexport.\n\n\n\nWhen enabled, the type of svg used can be modified by initing a new declaration\nfile and adding to the modern-app-env.d.ts:\n\n\n\n\n\n\nasset.svgr.include#\n\nSet the matching svg file\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: /\\.svg$/\n\n\nasset.svgr.exclude#\n\nSet unmatched svg files\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: undefined\n\n\nasset.svgr.exportType#\n\nUsed to configure the SVG export type when using SVGR.\n\n * Type: 'named' | 'default'\n * Default: default\n\nwhen it is 'named', use the following syntax:\n\n\n\nThe named export defaults to ReactComponent, and can be customized with the\nasset.svgr.namedExport.\n\n\nautoExtension#\n\nSuffixes for js files and type description files in automation based on format\nand type.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\nWhen disabled, js artifacts are suffixed with .js and type description files are\nsuffixed with d.ts.\n\nWhen enabled, node loads .js as esm by default when type is module, so when we\nwant to output cjs artifacts, the js product is suffixed with .cjs and the type\ndescription file is suffixed with d.cts.\n\nOn the other hand, if the type field is missing or the type is commonjs, node\nloads the .js file as cjs by default. So when we want to output esm output, the\njs output is suffixed with .mjs and the type description file is suffixed with\nd.mts.\n\n:::warning When used in bundleless mode, we have an extra step of processing the\nimport/export statement in each file. We will suffix the relative path to the js\nfile, possibly .mjs or .cjs, depending on your package configuration. You can\ndisable this step by redirect.autoExtension.\n\nNotice noUselessIndex will break this behavior, you should disable it. If you\nneed to use this configuration in bundleless, please patch the index, e.g. if\nutils is a folder, you need to rewrite to\n\n\n\n\nautoExternal#\n\nAutomatically externalize project dependencies and peerDependencies and not\npackage them into the final bundle\n\n * Type: boolean | object\n * Default: true\n\nWhen we want to turn off the default handling behavior for third-party\ndependencies, we can do so by:\n\n\n\nThis way the dependencies under \"dependencies\" and \"peerDependencies\" will be\nbundled. If you want to turn off the processing of only one of these\ndependencies, you can use the buildConfig.autoExternal in the form of an object.\n\n\n\n\nautoExternal.dependencies#\n\nWhether or not the dep dependencies of the external project are needed\n\n * Type: boolean\n * Default: true\n\n\nautoExternal.peerDependencies#\n\nWhether to require peerDep dependencies for external projects\n\n * Type: boolean\n * Default: true\n\n\nbanner#\n\nProvides the ability to inject content into the top and bottom of each JS , CSS\nand DTS file.\n\n\n\n * Type: BannerAndFooter\n * Default: {}\n * Version: >=2.36.0\n\nLet's say you want to add copyright information to JS and CSS files.\n\n\n\n\nbuildType#\n\nThe build type, bundle will package your code, bundleless will only do the code\nconversion\n\n * Type: 'bundle' | 'bundleless'\n * Default: 'bundle'\n\n\ncopy#\n\nCopies the specified file or directory into the build output directory\n\n * Type: object[]\n * Default: []\n\n\n\nReference for array settings: copy-webpack-plugin patterns\n\n\ncopy.patterns#\n\n * Type: CopyPattern[]\n * Default: []\n\n\n\n\ncopy.options#\n\n * Type:\n\n\n\n * Default: { concurrency: 100, enableCopySync: false }\n\n * concurrency: Specifies how many copy tasks to execute in parallel.\n\n * enableCopySync: Uses fs.copySync by default, instead of fs.copy.\n\n\ndefine#\n\nDefine global variables that will be injected into the code\n\n * Type: Record\n * Default: {}\n\nSince the define function is implemented by global text replacement, you need to\nensure that the global variable values are strings. A safer approach is to\nconvert the value of each global variable to a string, as follows.\n\nINFO\n\nModern.js automatically performs JSON serialization handling internally, so\nmanual serialization is not required.\n\nIf automatic serialization is not needed, you can define alias using\nesbuildOptions configuration.\n\n\n\nIf the project is a TypeScript project, then you may need to add the following\nto the .d.ts file in the project source directory.\n\n> If the .d.ts file does not exist, then you can create it manually.\n\n\n\nYou can also replace environment variable:\n\n\n\nWith the above configuration, we can put the following code.\n\n\n\nWhen executing VERSION=1.0.0 modern build, the conversion is:\n\n\n\nTIP\n\nTo prevent excessive global replacement substitution, it is recommended that the\nfollowing two principles be followed when using\n\n * Use upper case for global constants\n * Customize the prefix and suffix of global constants to ensure uniqueness\n\n\ndts#\n\nThe dts file generates the relevant configuration, by default it generates.\n\n * Type: false | object\n * Default:\n\n\n\n\ndts.abortOnError#\n\nWhether to allow the build to succeed if a type error occurs.\n\n * Type: boolean\n * Default: true\n\nBy default, type errors will cause the build to fail. When abortOnError is set\nto false, the build will still succeed even if there are type issues in the\ncode:\n\n\n\nWARNING\n\nWhen this configuration is disabled, there is no guarantee that the type files\nwill be generated correctly. In buildType: 'bundle', which is the bundle mode,\ntype files will not be generated.\n\n\ndts.distPath#\n\nThe output path of the dts file, based on outDir\n\n * Type: string\n * Default: ./\n\nFor example, output to the types directory under the outDir:\n\n\n\n\ndts.enableTscBuild#\n\nEnable the tsc '--build' option. When using project reference, you can use the\n'--build' option to achieve cooperation between projects and speed up the build\nspeed.\n\nThis option requires version > 2.43.0,In fact, we experimentally enabled this\noption in the 2.42.0 version, but the many problems it brought forced us to\nenable it dynamically.\n\n\n\n * Type: boolean\n * Default: false\n * Version: >2.43.0\n\n\n\n\ndts.only#\n\nWhether to generate only type files during the build process without generating\nJavaScript output files.\n\n * Type: boolean\n * Default: false\n\n\n\n\ndts.tsconfigPath#\n\ndeprecated,use tsconfig instead.\n\nSpecifies the path to the tsconfig file used to generate the type file.\n\n\n\n\ndts.respectExternal#\n\nWhen set to false, the type of third-party packages will be excluded from the\nbundle, when set to true, it will determine whether third-party types need to be\nbundled based on externals.\n\nWhen bundle d.ts, export is not analyzed, so any third-party package type you\nuse may break your build, which is obviously uncontrollable. So we can avoid it\nwith this configuration.\n\n * Type: boolean\n * Default: true\n\n\n\n\nesbuildOptions#\n\nUsed to modify the esbuild configuration.\n\n * Type: Function\n * Build Type: Only supported for buildType: 'bundle'\n * Default: c => c\n\nFor example, if we need to modify the file extension of the generated files:\n\n\n\nFor example, register an esbuild plugin:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\nTIP\n\nWe have done many extensions based on the original esbuild build. Therefore,\nwhen using this configuration, pay attention to the following:\n\n 1. Prefer to use the configuration that Modern.js Module provides. For example,\n esbuild does not support target: 'es5', but we support this scenario\n internally using SWC. Setting target: 'es5' through esbuildOptions will\n result in an error.\n 2. Currently, we use enhanced-resolve internally to replace esbuild's resolve\n algorithm, so modifying esbuild resolve-related configurations is invalid.\n We plan to switch back in the future.\n\n\nexternalHelpers#\n\nBy default, the output JS code may depend on helper functions to support the\ntarget environment or output format, and these helper functions will be inlined\nin the file that requires it.\n\nWith this configuration, the code will be converted using SWC, it will inline\nhelper functions to import them from the external module @swc/helpers.\n\n * Type: boolean\n * Default: false\n\nBelow is a comparison of the output file changes before and after using this\nconfiguration.\n\nBefore enable:\n\n\n\nAfter enabled:\n\n\n\n\nexternals#\n\nConfigure external dependencies that will not be bundled into the final bundle.\n\n * Type:\n\n\n\n * Default: []\n * Build Type: Only supported for buildType: 'bundle'\n * Example:\n\n\n\n\nfooter#\n\nSame as the banner configuration for adding a comment at the end of the output\nfile.\n\n\nformat#\n\nUsed to set the output format of JavaScript files. The options iife and umd only\ntake effect when buildType is bundle.\n\n * Type: 'esm' | 'cjs' | 'iife' | 'umd'\n * Default: cjs\n\n\nformat: esm#\n\nesm stands for \"ECMAScript module\" and requires the runtime environment to\nsupport import and export syntax.\n\n * Example:\n\n\n\n\nformat: cjs#\n\ncjs stands for \"CommonJS\" and requires the runtime environment to support\nexports, require, and module syntax. This format is commonly used in Node.js\nenvironments.\n\n * Example:\n\n\n\n\nformat: iife#\n\niife stands for \"immediately-invoked function expression\" and wraps the code in\na function expression to ensure that any variables in the code do not\naccidentally conflict with variables in the global scope. This format is\ncommonly used in browser environments.\n\n * Example:\n\n\n\n\nformat: umd#\n\numd stands for \"Universal Module Definition\" and is used to run modules in\ndifferent environments such as browsers and Node.js. Modules in UMD format can\nbe used in various environments, either as global variables or loaded as modules\nusing module loaders like RequireJS.\n\n * Example:\n\n\n\n\nhooks#\n\nBuild lifecycle hooks that allow custom logic to be injected at specific stages\nof the build process.\n\n * Types:\n\n\n\n * Default: [].\n\nWe can get the compiler instance in the apply method, modify its properties, and\nexecute custom logic at different stages. For more information on Hooks, see\n[Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in\nthe Build Process]). For more information on Hooks, see\nUsing-hooks-to-intervene-in-the-build-process.\n\n\n\n\ninput#\n\nSpecify the entry file for the build, in the form of an array that can specify\nthe directory\n\n * Type:\n\n\n\n * Default: ['src/index.ts'] in bundle mode, ['src'] in bundleless mode\n\nArray usage:\n\nIn bundle mode, the following configurations will be built using src/index.ts\nand src/index2.ts as entry points. The bundle mode does not support configuring\ninput as a directory.\n\n\n\nIn bundleless mode, the following configuration compiles both files in the src/a\ndirectory and src/index.ts file.\n\n\n\nIn bundleless mode, Array usage also supports the usage of ! to filter partial\nfiles:\n\n\n\nThe above configuration will build the files in the src directory, and will also\nfilter files with the spec.ts suffix.This is useful in cases where the test\nfiles are in the same root directory as the source files.\n\nObject usage:\n\nWhen you need to modify the output file name in bundle mode, you can use an\nobject configuration.\n\nThe key of the object is the file name of the output, and the value is the file\npath of the source code.\n\n\n\n\njsx#\n\nSpecify the compilation method for JSX, which by default supports React 17 and\nhigher versions and automatically injects JSX runtime code.\n\n * Type: automatic | transform\n * Default: automatic\n\nIf you need to support React 16, you can set jsx to transform:\n\n\n\nTIP\n\nIf you don't need to convert JSX, you can set jsx to preserve, but don't use swc\nto do the code conversion. For more information about JSX Transform, you can\nrefer to the following links:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX. :::\n\n\nmetafile#\n\nThis option is used for build analysis. When enabled, esbuild will generate\nmetadata about the build in JSON format.\n\n * Type: boolean\n * Default: false\n * Build Type: Only supported for buildType: 'bundle'\n\nTo enable metafile generation:\n\n\n\nAfter executing the build, a metafile-[xxx].json file will be generated in the\noutput directory. You can use tools like esbuild analyze and bundle-buddy for\nvisual analysis.\n\n\nminify#\n\nUse esbuild or terser to compress code, also pass terserOptions\n\n * Type: 'terser' | 'esbuild' | false | object\n * Default: false\n\n\n\n\noutDir#\n\nSpecifies the output directory of the build.\n\n * Type: string\n * Default: ./dist\n\n\n\n\nplatform#\n\nGenerates code for the node environment by default, you can also specify browser\nwhich will generate code for the browser environment. See esbuild.platform learn\nmore.\n\n * Type: 'browser' | 'node'\n * Default: 'node'\n\n\n\n\nredirect#\n\nIn buildType: 'bundleless' build mode, the reference path is redirected to\nensure that it points to the correct product, e.g:\n\n * import '. /index.less' will be rewritten to import '. /index.css'\n * would be rewritten as to `` (depending on the situation)\n * will be rewritten to (if generate utils.mjs, depending on the situation)\n\nIn some scenarios, you may not need these functions, then you can turn it off\nwith this configuration, and its reference path will not be changed after\nturning it off.\n\n\n\n\nresolve#\n\nCustom module resolution options\n\n\nresolve.mainFields#\n\nA list of fields in package.json to try when parsing the package entry point.\n\n * Type: string[]\n * Default: depends on platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * Version: >=2.36.0\n\nFor example, we want to load the js:source field first:\n\n\n\n:::warning resolve.mainFields has a lower priority than the exports field in\npackage.json, and if an entry point is successfully resolved from exports,\nresolve.mainFields will be ignored.\n\n\nresolve.jsExtentions#\n\nSupport for implicit file extensions\n\n * Type: string[]\n * Default: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * Version: >=2.36.0\n\nDo not use implicit file extensions for css files, currently Module only\nsupports ['.less', '.css', '.sass', '.scss'] suffixes.\n\nNode's parsing algorithm does not consider .mjs and cjs as implicit file\nextensions, so they are not included here by default, but can be included by\nchanging this configuration:\n\n\n\n\nshims#\n\nWhen building CommonJS/ESM artifacts, inject some polyfill code such as\n__dirname which can only be used in CommonJS. After enable this option, it will\ncompile __dirname as path.dirname(fileURLToPath(import.meta.url)) when format is\nesm.\n\nSee details here, Note that esm shims will only be injected if platform is node,\nbecause the url module is used.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\n\n\n\nsideEffects#\n\nModule sideEffects\n\n * Type: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * Default: undefined\n\nNormally, we configure the module's side effects via the sideEffects field in\npackage.json, but in some cases, The package.json of a third-party package is\nunreliable.Such as when we reference a third-party package style file\n\n\n\nBut the package.json of this third-party package does not have the style file\nconfigured in the sideEffects\n\n\n\nAt the same time you set style.inject to true and you will see a warning message\nlike this in the console\n\n\n\nAt this point, you can use this configuration option to manually configure the\nmodule's \"sideEffects\" to support regular and functional forms.\n\n\n\nTIP\n\nAfter adding this configuration, the sideEffects field in package.json will no\nlonger be read when packaging\n\n\nsourceDir#\n\nSpecify the source directory of the build, default is src, which is used to\ngenerate the corresponding output directory based on the source directory\nstructure when building bundleless. Same as esbuild.outbase.\n\n * Type: string\n * Default: src\n\n\nsourceMap#\n\nWhether to generate sourceMap or not\n\n * Type: boolean | 'inline' | 'external'\n * Default: false\n\n\nsourceType#\n\nSets the format of the source code. By default, the source code will be treated\nas EsModule. When the source code is using CommonJS, you need to set commonjs.\n\n * Type: 'commonjs' | 'module'\n * Default: 'module'\n\n\nsplitting#\n\nWhether to enable code splitting. Only support format: 'esm' and format:\n'cjs',see esbuild.splitting learn more.\n\n * Type: boolean\n * Default: false\n\n\nstyle#\n\nConfigure style-related configuration\n\n\nstyle.less#\n\nless-related configuration\n\n\nstyle.less.lessOptions#\n\nRefer to less for detailed configuration\n\n * Type: object\n * Default: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\nAdd Less code to the beginning of the entry file.\n\n * Type: string\n * Default: undefined\n\n\n\n\nstyle.less.implementation#\n\nConfigure the implementation library used by Less, if not specified, the\nbuilt-in version used is 4.1.3.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Less when the object type is specified.\n\n\n\nFor the string type, specify the path to the implementation library for Less\n\n\n\n\nstyle.sass#\n\nsass-related configuration.\n\n\nstyle.sass.sassOptions#\n\nRefer to node-sass for detailed configuration.\n\n * Type: object\n * Default: {}\n\n\nstyle.sass.additionalData#\n\nAdd Sass code to the beginning of the entry file.\n\n * Type: string | Function\n * Default: undefined\n\n\n\n\nstyle.sass.implementation#\n\nConfigure the implementation library used by Sass, the built-in version used is\n1.5.4 if not specified.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Sass when the object type is specified.\n\n\n\nFor the string type, specify the path to the Sass implementation library\n\n\n\n\nstyle.postcss#\n\nUsed to configure options for PostCSS. The provided values will be merged with\nthe default configuration using Object.assign. Note that Object.assign performs\na shallow copy, so it will completely override the built-in plugins array.\n\nFor detailed configuration, please refer to PostCSS.\n\n * Type:\n\n\n\n * Default:\n\n\n\n * Example:\n\n\n\n\nstyle.inject#\n\nConfigure whether to insert CSS styles into JavaScript code in bundle mode.\n\n * Type: boolean\n * Default: false\n\nSet inject to true to enable this feature:\n\n\n\nOnce enabled, you will see the CSS code referenced in the source code included\nin the bundled JavaScript output.\n\nFor example, if you write import './index.scss' in the source code, you will see\nthe following code in the output:\n\n\n\nTIP\n\nAfter enabling inject, you need to pay attention to the following points:\n\n * @import in CSS files will not be processed. If your CSS file contains\n @import, you need to manually import the CSS file in the JS file (less and\n scss files are not required because they have preprocessing).\n * Consider the impact of sideEffects. By default, our builder assumes that CSS\n has side effects. If the sideEffects field is set in your project or\n third-party package's package.json and does not include this CSS file, you\n will receive a warning:\n\n\n\nYou can resolve this by configuring sideEffects.\n\n\nstyle.autoModules#\n\nEnable CSS Modules automatically based on the filename.\n\n * Type: boolean | RegExp\n * Default: true\n\ntrue : Enables CSS Modules for style files ending with .module.css .module.less\n.module.scss .module.sass filenames\n\nfalse : Disable CSS Modules.\n\nRegExp : Enables CSS Modules for all files that match the regular condition.\n\n\nstyle.modules#\n\nCSS Modules configuration\n\n * Type: object\n * Default: {}\n\nA common configuration is localsConvention, which changes the class name\ngeneration rules for css modules\n\n\n\nFor the following styles\n\n\n\nYou can use styles.boxTitle to access\n\nFor detailed configuration see postcss-modules\n\n\nstyle.tailwindcss#\n\nUsed to modify the configuration of Tailwind CSS.\n\n * Type: object | Function\n * Default:\n\n\n\n\nEnabling Tailwind CSS#\n\nBefore using style.tailwindcss, you need to enable the Tailwind CSS plugin for\nModern.js Module.\n\nPlease refer to the section Using Tailwind CSS for instructions on how to enable\nit.\n\n\nType#\n\nWhen the value is of type object, it is merged with the default configuration\nvia Object.assign.\n\nWhen the value is of type Function, the object returned by the function is\nmerged with the default configuration via Object.assign.\n\nThe rest of the usage is the same as Tailwind CSS: Quick Portal.\n\n\nNotes#\n\nPlease note that:\n\n * If you are using both the tailwind.config.{ts,js} file and tools.tailwindcss\n option, the configuration defined in tools.tailwindcss will take precedence\n and override the content defined in tailwind.config.{ts,js}.\n * If you are using the designSystem configuration option simultaneously, the\n theme configuration of Tailwind CSS will be overridden by the value of\n designSystem.\n\nThe usage of other configurations follows the same approach as the official\nusage of Tailwind CSS. Please refer to tailwindcss - Configuration for more\ndetails.\n\n\ntarget#\n\ntarget is used to set the target environment for the generated JavaScript code.\nIt enables Modern.js Module to transform JavaScript syntax that is not\nrecognized by the target environment into older versions of JavaScript syntax\nthat are compatible with these environments.\n\n * Type:\n\n\n\n * Default: 'es6'\n\nFor example, compile the code to es5 syntax:\n\n\n\n\ntransformImport#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\nWith this configuration, the code will be converted using SWC.\n\n * Type: object[]\n * Default: []\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\nReference the Import Plugin - Notes\n\n\ntransformLodash#\n\nSpecifies whether to modularize the import of lodash and remove unused lodash\nmodules to reduce the code size of lodash.\n\nThis optimization is implemented using babel-plugin-lodash and swc-plugin-lodash\nunder the hood.\n\nWith this configuration, the code will be converted using SWC.\n\n * Type: boolean\n * Default: false\n\nWhen you enable this, Modern.js Module will automatically redirects the code\nreferences of lodash to sub-paths.\n\nFor example:\n\n\n\nThe transformed code will be:\n\n\n\n\ntsconfig#\n\nPath to the tsconfig file\n\n * Type: string\n * Default: tsconfig.json\n * Version: >=2.36.0\n\n\n\n\numdGlobals#\n\nSpecify global variables for external import of umd artifacts\n\n * Type: Record\n * Default: {}\n\n\n\nAt this point, react and react-dom will be seen as global variables imported\nexternally and will not be packed into the umd product, but will be accessible\nby way of global.React and global.ReactDOM\n\n\numdModuleName#\n\nSpecifies the module name of the umd product\n\n * Type: string | Function\n * Default: name => name\n\n\n\nAt this point the umd artifact will go to mount on global.myLib\n\n:::tip\n\n * The module name of the umd artifact must not conflict with the global\n variable name.\n * Module names will be converted to camelCase, e.g. my-lib will be converted to\n myLib, refer to toIdentifier. :::\n\nAlso the function form can take one parameter, which is the output path of the\ncurrent package file\n\n","routePath":"/module-tools/en/api/config/build-config","lang":"en","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":378},{"text":"asset","id":"asset","depth":2,"charIndex":1054},{"text":"asset.name","id":"assetname","depth":2,"charIndex":1113},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":1571},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":2045},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":2149},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":2336},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":2783},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":2901},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":3018},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":3299},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":4498},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":5006},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":5142},{"text":"banner","id":"banner","depth":2,"charIndex":5273},{"text":"buildType","id":"buildtype","depth":2,"charIndex":5514},{"text":"copy","id":"copy","depth":2,"charIndex":5674},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":5850},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":5908},{"text":"define","id":"define","depth":2,"charIndex":6133},{"text":"dts","id":"dts","depth":2,"charIndex":7312},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":7435},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":7919},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":8081},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":8508},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":8664},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":8793},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":9225},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":10401},{"text":"externals","id":"externals","depth":2,"charIndex":10923},{"text":"footer","id":"footer","depth":2,"charIndex":11113},{"text":"format","id":"format","depth":2,"charIndex":11209},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":11396},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":11536},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":11732},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":12026},{"text":"hooks","id":"hooks","depth":2,"charIndex":12329},{"text":"input","id":"input","depth":2,"charIndex":12816},{"text":"jsx","id":"jsx","depth":2,"charIndex":13845},{"text":"metafile","id":"metafile","depth":2,"charIndex":14380},{"text":"minify","id":"minify","depth":2,"charIndex":14809},{"text":"outDir","id":"outdir","depth":2,"charIndex":14952},{"text":"platform","id":"platform","depth":2,"charIndex":15046},{"text":"redirect","id":"redirect","depth":2,"charIndex":15277},{"text":"resolve","id":"resolve","depth":2,"charIndex":15793},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":15838},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":16333},{"text":"shims","id":"shims","depth":2,"charIndex":16798},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":17219},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":18068},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":18326},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":18437},{"text":"splitting","id":"splitting","depth":2,"charIndex":18664},{"text":"style","id":"style","depth":2,"charIndex":18827},{"text":"style.less","id":"styleless","depth":2,"charIndex":18875},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":18917},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":19042},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":19163},{"text":"style.sass","id":"stylesass","depth":2,"charIndex":19508},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":19551},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":19657},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":19789},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":20129},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":20477},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":21490},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":21837},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":22137},{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":3,"charIndex":22251},{"text":"Type","id":"type","depth":3,"charIndex":22460},{"text":"Notes","id":"notes","depth":3,"charIndex":22765},{"text":"target","id":"target","depth":2,"charIndex":23348},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":23712},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":24068},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":24569},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":24674},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":24985}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":1,"title":"buildPreset","content":"#\n\nA build preset string or preset function. Provides out-of-the-box build\nconfiguration\n\n * Type: string | Function\n\n\nnpm-library#\n\nLibrary generic schema used under class NPM package manager, contains esm and\ncjs bundle artifacts, and includes a type file.\n\nINFO\n\nAbout the class NPM Package Manager\n\n * npm\n * yarn\n * pnpm\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-library-with-umd#\n\nUsed under class NPM package manager, and Library supports a similar pattern to\nunpkg. Additional umd artifacts are provided on top of the pre-defined\nnpm-library.\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-component#\n\nA generic pattern for components (libraries) used under the class NPM package\nmanager. Contains both esm and cjs Bundleless artifacts (for easy Tree shaking\noptimization), as well as including a copy of the type file.\n\nFor style files included in the source code, the artifacts provide the compiled\nfiles of the style and the source file of the style.\n\n\n\nThe pre-defined strings correspond to the build configuration.\n\n\n\n\nnpm-component-with-umd#\n\nComponent (library) used under class NPM package manager, with support for class\nunpkg schema. Additional umd artifacts are provided on top of the pre-defined\nnpm-component.\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\nWhen you want to use a buildPreset preset that supports other ECMAScript\nversions, you can directly add the supported versions to the 'npm-library',\n'npm-library-with-umd', 'npm-component', 'npm-component-with-umd' presets.\n\nFor example, if you want the 'npm-library' preset to support 'es2017', you can\nconfigure it as follows.\n\n\n\n\nstring / function#\n\nThe buildPreset not only supports basic string forms, but also function forms,\nwhich can obtain the default values we provide through the preset or extend\nPreset parameter and then modify them.\n\nHere are two examples using preset and extend Preset:\n\n\n\nIn the extend Preset, lodash.merge is used for configuration merge.\n\n","routePath":"/module-tools/en/api/config/build-preset","lang":"en","toc":[{"text":"`npm-library`","id":"npm-library","depth":3,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":3,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":3,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":3,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":3,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":1651}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":2,"title":"dev","content":"#\n\nThis section describes all configuration of Modern.js Module related to\ndebugging tools.\n\n\nstorybook#\n\nWARNING\n\nDeprecated: This configuration is deprecated and only applicable to Storybook\nV6. Please see 使用Storybook to get more info.\n\n\nstorybook.webpack#\n\n * Type: object | Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpack. The usage can be found in the tools.webpack configuration\nof Modern.js Builder.\n\n\n\nConfigure Manager App#\n\nFor the webpack configuration of the Storybook Manager app section, you can\nconfigure it by adding the ./config/storybook/main.js file to configure it.\n\n\n\n\nstorybook.webpackChain#\n\n * Type: Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpackChain. You can refer to Modern.js Builder's\ntools.webpackChain configuration for how to use it.","routePath":"/module-tools/en/api/config/dev","lang":"en","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":93},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":239},{"text":"Configure Manager App","id":"configure-manager-app","depth":4,"charIndex":506},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":686}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":3,"title":"plugins","content":"#\n\nThis chapter describes the configuration of the registered Modern.js Module\nplugin.\n\n * Type: ModuleToolsPlugin[]\n * Default: undefined\n\n\nPlugin Execution Order#\n\nBy default, custom plugins are executed in the order specified in the plugins\narray. The execution of built-in plugins provided by Modern.js Module happens\nbefore the execution of custom plugins.\n\nWhen plugins use fields that control the execution order, such as pre and post,\nthe execution order is adjusted based on the declared fields. For more\ninformation, please refer to the Relationship Between Plugins guide.\n\n\nDeveloping Plugins#\n\nTo learn how to write plugins, please refer to the Plugin Writing Guide.\n\n\nExample#\n\n\nUsing Plugins from npm#\n\nTo use plugins from npm, you need to install them using a package manager and\nimport them in your configuration file.\n\n\n\nUsing Local Plugins#\n\nTo use plugins from a local code repository, you can directly import them using\na relative path.\n\n\n\n\nPlugin Configuration#\n\nIf a plugin provides custom configuration options, you can pass the\nconfiguration through the plugin function's parameters.\n\n","routePath":"/module-tools/en/api/config/plugins","lang":"en","toc":[{"text":"Plugin Execution Order","id":"plugin-execution-order","depth":2,"charIndex":140},{"text":"Developing Plugins","id":"developing-plugins","depth":2,"charIndex":584},{"text":"Example","id":"example","depth":2,"charIndex":680},{"text":"Using Plugins from npm","id":"using-plugins-from-npm","depth":3,"charIndex":691},{"text":"Using Local Plugins","id":"using-local-plugins","depth":4,"charIndex":837},{"text":"Plugin Configuration","id":"plugin-configuration","depth":3,"charIndex":960}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":4,"title":"testing","content":"#\n\nThis chapter describes the test-related configuration\n\nTIP\n\nYou need to enable the unit testing feature with pnpm run new first.\n\n\njest#\n\n * Type: object | Function\n * Default: {}\n\nThe configuration corresponding to Jest, when of type object, can be configured\nwith all the underlying configurations supported by Jest .\n\n\n\nWhen the value is of type Function, the default configuration is passed as the\nfirst parameter and a new Jest configuration object needs to be returned.\n\n\n\n\ntransformer#\n\n * Type: 'babel-jest' | 'ts-jest'\n * Default: 'babel-jest'\n\nConfigure the compilation tool for the source code when executing tests:\nbabel-jest or ts-jest. The default is babel-jest.\n\nINFO\n\nbabel-jest can also compile TS files without type errors, so use ts-jest if you\nneed to check the TS type when running tests.","routePath":"/module-tools/en/api/config/testing","lang":"en","toc":[{"text":"jest","id":"jest","depth":2,"charIndex":133},{"text":"transformer","id":"transformer","depth":2,"charIndex":482}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":5,"title":"Overview","content":"#","routePath":"/module-tools/en/api/","lang":"en","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"Overview","sidebar_position":1},"version":""},{"id":6,"title":"Plugin Hooks","content":"#\n\nThis chapter describes the lifecycle hooks supported by module-tools.\n\nCurrently there are following main types of lifecycle hooks.\n\n * Config hooks: change user config.\n * Build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * dev hooks: hooks that are triggered when running the dev command.\n\nHook Model is explained in detail here.\n\n\nConfig hooks#\n\n\nresolveModuleUserConfig#\n\nchang user config.\n\ntype: AsyncWaterfall\n\n\n\n\nbuild hooks#\n\nThe following Hooks are triggered in order when the build command is executed.\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\nTriggered before the execution of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters value types.\n\n\n\n> BuildConfig type reference API configuration\n\n\nbeforeBuildTask#\n\nBased on the build configuration, Modern.js Module will split the overall build\ninto multiple sub-build tasks. The Hook will be triggered before each build\nsubtask.\n\ntype: AsyncWaterfall\n\n\n\nParameters and return value types.\n\nBaseBuildConfig type reference API configuration\n\n\nafterBuildTask#\n\nTriggered after the end of each build subtask.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nafterBuild#\n\nTriggered after the end of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nbuildPlatform hooks#\n\nmodule-tools also provides the build --platform command to perform specific\nbuild tasks.\n\nFor example, after installing the Module Doc plugin, you can run build\n--platform or build --platform doc to perform Doc build tasks.\n\nHooks are triggered in the following order after executing build --platform.\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\nGets information about the tasks that need to be run when executing the build\n--platform command.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeBuildPlatform#\n\nTriggers all registered build tasks when the build --platform command is\nexecuted. beforeBuildPlatform will be triggered before the execution of the\noverall build task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. buildPlatform will be triggered before each build task is\nexecuted.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterBuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. afterBuildPlatform will be triggered after the overall platform\nbuild task is finished.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nDev Hooks#\n\nThe following Hooks are triggered in order when the dev command is executed.\n\n * registerDev: triggered when getting dev function information.\n * beforeDev: Triggered before starting the dev process as a whole.\n * beforeDevMenu: triggered before the dev list/menu appears.\n * afterDevMenu: triggered after dev list/menu option is selected.\n * beforeDevTask: Triggered before executing the dev task.\n * afterDev: Triggered at the end of the overall dev process.\n\n\nregisterDev#\n\nRegister dev tool related data. Mainly contains.\n\n * the name of the dev tool\n * The name of the item displayed in the menu list and the corresponding value.\n * The definition of the dev subcommand.\n * Whether to execute the source code build before running the dev task\n * The function to execute the dev task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDev#\n\nTriggered before the dev task is executed after all dev tool metadata has been\ncollected.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu is triggered before the dev list/menu appears. Receives inquirer\nquestion as argument. Default value is.\n\n\n\nafterDevMenu Triggered after selecting dev list/menu options.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDevTask#\n\nTriggered before the dev task is executed.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterDev#\n\nTriggered when the dev task process is interrupted.\n\n","routePath":"/module-tools/en/api/plugin-api/plugin-hooks","lang":"en","toc":[{"text":"Config hooks","id":"config-hooks","depth":2,"charIndex":509},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"build hooks","id":"build-hooks","depth":2,"charIndex":596},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform hooks","id":"buildplatform-hooks","depth":2,"charIndex":1494},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"Dev Hooks","id":"dev-hooks","depth":2,"charIndex":2796},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":7,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-exception","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":8,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-other","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":9,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-product","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":10,"title":"","content":"","routePath":"/module-tools/en/components/faq-storybook","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":11,"title":"","content":"","routePath":"/module-tools/en/components/faq-test","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":12,"title":"","content":"","routePath":"/module-tools/en/components/publish-emo","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":13,"title":"","content":"When adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.","routePath":"/module-tools/en/components/register-esbuild-plugin","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":14,"title":"","content":"","routePath":"/module-tools/en/components/release-module-doc","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":15,"title":"Handle static assets","content":"#\n\nModern.js Module will handle static assets used in the code. If configuration is\nrequired, then the buildConfig.asset API can be used.\n\n\nDefault behavior#\n\nBy default, Modern.js Module handles the following static assets:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\nFor the handling of static files, Modern.js Module currently supports the\nfollowing functions.\n\n * Set the static asset path to . /assets.\n * Files less than 10kb will be inlined into the code.\n\n\nExample#\n\nLet us look at the following example:\n\n * Project source code:\n\n\n\n * If the size of bg.png is less than 10 kb, then the output directory structure\n and file content are.\n\n\n\n\n\n * If the size of bg.png is larger than 10 kb, then the output directory\n structure and file content are.\n\n\n\n\n\nWhen wanting to modify the default behavior, the following API can be used:\n\n * asset.path: modify the output path of the static assets.\n * asset.limit: modify the threshold value for inline assets.","routePath":"/module-tools/en/guide/advance/asset","lang":"en","toc":[{"text":"Default behavior","id":"default-behavior","depth":2,"charIndex":139},{"text":"Example","id":"example","depth":2,"charIndex":571}],"domain":"","frontmatter":{"sidebar_position":6},"version":""},{"id":16,"title":"Build umd artifacts","content":"#\n\nThe full name of umd is Universal Module Definition, and JS files in this format\ncan run in multiple runtime environments: the\n\n * Browser environment: module loading based on AMD specification\n * Node.js environment: module loading based on CommonJS\n * Other cases: mount the module on a global object.\n\nWe can therefore specify the build artifacts of the project as an umd artifact\nin the following way:\n\n\n\n\nThird-party dependency handling for umd artifacts#\n\nIn the \"How to handle third-party dependencies\" chapter, we know that we can\ncontrol whether or not the project packages third-party dependencies via the\nautoExternals and externals APIs. So when building umd artifacts, we can also\nuse it like this:\n\n\nExample#\n\n * If the project depends on react:\n\n\n\n * modern.config.ts:\n\n\n\n * When a react dependency is used in the source code:\n\n\n\n * The react code is not bundled into the artifact at this point:\n\n\n\nWe know from the above example that when using the autoExternal and externals\nAPIs.\n\n * In a Node.js environment, you can get the react dependency with\n require('react').\n * In a browser environment, you can get the react dependency via global.react.\n\n\nGlobal variable names of third-party dependencies#\n\nHowever, in the browser environment, when getting third-party dependencies,\nglobal variable names are not necessarily identical to the dependency names, so\nyou have to use the buildConfig.umdGlobals API.\n\nAgain using the previous example, when the react dependency exists in the\nbrowser environment as a windows.React or global.React global variable, then:\n\n * modern.config.ts config file:\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nAt this point we will see the output code like this:\n\n\n\nThe project can then run in the browser and use the React variables that exist\non the global object.\n\n\nChanging the name of a global variable in a project#\n\nWhen we package the following code into an umd artifact and run it in the\nbrowser, we can use the module via window.index.\n\n\n\n** By default, the name of the source file is used as the name of the module's\nglobal variable in the browser. **For the above example, the artifact would read\nas follows:\n\n\n\nIf you need to modify it, you need to use the buildConfig.umdModuleName API.\n\nWhen this API is used:\n\n\n\nThe build artifact at this point are:\n\n","routePath":"/module-tools/en/guide/advance/build-umd","lang":"en","toc":[{"text":"Third-party dependency handling for umd artifacts","id":"third-party-dependency-handling-for-umd-artifacts","depth":2,"charIndex":412},{"text":"Example","id":"example","depth":3,"charIndex":716},{"text":"Global variable names of third-party dependencies","id":"global-variable-names-of-third-party-dependencies","depth":3,"charIndex":1171},{"text":"Changing the name of a global variable in a project","id":"changing-the-name-of-a-global-variable-in-a-project","depth":2,"charIndex":1831}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":17,"title":"Use the Copy Tools","content":"#\n\nModern.js Module provides the Copy utility for copying already existing\nindividual files or entire directories into the output directory. Next we learn\nhow to use it.\n\n\nUnderstanding the Copy API#\n\nWe can use the Copy tool via the buildConfig.copy API, which contains the\nfollowing two main configurations.\n\n * patterns\n * options\n\n\nAPI Description#\n\ncopy.patterns is used to find files to be copied and configure the output path.\n\nThe patterns.from parameter is used to specify the file or directory to be\ncopied. It accepts either a Glob pattern string or a specific path. A Glob\npattern string refers to the fast-glob pattern syntax. Therefore, we can use it\nin two ways as follows:\n\n\n\nThe patterns.context parameter is generally used in conjunction with\npatterns.from. By default, its value is the same as buildConfig.sourceDir.\nTherefore, we can specify the file src/data.json to be copied in the following\nway:\n\n> By default, buildConfig.sourceDir is set to src.\n\n\n\nWhen the specified file is not in the source code directory, you can modify the\ncontext configuration. For example, to specify the file temp/index.html in the\nproject directory to be copied:\n\n\n\nThe patterns.to parameter is used to specify the output path for the copied\nfiles. By default, its value corresponds to buildConfig.outDir. Therefore, we\ncan copy src/index.html to the dist directory as follows:\n\n\n\nWhen we configure patterns.to:\n\n * If it is a relative path, the path will be calculated relative to\n buildConfig.outDir to determine the absolute path for copying the files.\n * If it is an absolute path, the value will be used directly.\n\nFinally, patterns.globOptions is used to configure the globby object for finding\nfiles to copy. Its configuration can be referenced from:\n\n * globby.options\n\n\nExamples of Different Scenarios#\n\n\nCopying Files#\n\n\n\n\nCopying Files to a Directory#\n\n\n\n\nCopying from Directory to Directory#\n\n\n\n\nCopying from Directory to File#\n\n\n\n\nUsing Glob#\n\n","routePath":"/module-tools/en/guide/advance/copy","lang":"en","toc":[{"text":"Understanding the Copy API","id":"understanding-the-copy-api","depth":2,"charIndex":171},{"text":"API Description","id":"api-description","depth":2,"charIndex":335},{"text":"Examples of Different Scenarios","id":"examples-of-different-scenarios","depth":2,"charIndex":1783},{"text":"Copying Files","id":"copying-files","depth":3,"charIndex":1818},{"text":"Copying Files to a Directory","id":"copying-files-to-a-directory","depth":3,"charIndex":1837},{"text":"Copying from Directory to Directory","id":"copying-from-directory-to-directory","depth":3,"charIndex":1871},{"text":"Copying from Directory to File","id":"copying-from-directory-to-file","depth":3,"charIndex":1912},{"text":"Using Glob","id":"using-glob","depth":3,"charIndex":1948}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":18,"title":"Handle third-party dependencies","content":"#\n\nGenerally, third-party dependencies required by a project can be installed via\nthe install command in the package manager. After the third-party dependencies\nare successfully installed, they will generally appear under dependencies and\ndevDependencies in the project package.json.\n\n\n\nDependencies under \"dependencies\" are generally related to project code and\nbuilds, and if these third-party dependencies are declared under\n\"devDependencies\", then there will be missing dependencies in production\nenvironments.\n\nIn addition to \"dependencies\", \"peerDependencies\" can also declare dependencies\nthat are needed in the production environment, but it puts more emphasis on the\nexistence of these dependencies declared by \"peerDependencies\" in the project's\nruntime environment, similar to the plugin mechanism.\n\n\nDefault handling of third-party dependencies#\n\nBy default, third-party dependencies under \"dependencies\" and \"peerDependencies\"\nare not bundled by Modern.js Module.\n\nThis is because when the npm package is installed, its \"dependencies\" will also\nbe installed. By not packaging \"dependencies\", you can reduce the size of the\npackage product.\n\nIf you need to package some dependencies, it is recommended to move them from\n\"dependencies\" to \"devDependencies\", which is equivalent to prebundle the\ndependencies and reduces the size of the dependency installation.\n\n\nExample#\n\nIf the project has a dependency on react.\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nThe react code is not bundled into the artifact:\n\n\n\nIf you want to modify the default processing, you can use the following API.\n\n * buildConfig.autoExternal\n\n\nExclude specified third-party dependencies#\n\nWe mentioned above the use of the buildConfig.autoExternal API, and\nbuildConfig.externals can control which third-party dependencies to handle the\nproject's dependencies in a more granular way.\n\nFor example, when we need to leave only certain dependencies unpacked, we can\nconfigure it as follows.\n\n> In this case, it is likely that some dependencies are not suitable for\n> packaging. If this is the case, then you can handle it as follows.\n\n","routePath":"/module-tools/en/guide/advance/external-dependency","lang":"en","toc":[{"text":"Default handling of third-party dependencies","id":"default-handling-of-third-party-dependencies","depth":2,"charIndex":811},{"text":"Example","id":"example","depth":3,"charIndex":1373},{"text":"Exclude specified third-party dependencies","id":"exclude-specified-third-party-dependencies","depth":2,"charIndex":1643}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":19,"title":"In-depth understanding of build","content":"#\n\nIn the \"Basic Usage\" section, we already knew that you can modify the output\nfiles of a project through the buildConfig configuration. buildConfig not only\ndescribes some of the features of the product, but also provides some\nfunctionality for building the product.\n\nTIP\n\nIf you are not familiar with buildConfig, please read modify-output-product.\n\nIn this chapter we'll dive into the use of certain build configurations and\nunderstand what happens when the modern build command is executed.\n\n\nbundle / bundleless#\n\nSo first let's understand bundle and bundleless.\n\nA bundle is a package of build artifacts, which may be a single file or multiple\nfiles based on a certain code splitting strategy.\n\nbundleless, on the other hand, means that each source file is compiled and built\nseparately, but not bundled together. Each output file can be found with its\ncorresponding source code file. The process of bundleless build can also be\nunderstood as the process of code conversion of source files only.\n\nThey have their own benefits.\n\n * bundle can reduce the size of build artifacts and also pre-package\n dependencies to reduce the size of installed dependencies. Packaging\n libraries in advance can speed up application project builds.\n * bundleless maintains the original file structure and is more conducive to\n debugging and tree shaking.\n\nWARNING\n\nbundleless is a single-file compilation mode, so for referencing and exporting\ntypes, you need to add the type keyword. For example, ``. Please refer to the\nesbuild documentation for more information.\n\nIn buildConfig you can specify whether the current build task is bundle or\nbundleless by using buildConfig.buildType.\n\n\ninput / sourceDir#\n\nbuildConfig.input is used to specify the path to a file or directory from which\nto read the source code, the default value of which varies between bundle and\nbundleless builds:\n\n * When buildType: 'bundle', input defaults to src/index.(j|t)sx?.\n * When buildType: 'bundleless', input defaults to ['src'].\n\nFrom the default value, we know that building in bundle mode usually specifies\none or more files as the entry point for the build, while building in bundleless\nmode specifies a directory and uses all the files in that directory as the entry\npoint.\n\nsourceDir is used to specify the source directory, which is only related to the\nfollowing two elements:\n\n * Type file generation\n * outbase for specifying the build process\n\nSo we can get its best practices:\n\n * Only specify input during the bundle build.\n * In general, bundleless only needs to specify sourceDir (where input will be\n aligned with sourceDir). If we want to use the input in bundleless, we only\n need to specify sourceDir.\n\nIf you want to convert only some of the files in bundleless, e.g. only the files\nin the src/runtime directory, you need to configure input:\n\n\n\n\nuse swc#\n\nIn some scenarios, esbuild is not enough to meet our needs, and we will use swc\nto do the code conversion.\n\nStarting from version 2.36.0, the Modern.js Module will use swc by default when\nit comes to the following functionality, but that doesn't mean we don't use\nesbuild any more, the rest of the functionality will still use esbuild.\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\nIn fact, we've been using swc for full code conversion since version 2.16.0.\nHowever, swc also has some limitations, so we added sourceType to turn off swc\nwhen the source is formatted as 'commonjs', which isn't really user-intuitive,\nand the cjs mode of the swc formatted outputs don't have annotate each export\nname, which can cause problems in node. So we deprecated this behaviour and went\nback to the original design - using swc as a supplement only in situations where\nit was needed.\n\n\nUsing Hooks to Intervene in the Build Process#\n\nThe Modern.js Module provides a Hook mechanism that allows us to inject custom\nlogic at different stages of the build process. The Modern.js Module Hook is\nimplemented using tapable, which extends esbuild's plugin mechanism, and is\nrecommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:\n\n\nHook type#\n\nAsyncSeriesBailHook#\n\nSerial hooks that stop the execution of other tapped functions if a tapped\nfunction returns a non-undefined result.\n\nAsyncSeriesWaterFallHooks#\n\nSerial hooks whose results are passed to the next tapped function.\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * Triggered at esbuild onLoad callbacks to fetch module content based on the\n module path\n * Input parameters\n\n\n\n * Return parameters\n\n\n\n * Example\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onLoad callbacks. Transforms the contents of the module\n fetched during the load phase\n * Input parameters (return parameters)\n\n\n\n * Example\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onEnd callbacks. This is similar to the transform hook,\n but works on the artifacts generated by esbuild.\n * Input parameters (return parameters)\n\n\n\n * Examples\n\n\n\n\ndts#\n\nThe buildConfig.dts configuration is mainly used for type file generation.\n\n\nTurn off type generation#\n\nType generation is turned on by default, if you need to turn it off, you can\nconfigure it as follows:\n\n\n\nTIP\n\nThe build speed is generally improved by closing the type file.\n\n\nBuild type files#\n\nWith buildType: 'bundleless', type files are generated using the project's tsc\ncommand to complete production.\n\nThe Modern.js Module also supports bundling of type files, although care needs\nto be taken when using this feature.\n\n * Bundle type files does not enable type checking.\n * Some third-party dependencies have incorrect syntax that can cause the\n bundling process to fail. So in this case, you need to exclude such\n third-party packages manually with buildConfig.externals or close\n dts.respectExternal to external all third-party packages types.\n * It is not possible to handle the case where the type file of a third-party\n dependency points to a .ts file. For example, the package.json of a\n third-party dependency contains something like this: {\"types\": \".\n /src/index.ts\"}.\n\nFor the above problems, our recommended approach is to first use tsc to generate\nd.ts files, then package the index.d.ts as the entry and close\ndts.respectExternal. In the future evolution, we will gradually move towards\nthis handling approach.\n\n\nAlias Conversion#\n\nDuring the bundleless build process, if an alias appears in the source code,\ne.g.\n\n\n\nThe type files generated with tsc will also contain these aliases. However,\nModern.js Module will convert the aliases in the type file generated by tsc.\n\n\nSome examples of the use of dts#\n\nGeneral usage:\n\n\n\nFor the use of dts.only:\n\n\n\n\nBuild process#\n\nWhen the modern build command is executed, the\n\n * Clear the output directory according to buildConfig.outDir.\n * Compile js/ts source code to generate the JS build artifacts for\n bundle/bundleless.\n * Generate bundle/bundleless type files using tsc.\n * Handle Copy tasks.\n\n\nBuild errors#\n\nWhen a build error occurs, based on the information learned above, it is easy to\nunderstand what error appears in the terminal.\n\nErrors reported for js or ts builds:\n\n\n\nErrors reported for the type file generation process:\n\n\n\nFor js/ts build errors, we can tell from the error message.\n\n * By 'bundle failed:' to determine if the error is reported for a bundle build\n or a bundleless build\n * What is the format of the build process\n * What is the target of the build process\n * The specific error message\n\n\nDebug mode#\n\nFrom 2.36.0, For troubleshooting purposes, the Modern.js Module provides a debug\nmode, which you can enable by adding the DEBUG=module environment variable when\nexecuting a build.\n\n\n\nIn debug mode, you'll see more detailed build logs output in Shell, which are\nmainly process logs:\n\n\n\nIn addition, Module provides the ability to debug internal workflows. You can\nenable more detailed debugging logging by setting the DEBUG=module:* environment\nvariable.\n\nCurrently, only DEBUG=module:resolve is supported, which allows you to see a\ndetailed log of module resolution within the Module.\n\n","routePath":"/module-tools/en/guide/advance/in-depth-about-build","lang":"en","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"use swc","id":"use-swc","depth":2,"charIndex":2845},{"text":"Using Hooks to Intervene in the Build Process","id":"using-hooks-to-intervene-in-the-build-process","depth":2,"charIndex":3803},{"text":"Hook type","id":"hook-type","depth":3,"charIndex":4183},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":4195},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":4334},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":4431},{"text":"load","id":"load","depth":4,"charIndex":4442},{"text":"transform","id":"transform","depth":4,"charIndex":4626},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":4837},{"text":"dts","id":"dts","depth":2,"charIndex":5071},{"text":"Turn off type generation","id":"turn-off-type-generation","depth":3,"charIndex":5154},{"text":"Build type files","id":"build-type-files","depth":3,"charIndex":5357},{"text":"Alias Conversion","id":"alias-conversion","depth":3,"charIndex":6424},{"text":"Some examples of the use of `dts`","id":"some-examples-of-the-use-of-dts","depth":3,"charIndex":-1},{"text":"Build process","id":"build-process","depth":2,"charIndex":6764},{"text":"Build errors","id":"build-errors","depth":2,"charIndex":7057},{"text":"Debug mode","id":"debug-mode","depth":2,"charIndex":7582}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":20,"title":"In-depth understanding of the dev command","content":"#\n\nThe dev command provided by the Modern.js Module is mainly used for debugging\nthe code.\n\n\nThe overall flow of the command run#\n\n 1. When the dev command is executed, Modern.js Module starts looking for\n debugging tools or tasks that can be executed. A debugging tool or task is a\n Modern.js Module debugging tool plugin like module doc.\n 2. When a debugging tool is found, it is executed immediately.\n 3. When multiple debugging tools are found, the debugging tools list menu is\n displayed. A debug tool can be started by selecting the name option\n corresponding to it.\n 4. When no debug tool is found, the user is informed that no debug tool is\n available.\n\nIn addition to the dev command, you can also start a debugging tool or task\ndirectly by using the dev [debug tool name] option.\n\n\nExtending the dev command#\n\nIf you need to extend the dev command, or rather provide your own Modern.js\nModule debugging tool plugin, then you will need to know the following first.\n\n * Development of plugins\n * Debugging Tools Plugin API\n\nIn general, the code to implement a debugging tool that does nothing and the\nassociated configuration is as follows.\n\n\n\nIf this debugging tool plugin is required, it needs to be added to the\nconfiguration file.\n\n\n\nAt this point we can execute it when we execute the dev or dev do-nothing\ncommand. After execution, it will first execute the source build task in\nlistening mode and print the log messages immediately afterwards.\n\nFor currently officially supported debugging tools and third-party supported\ndebugging tools, you can view them in plugins list.","routePath":"/module-tools/en/guide/advance/in-depth-about-dev-command","lang":"en","toc":[{"text":"The overall flow of the command run","id":"the-overall-flow-of-the-command-run","depth":2,"charIndex":92},{"text":"Extending the dev command","id":"extending-the-dev-command","depth":2,"charIndex":806}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":21,"title":"Before you start","content":"#\n\n\nEnvironment preparation#\n\nIn order to use the Modern.js Module, you first need NodeJS engine, we recommend\nthe latest LTS version, and make sure the Node version is >=16.0.0. because\nnon-stable NodeJS releases frequently have bugs. You might consider installing\nvia nvm-windows and nvm (Mac / Linux), so you can easily switch to different\nNodeJS versions that might be required for different projects that you work on.\n\n\nGetting Started with npm#\n\nOnce NodeJS is installed, not only can you access the node executable from the\ncommand line, but you can also execute the npm command.\n\nNpm is the standard package manager for NodeJS. It started out as a tool for\ndownloading and managing NodeJS package dependencies, but it has since evolved\ninto a tool for front-end JavaScript.\n\nIf you already know something about usage of npm and npm packages, then you can\ndirectly see npm package manager section.\n\n\nnpm package type project#\n\nSo what is an npm package type project? When we execute the npm init command in\nan empty project directory, it creates a JSON file with the file name\npackage.json under the current directory. During the creation process, we will\nneed to fill in information including but not limited to the name, version\nnumber, description, etc. of the npm package, which will be found in the\nresulting package.json file as follows\n\n\n\nAt this point the project containing the initialized package.json file is an npm\npackage type project, and you can execute the npm publish command to publish the\nproject to the npm Registry.\n\nThe npm Registry is a npm package store where developers can not only publish\ntheir own npm packages to the npm Registry, but also use npm packages published\nby other developers through the npm Registry.\n\nA quality npm package will be used by more people because it not only saves a\nlot of code implementation work, but is also less likely to cause problems with\nthe project.\n\n\nUsing third-party npm packages#\n\nWhen adding a third-party npm package to an initial project, we can call this\nprocess \"installing dependencies for the project\" or \"adding dependencies to the\nproject\". Before adding dependencies, we need to know one thing in particular --\nthe types of packages npm depends on.\n\n * \"dependencies\": a type of package that your application will need in a\n production environment.\n * \"devDependencies\": another type of package that is only needed for local\n development and testing.\n \n > packages can be understood as third-party npm packages.\n\nYou can install the packages you need in a production environment by running npm\ninstall npm-package-name or npm add npm-package-name, or you can manually write\nthe packages you need to install and the corresponding semantic version in\n\"dependencies\" in the package.json file, and run the npm install command to.\n\n\n\nSimilarly, you can install only packages needed for local development and\ntesting by running npm install npm-package-name --save-dev or npm add\nnpm-package-name --save-dev, or you can manually write the packages to be\ninstalled and the corresponding semantic version in \"devDependencies\" in the\npackage.json file, and run the npm install command as follows\n\n\n\nWhen installing or using third-party npm packages be sure to determine what they\nare for and whether they should be placed in \"dependencies\" or \"devDependencies\"\nby distinguishing between their types.\n\nTIP\n\nIn general, packages that need to be used in source code are dependencies\ndependencies. Unless you are exporting dependent code locally via packaging, in\nwhich case it can be treated as a devDependencies dependency.\n\n\nOther npm bits and pieces to know#\n\n\nProgram entry for npm packages#\n\nThere is a \"main\" attribute in package.json that corresponds to a module ID or,\nmore intuitively, a NodeJS file path, which is the main entry point for your\napplication.\n\nFor example, if your package is named foo and the user installs it, and then\nexecutes the require(\"foo\") code, then the file corresponding to the \"main\"\nfield of the npm package foo will be exported.\n\nIt is recommended to set the \"main\" field in your npm package. If \"main\" is not\nset, the default entry will be the index.js file in the root of the package.\n\nIn addition to the \"main\" attribute, the \"module\" attribute is usually set. It\nis similar to the \"main\" attribute in that it is mainly used in webpack\nscenarios. webpack reads the npm package entry (file) in most cases in the order\n\"module\" -> \"main \".\n\n> To learn more about how webpack does this, check out this link.\n\n\nscripts#\n\nThe \"scripts\" attribute of the package.json file supports a number of built-in\nscripts and npm-preset lifecycle events, as well as arbitrary scripts.\n\nThese can be executed by running npm run-script or simply npm run .\n\nName matching pre and post commands will also be run (e.g. premyscript,\nmyscript, postmyscript ).\n\n\n\nWhen npm run myscripts is executed, the script corresponding to premyscripts\nwill be executed before it, and the script corresponding to postmyscripts will\nbe executed after it.\n\nScript commands from dependencies can be run with npm explore -- npm run .\n\nThere are also special lifecycle scripts that occur only under certain\ncircumstances. Here are a few that are usually necessary to know.\n\nnpm install#\n\nWhen you run npm install -g , the following scripts will run.\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\nIf your package root has a binding.gyp file and you don't define an install or\npreinstall script, then npm will build with node-gyp rebuild as the default\ninstall command, using node-gyp.\n\nnpm publish#\n\nWhen publishing a project, executing this command will trigger the following\nscript.\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\nWhen running in -dry-run mode, the script corresponding to prepare will not be\nexecuted.\n\n\npeerDependencies#\n\nIn some cases, your npm project has a compatibility relationship with its host\ntool or library (e.g. a webpack plugin project and webpack), and your npm\nproject does not want to use the host as a necessary dependency, which usually\nmeans that your project is probably a plugin for that host tool or library. Your\nnpm project will have certain requirements for the version of the host package,\nas only the APIs required by the npm project will be exposed under a specific\nversion.\n\nFor more explanation of peerDependencies, you can learn about the different ways\nnpm, pnpm, and Yarn handle it at the following links.\n\n * npm's explanation of peerDependencies\n * pnpm vs npm vs Yarn\n\n\nnpm package manager#\n\nIn addition to the standard package manager like npm, the mainstream ones are\npnpm and Yarn, both of which are good alternatives to npm cli.\n\nIt is recommended to use pnpm to manage project dependencies, which can be\ninstalled as follows.\n\n\n\n\nModern.js Module configuration file#\n\nThe Modern.js Module configuration file - modern.config.(j|t)s - is provided in\nthe project directory of the module project created with @modern-js/create.\nHowever, the modern.config configuration file is not required to exist.\n\nBy default, the contents of the generated configuration file are as follows.\n\n\n\nWe recommend using the defineConfig function, but it is not mandatory to use it.\nSo you can also return an object directly in the config file: the\n\n","routePath":"/module-tools/en/guide/basic/before-getting-started","lang":"en","toc":[{"text":"Environment preparation","id":"environment-preparation","depth":2,"charIndex":3},{"text":"Getting Started with npm","id":"getting-started-with-npm","depth":2,"charIndex":424},{"text":"npm package type project","id":"npm-package-type-project","depth":2,"charIndex":906},{"text":"Using third-party npm packages","id":"using-third-party-npm-packages","depth":2,"charIndex":1922},{"text":"Other npm bits and pieces to know","id":"other-npm-bits-and-pieces-to-know","depth":2,"charIndex":3606},{"text":"Program entry for npm packages","id":"program-entry-for-npm-packages","depth":3,"charIndex":3643},{"text":"`scripts`","id":"scripts","depth":3,"charIndex":-1},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":5883},{"text":"npm package manager","id":"npm-package-manager","depth":2,"charIndex":6585},{"text":"Modern.js Module configuration file","id":"modernjs-module-configuration-file","depth":2,"charIndex":6850}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":22,"title":"CLI Commands","content":"#\n\nCLI Commands available for Modern.js Module projects are as follows:\n\n\nmodern build#\n\n\n\nModern.js Module supports the platform build mode, which can be used to execute\nbuild tasks of other tools. Currently, the official support includes Rspress.\nFor example, you can start the doc build task to generate doc products by\nexecuting the modern build --platform commands.\n\n\nmodern new#\n\n\n\nThe modern new command is used to start the microgenerator functionality, which\nenables features for the project that are not provided by default.\n\nThe following features can currently be enabled.\n\n * Testing support\n * Storybook V7\n * Tailwind CSS support\n * Modern.js Runtime API\n\nYou can learn more about these features in the Using the micro generator\nsection.\n\n\nmodern dev#\n\n\n\nThe Modern.js Module provides the ability to use debugging tools, which can be\nstarted with the modern dev command. Note, however, that no debugging-related\nplugins are provided by default, so executing modern dev will prompt: \"No dev\ntools found available \".\n\nThe officially supported debugging tool is Rspress, so you can run modern dev or\nmodern dev doc to execute it after you run modern new to enable it.\n\n\nmodern test#\n\n\n\nYou need to execute modern new to turn on the test function before you can\nexecute the modern test command. The modern test command will automatically run\nthe src/tests/*.test.(js|ts|jsx|tsx) file as a test case.\n\n\nmodern lint#\n\n\n\nRun ESLint to check the syntax of the code. Usually, we only need to check the\npart of the code that was changed in this commit with lint-staged during the\n-git commit phase.\n\n * The -no-fix argument turns off the ability to automatically fix lint error\n code.\n\n\nmodern change#\n\n\n\nThe modern change command is used to generate the required Markdown file for\nchangesets.\n\n\nmodern pre#\n\n\n\nYou can use the modern pre command to pre-release a version before the official\nrelease.\n\n\nmodern bump#\n\n\n\nModify the version number in package.json according to the Markdown file of the\nchangelog generated by changesets, and generate the CHANGELOG.md file.\n\n\nmodern release#\n\n\n\nThe -modern release command releases the module to the npm Registry.\n\n * The -tag argument specifies the specific dist tags to be used for the\n release.\n\n\nmodern gen-release-note#\n\n\n\nAutomatically generate Release Note based on the changeset information of the\ncurrent repository.\n\nTIP\n\nneeds to be executed before the bump command.\n\n\nmodern upgrade#\n\n\n\nThe modern upgrade command is used to upgrade the project Modern.js related\ndependencies to the latest version.\n\nExecuting the command npx modern upgrade in the project root directory will\nupdate the Modern.js dependencies in package.json of the currently executing\nproject to the latest version by default.","routePath":"/module-tools/en/guide/basic/command-preview","lang":"en","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern test`","id":"modern-test","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":23,"title":"Modify the output","content":"#\n\n\nDefault output artifacts#\n\nWhen you use the modern build command in an initialized project, Modern.js\nModule will generate corresponding build artifacts based on the current\nconfiguration.\n\nThe default configuration is as follows:\n\n\n\nThe default output files has the following characteristics.\n\n * will generate CommonJS and ESM.\n * The code syntax is supported up to ES6 , and more advanced syntax will be\n converted.\n * All code is bundled into one file, i.e. bundle processing is performed.\n * The output root directory is the dist directory under the project, and the\n type file output directory is dist/types.\n\nYou may have the following questions when you see this.\n\n 1. what is buildPreset?\n 2. what determines these characteristics of the product?\n\nThen the next step is to first explain buildPreset.\n\n\nbuildPreset#\n\nThe buildPreset represents a prepared set or sets of build-related\nconfigurations that can be used to eliminate the trouble and complexity of\nconfiguration by using the default values corresponding to the build Preset,\nresulting in the expected product.\n\nModern.js Module mainly comes with two built-in build presets, including:\n\n * npm-component: Used to build component libraries.\n * npm-library: Used to package projects of other library types, such as tool\n libraries.\n\nIt also provides some variations, such as npm-library-with-umd and\nnpm-library-es5, which, as their names suggest, correspond to library presets\nwith umd output and support for es5 syntax, respectively. For more detailed\nconfiguration, you can refer to its API.\n\nIn addition, we can also fully customize the build configuration:\n\n\nbuildConfig#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. What was mentioned at the beginning about \"features of build\nartifacts\" are actually properties supported by buildConfig. The currently\nsupported properties cover the needs of most module type projects when building\nartifacts. buildConfig not only contains some properties that artifacts have,\nbut also contains some features needed to build artifacts. The following is a\nbrief list from a classification point of view.\n\nThe basic attributes of a build artifacts include:\n\n * Whether the artifact is bundled or not: the corresponding API is\n buildConfig.buildType.\n * Product support for syntax: the corresponding API is buildConfig.target.\n * Output format: the corresponding API is buildConfig.format.\n * How the output type file is handled: the corresponding API is\n buildConfig.dts.\n * How the sourceMap of the artifact is handled: the corresponding API is\n buildConfig.sourceMap.\n * The input (or source file) corresponding to the output: the corresponding API\n is buildConfig.input.\n * The directory of the output of the artifact: the corresponding API is\n buildConfig.outDir.\n * Build source directory: the corresponding API is buildConfig.sourceDir.\n\nCommon functions required for build artifacts include:\n\n * Alias: The corresponding API is buildConfig.alias.\n * Static resource handling: the corresponding API is buildConfig.asset.\n * Third-party dependency handling: The corresponding APIs are\n * buildConfig.autoExternal.\n * buildConfig.externals.\n * Copy: The corresponding API is buildConfig.copy.\n * Global variable substitution: the corresponding API is buildConfig.define.\n * Specify JSX compilation method, the corresponding API is\n [buildConfig.jsx](/api/config/ build-config#jsx).\n\nSome advanced properties or less frequently used functions:\n\n * Product code compression: The corresponding API is buildConfig.minify.\n * Code splitting: buildConfig.splitting\n * Specify whether the build artifacts is for the NodeJS environment or the\n browser environment: the corresponding API is buildConfig.platform.\n * umd product-related.\n * Specifies the global variables imported externally to the umd product: the\n corresponding API is buildConfig.umdGlobals.\n * Specify the module name of the umd product: the corresponding API is\n buildConfig.umdModuleName.\n\nIn addition to the above categories, frequently asked questions and best\npractices about these APIs can be found at the following links\n\n * About bundle and bundleless?\n * About input and sourceDir\n * About d.ts.\n * How to use define\n * How to handle third-party dependencies?\n * How to use copy?\n * How to use umd\n * How to use asset\n\n\nCombining Configuration and Presets#\n\nOnce we understand buildPreset and buildConfig, we can use them together.\n\nIn a real project, we can use buildPreset to quickly get a set of default build\nconfigurations. If you need to customise it, you can use buildConfig to override\nand extend it.\n\nThe extension logic is as follows.\n\n * When buildConfig is an array, new configuration items are added to the\n original preset.\n\n\n\nThis will generate an additional IIFE-formatted product that supports up to\nES2020 syntax on top of the original preset, in the dist/global directory under\nthe project.\n\n * When buildConfig is an object, the configuration items in the object are\n overwritten in the preset.\n\n\n\nThis will cause a sourceMap file to be generated for each build task.","routePath":"/module-tools/en/guide/basic/modify-output-product","lang":"en","toc":[{"text":"Default output artifacts","id":"default-output-artifacts","depth":2,"charIndex":3},{"text":"buildPreset","id":"buildpreset","depth":2,"charIndex":818},{"text":"buildConfig","id":"buildconfig","depth":2,"charIndex":1639},{"text":"Combining Configuration and Presets","id":"combining-configuration-and-presets","depth":2,"charIndex":4390}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":24,"title":"Versioning and Publishing","content":"#\n\nAn npm-type module project release process consists of two phases.\n\n * The first phase is during development, where the developer needs to provide a\n change file to record changes that need to be released.\n * The second phase is during release, collect all the change files to update\n the version, update the release log, and release new packages to the npm\n Registry.\n\nModern.js Module provides a set of version management and release solutions,\nwhich are suitable for single-package scenarios. For npm packages in monorepo,\nyou need to follow the strategies provided by various monorepo solutions.\n\n\nTracking changes#\n\nChanges need to be logged when they happen to the project. Changes that occur in\na project are typically.\n\n * New features\n * Fixes to issues\n * Configuration file changes\n * ...\n\nOnce these changes have been made, the current changes need to be documented\nwith the following command.\n\n * modern change\n\nExecuting the modern change command asks the developer several questions and\ngenerates a change log based on the developer's answers. The changelog file\ncontains the type of change and its description, and is committed to the git\nrepository.\n\n\n\nWhen executed successfully, the resulting Markdown file containing the change\nlog is saved in the project's .changeset directory. The contents will look like\nthe following.\n\n\n\n\nVersion update#\n\nWhen the project version needs to be updated, execute the following command.\n\n * modern bump\n\nExecuting modern bump will modify the version number in package.json based on\nthe contents of the Markdown file in the .changeset/ directory where the changes\nwere recorded, and generate the CHANGELOG.md file. These Markdown files are also\ndeleted when the version update is complete, so they are \"consumed \".\n\n\n\n\nPublish#\n\nTo publish a project, you can execute the following command.\n\n * modern publish\n\nThe modern release command publishes the project to the npm Registry.\n\nThe release is the latest version, which is also the official version. If you\nwant to change the dist-tag, you can specify it with the modern release --tag\ncommand. For example.\n\n\n\nHowever, if you want to change the version number of the current project to a\npre-release as well, you need to use the modern pre command.\n\n> dist-tag can be understood as: tagging the current release. Generally\n> speaking, the dist-tag for the default release is latest, so you can consider\n> latest as the dist-tag for the official release.\n\n\nPre-releases#\n\nWhen a pre-release is needed before the official release, the following command\nis executed.\n\n * modern pre\n\nFirst modern pre enter to enter pre-release mode, can be the same as the tag\nspecified with the modern release --tag command when releasing the project.\n\n\n\nThen you can update the specific version number with the modern bump command,\nwhich doesn't actually \"consume\" the Markdown file that records the changes:\n\n\n\nThen you can see that the updated version number in package.json will look like\nthis: 0.1.2-next.0.\n\nFinally, if you don't need to do a pre-release anymore, be sure to run the\nmodern pre exit command to exit the pre-release state and to release the\nofficial version when you run the modern bump command again.","routePath":"/module-tools/en/guide/basic/publish-your-project","lang":"en","toc":[{"text":"Tracking changes","id":"tracking-changes","depth":2,"charIndex":610},{"text":"Version update","id":"version-update","depth":2,"charIndex":1355},{"text":"Publish","id":"publish","depth":2,"charIndex":1780},{"text":"Pre-releases","id":"pre-releases","depth":2,"charIndex":2468}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":25,"title":"Using the Microgenerator","content":"#\n\nModern.js Module provides the Microgenerator tool, which allows for the current\nproject to.\n\n * add new directories and files\n * Modify the contents of the package.json file\n * Execute commands\n\nThus with these capabilities, Microgenerator can enable additional feature\nfunctionality for the project.\n\nThe microgenerator can be started via modern new. The current Microgenerator\nfeatures supported by the Modern.js Module are:\n\n\nDevelop Module Doc#\n\nWhen we want to write documentation for out module project, we can enable the\nmodule doc feature. will create docs directory and related files in the project\ndirectory, and add \"@modern-js/plugin-rspress\" dependency in package.json. Use\nmodern dev and modern build --platform to debug and build your doc site.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n\n\n\nStorybook#\n\nThe Storybook feature can be enabled when we want to debug a component or a\ncommon module. When this feature is enabled, the stories directory and\n.storybook directory are created in the project directory, and a new\n\"@modern-js/storybook\" dependency is added to package.json. Use storybook dev\nand storybook build to debug and build.\n\n\nTailwind CSS Support#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nIf you want to use Tailwind CSS for a project, you can refer to \"Using Tailwind\nCSS\".\n\n\nModern.js Runtime API#\n\nModern.js provides Runtime API capabilities that can only be used in the\nModern.js application project environment. If you need to develop a component\nfor use in a Modern.js application environment, then you can turn on this\nfeature and the microgenerator will add the \"@modern-js/runtime\" dependency.\n\nAlso, the Storybook debugging tool will determine if the project needs to use\nthe Runtime API by checking the project's dependencies and providing the same\nRuntime API runtime environment as the Modern.js application project.\n\n:::tip After successfully enabling it, you will be prompted to manually add a\ncode similar to the one below to the configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-micro-generator","lang":"en","toc":[{"text":"Develop Module Doc","id":"develop-module-doc","depth":2,"charIndex":431},{"text":"Storybook","id":"storybook","depth":2,"charIndex":895},{"text":"Tailwind CSS Support","id":"tailwind-css-support","depth":2,"charIndex":1243},{"text":"Modern.js Runtime API","id":"modernjs-runtime-api","depth":2,"charIndex":1528}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":26,"title":"Developing Module documentation","content":"#\n\nThis chapter describes how to quickly build a static documentation site for a\nmodule project.\n\n\nBefore we start#\n\n\nWhy we need to build a documentation site for a module#\n\n 1. a documentation site can help us to better organize the structure of the\n documentation.\n 2. the documentation site has better presentation, such as the ability to\n execute functions in the page, render components.\n 3. to make better use of AI search capabilities.\n\n\nPreliminary preparation#\n\n 1. Enable the documentation feature via micro-generator.\n 2. Read Introduction to Rspress.\n\nAfter finishing the preparation work, we will build a documentation site for the\nmodule project based on Rspress.\n\n\nBasic site structure#\n\nThe overall layout of the site consists of three parts: the navigation bar, the\nsidebar and the body part, which also includes the TOC (Table of contents found\nat the beginning of a book or document).\n\nThe Rspress uses File System Routing, on which the module documentation is\nbased, to automate the generation of the sidebar. For example, if you have the\nfollowing file structure:\n\n\n\nThen the routing path for foo/bar.md will be /foo/bar, the routing path for\nfoo.md will be /foo, and the routing path for index.md will be /.\n\nThe specific mapping rules are as follows:\n\nFILE-PATH ROUTING-PATH\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\nThe sidebars corresponding in turn to the above file paths and routing paths are\nshown below:\n\n\nConfigure sidebar#\n\nAs shown in the figure above, the module documentation has automatically\ngenerated sidebars for file system routing, where the text of each column of the\nsidebar is determined by the file's first level title or directory name. If you\nneed to customize the sidebar, please use _meta.json or configure sidebar\ndirectly.\n\nINFO\n\nIf your document directory structure complies with internationalization, for\nexample:\n\n\n\nYou need to follow internationalization guide and configure lang 和 locales,\notherwise, the automatically generated sidebar of the module will not handle the\nzh and en directories.\n\n\nWriting Documentation#\n\nNext, we can focus on writing the content of the document. In addition to the\nbasic Markdown syntax, you may also need to understand the following advanced\ntopics:\n\n * Using MDX\n * Using Assets\n\n\nComponent preview#\n\nModule documentation provides preview capabilities for component libraries. The\ncontents in code blocks written in jsx and tsx will be parsed as React\ncomponents.\n\n\nExample#\n\nHere is a complete example using the component preview feature:\n\nAssuming our project name is demo and we export a Button component.\n\n 1. Add a new docs/Button.mdx file:\n\n\n\n 2. In the tsconfig.json, configure aliases and point the package name to the\n current project directory, make the way document developers and users use\n components consistent:\n\n\n\n 3. In the .gitignore, add doc_build/:\n\n\n\nCongratulations, you have finished writing a component document, execute pnpm\nrun dev to see the result, remember to build the component library first to make\nsure the component product exists.\n\n\nMobile Preview#\n\nAlso, we support mobile preview mode, i.e. rendering mobile components using\niframe, and set iframe position by iframePosition, support swipe preview and new\npage opening.\n\n\n\nTIP\n\nIf you only want to change the way a particular jsx and tsx block is previewed,\nyou can use a different modifier to identify it:\n\n\n\n\nUsing external demos#\n\nIf our demo is very complex, then it is recommended to write the demo separately\nand then use the code tag in the mdx:\n\n\n\nThis also supports setting the preview method for each individual code block,\nfor example:\n\n\n\n\nUsing built-in components#\n\nThe plugin implements some built-in components internally so that you can\ndevelop module documentation more easily.\n\n\nAPI#\n\nDisplay the API content of the module.\n\nParse file#\n\nBefore we can use the API component, we first need to specify the files to\nparse:\n\n\n\nContent generation#\n\nNext, we'll see what kind of markdown content is generated based on the parsed\nfile.\n\nContent can be generated with two different tools, react-docgen-typescript or\ndocumentation:\n\n * react-docgen-typescript is targeted at component library scenarios and will\n only parse props to generate tables.\n\n\n\nThe above is a standard writeup where ButtonProps will be extracted into the\ntable and Button will be the title of the table. If you use the default export,\nthe filename will be used as the form title.\n\nNotice that export features declared elsewhere are not available.\n\n\n\nThe generated content is as follows:\n\n\n\nWARNING\n\nIf React types are used in Props, you need to add the types in tsconfig.json,\notherwise the types will not be resolved under the React namespace.\n\n\n\nThe best way is that you import the type directly:\n\n\n\n * documentation is used in tool library scenarios to parse JSDoc annotations.\n\n\n\nThe above is a greet function with a JSDoc annotation. The generated content is\nas follows:\n\n\n\nUsing the component#\n\nNext, you can use our built-in API components in your documentation by passing\nthe key value into the moduleName property。\n\n\n\n\nOverview#\n\nDisplays a list of modules that can be placed on the front page to display all\nmodules.\n\nThe Overview component has only one list property, which receives an array of\nobjects, and the following properties of the objects\n\nPROPERTY DESCRIPTION TYPE DEFAULT\nicon icon React.ReactNode \ntext text(required) string \nlink link(required) string \narrow whether to show arrows boolean false\n\n\nPlugin options#\n\n\napiParseTool#\n\nAPI parse tool.\n\n * Type:'react-docgen-typescript' | 'documentation'\n * Default: 'react-docgen-typescript'\n\n\ndoc#\n\nConfig.\n\n\nentries#\n\nModule names and relative paths for automatically generated documents.\n\n * Type:Entries | ToolEntries\n * Default: {}\n\n\n\nIt also supports the use of different parsing tools for different files:\n\n\n\n\niframePosition#\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nWhen the value is follow, each code block will have an iframe showing its\nrendered view. When fixed, the iframe will be fixed to the right side of the\npage, showing the view of all the code blocks on the current page.\n\n\nparseToolOptions#\n\nAPI parse tool options.\n\n * Type:ParseToolOptions\n * Default: {}\n\n\n\n\npreviewMode#\n\n * Type:'iframe' | 'internal'\n * Default: 'internal'\n\nIn case of internal, the component will be rendered directly in the page,\notherwise it will be loaded through an iframe.\n\n\ndeprecated: languages#\n\nWARNING\n\nStarting from version 2.44.0, please refer to the Internationalization section\nto implement multiple languages.\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\nStarting from version 2.44.0, a sniffing mechanism has been implemented\ninternally, so please directly use _meta.json or directly configure sidebar to\nimplement a custom sidebar.\n\n\nScripts#\n\n * modern dev: Start dev server for doc site.\n * modern build --platform: Build doc site in production, by default output\n directories is doc_build.\n\n\nAdvanced guide#\n\nThe above has covered the basics of developing module documentation, but this is\nnot enough for developing a complete documentation station. Check out the\nRspress for an in-depth look at our documentation framework. You can modify the\ndocumentation framework configuration via the doc configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-module-doc","lang":"en","toc":[{"text":"Before we start","id":"before-we-start","depth":2,"charIndex":98},{"text":"Why we need to build a documentation site for a module","id":"why-we-need-to-build-a-documentation-site-for-a-module","depth":3,"charIndex":117},{"text":"Preliminary preparation","id":"preliminary-preparation","depth":3,"charIndex":451},{"text":"Basic site structure","id":"basic-site-structure","depth":2,"charIndex":686},{"text":"Configure sidebar","id":"configure-sidebar","depth":3,"charIndex":1493},{"text":"Writing Documentation","id":"writing-documentation","depth":2,"charIndex":2109},{"text":"Component preview","id":"component-preview","depth":2,"charIndex":2329},{"text":"Example","id":"example","depth":3,"charIndex":2514},{"text":"Mobile Preview","id":"mobile-preview","depth":3,"charIndex":3121},{"text":"Using external demos","id":"using-external-demos","depth":3,"charIndex":3451},{"text":"Using built-in components","id":"using-built-in-components","depth":2,"charIndex":3691},{"text":"API","id":"api","depth":3,"charIndex":3837},{"text":"Parse file","id":"parse-file","depth":4,"charIndex":3883},{"text":"Content generation","id":"content-generation","depth":4,"charIndex":3981},{"text":"Using the component","id":"using-the-component","depth":4,"charIndex":5005},{"text":"Overview","id":"overview","depth":3,"charIndex":5154},{"text":"Plugin options","id":"plugin-options","depth":2,"charIndex":5675},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":5693},{"text":"doc","id":"doc","depth":3,"charIndex":5817},{"text":"entries","id":"entries","depth":3,"charIndex":5833},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":6040},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":6320},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":6408},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":6599},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":6746},{"text":"Scripts","id":"scripts","depth":2,"charIndex":6967},{"text":"Advanced guide","id":"advanced-guide","depth":2,"charIndex":7130}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":27,"title":"Using Storybook","content":"#\n\nStorybook is a tool dedicated to component debugging, providing around component\ndevelopment.\n\n * Develop UIs that are more durable\n * Test UIs with less effort and no flakes\n * Document UI for your team to reuse\n * Share how the UI actually works\n * Automate UI workflows\n\nBefore when using Storybook, there are various problems related to\nconfigurations, Babel, Webpack, less or sass. Modern.js integrates with\nStorybook, which greatly simplifies configuration for us as we develop our\nStorybook project.\n\n\nV7 (Recommended)#\n\n\nEnable Storybook#\n\nYou can directly enable the Storybook feature by using the following command:\n\n\n\nThis command will create a template for Storybook, including:\n\n * Creating a configuration folder .storybook and a default configuration file\n .storybook/main.ts.\n * Creating example story components.\n * Updating package.json to add dependencies @storybook/addon-essentials and\n @modern-js/storybook, as well as creating Storybook-related scripts.\n\n\nEnable Debug output#\n\nIn fact, Modern.js Module is implemented based on esbuild, while Storybook uses\nWebpack as the default build tool, and their configurations are not fully\ncompatible. Therefore, we recommend building the components first, and then\nimporting the component output in stories.\n\nThe way to import component outputs is very simple. Suppose your module exports\na Button component, then you can use it in stories like this:\n\n\n\nIf you want to update the components, you can start the build in watch mode\nbefore starting Storybook:\n\n\n\nINFO\n\nIn the development process, you may encounter situations where you cannot get\ntype definitions in real time. Because only when the code is saved, the type\nfile under the output directory will be updated. At this time:\n\nFor pnpm projects, you can modify the package.json as follows:\n\n\n\n> For the use of publishConfig in pnpm, you can read the following link.\n\nFor npm and Yarn projects, the types value of package.json can only be modified\nmanually during the development stage and release stage.\n\n\nEnable Rspack build#\n\nRspack is known for its fast build speed. To use Rspack as a build tool in\nModern.js, you only need to configure it as follows:\n\n\n\nNote that in the above configuration, the reactDocgen configuration has been\nchanged because Rspack currently does not support\n@storybook/react-docgen-typescript-plugin.\n\n\nConfigurations#\n\nThere are some separate configurations in .storybook/main.js.\n\nbundler#\n\n * Type: 'webpack' | 'rspack'\n * Default: webpack\n\nSpecify the underlying bundler to use either Webpack or Rspack.\n\nExample:\n\n\n\nbuilderConfig#\n\n * Type: BuilderConfig\n * Default: undefined\n\nThe Storybook build capability of Modern.js is provided by Rsbuild, and the\nRsbuild configuration can be modified through builderConfig.\n\n\n\n\nCommand#\n\n@modern-js/storybook proxies some storybook cli commands\n\nstorybook dev#\n\nStart Storybook,detail\n\nstorybook build#\n\nBuild Storybook for production,detail\n\n\nMigrate from V6 to V7#\n\nOur support methods for the two versions are different, so if you are migrating\nfrom V6 to V7, we hope you will also use V7 in the same way, while making the\nfollowing adjustments:\n\n * Configuration file: Migrate any custom configurations (if any) in the\n original root/config/storybook/main.(j|t)s to the new\n root/.storybook/main.(j|t)s.\n * Dependencies: Upgrade @storybook/addon-* series dependencies (if any) to\n version 7 and delete @modern-js/plugin-storybook dependencies.\n * Commands: Delete the original edenx dev storybook and edenx build --platform\n commands. If you are used to the original pnpm run dev usage, you can replace\n it with storybook dev -p 6006 and storybook build.\n * modern.config.(j|t)s : Remove the registration of @modern-js/plugin-storybook\n plugin.\n\n\nV6 (legacy)#\n\nStarting from 2.40.0 version, @modern-js/plugin-storybook will stop iterating.\nIt is recommended to use the V7 version. If your @modern-js/module-tools version\nis lower than 2.40.0, you can use Storybook V6 in the following ways:\n\n\nStart Storybook#\n\nYou can directly use the following command to enable the Storybook feature.\n\n\n\nThis command will create commonly used templates for Storybook, including\n\n * Create stories component examples\n * Update package.json, add a dependency on @modern-js/plugin-storybook, and add\n related scripts such as pnpm dev storybook.\n\n\nConfigure Storybook#\n\nThe Storybook official configures the project through a folder named .storybook,\nwhich contains various configuration files. In Modern.js Module, you can add\nStorybook configuration files in the project's config/storybook directory.\n\nFor how to use various Storybook configuration files, you can check the\nfollowing link:\n\n * Configure Storybook\n\nHowever, there are some restrictions when using it in module projects:\n\n * Cannot change the location where Story files are stored, that is, the stories\n configuration cannot be modified in the main.js file.\n * Cannot modify the configuration related to Webpack and Babel, that is, the\n webpackFinal and babel configurations cannot be modified in the main.js file.\n\n\nBuild Storybook Output#\n\nIn addition to debugging the component or ordinary modules with Storybook, you\ncan also use the following command to execute the Storybook build task.\n\n\n\nAfter the build is complete, you can see the build output files in the\ndist/storybook-static directory.","routePath":"/module-tools/en/guide/basic/using-storybook","lang":"en","toc":[{"text":"V7 (Recommended)","id":"v7-recommended","depth":2,"charIndex":511},{"text":"Enable Storybook","id":"enable-storybook","depth":3,"charIndex":531},{"text":"Enable Debug output","id":"enable-debug-output","depth":3,"charIndex":985},{"text":"Enable Rspack build","id":"enable-rspack-build","depth":3,"charIndex":2036},{"text":"Configurations","id":"configurations","depth":3,"charIndex":2361},{"text":"bundler","id":"bundler","depth":4,"charIndex":2441},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":2579},{"text":"Command","id":"command","depth":3,"charIndex":2782},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":2850},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":2890},{"text":"Migrate from V6 to V7","id":"migrate-from-v6-to-v7","depth":2,"charIndex":2948},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":3767},{"text":"Start Storybook","id":"start-storybook","depth":3,"charIndex":4013},{"text":"Configure Storybook","id":"configure-storybook","depth":3,"charIndex":4352},{"text":"Build Storybook Output","id":"build-storybook-output","depth":3,"charIndex":5092}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":28,"title":"Developing Components","content":"#\n\nThis chapter will describe how to develop component projects using the Modern.js\nModule.\n\n\nInitialize the project#\n\n 1. It is recommended to use the @modern-js/create command to initialize an npm\n project.\n\n\n\n 2. The initialized directory structure:\n\n\n\n 3. Finally, modify the file suffix and content of ./src/index.ts as follows,\n and the initialization of the component project is completed.\n\n\n\n\nDebugging code with Storybook#\n\nPlease refer to \"Using Storybook\" to debug code using Storybook.\n\n\nDeveloping Styles#\n\nNext we can add styles to the component.\n\nThe following capabilities are currently supported for developing styles.\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module supports PostCSS and has the following built-in PostCSS\nplugins.\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\nSo we can create .css files in our projects and use the syntax support and\ncapabilities provided by these plugins directly in our css files.\n\n * Source Code:\n\n\n\n * CSS artifact:\n\n\n\n\nLess#\n\nModern.js Module supports development styles using Less.\n\n> The current built-in Less version is v4.1.3\n\n * Source Code:\n\n\n\n * Less artifact:\n\n\n\n\nSass/Scss#\n\nModern.js Module supports developing styles using Scss/Sass.\n\n> The current built-in Sass version is v1.54.4\n\n * Source code:\n\n\n\n * Less artifact:\n\n\n\n\nTailwind CSS#\n\nPlease refer to \"Using Tailwind CSS\" for detailed usage.\n\n\nCSS Modules#\n\nModern.js Module supports the development of styles using CSS Modules. By\ndefault, the following files are recognized as CSS Module files.\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\nIf you need to configure CSS Modules, you can check out the API at\n\n * style.autoModules\n * style.modules\n\nThe following is a code example.\n\n\n\n\n\n\nConfiguring build artifacts#\n\nBased on most scenarios of component project usage, it is recommended to use the\nnpm-component build preset. This preset yields a output directory structure of\n\n\n\n * . /dist/es: Contains bundleless artifacts in ES modules format that support\n the es6 syntax.\n * . /dist/lib: Contains bundleless artifacts in CommonJS format with support\n for es6 syntax.\n * . /dist/types: Contains the types file.\n\nThe buildPreset can be configured manually if there is a requirement to use\nsyntax support, and supports modifying the supported syntax by adding a suffix\nto npm-component.\n\n\n\nIf you have special needs for the build artifacts directory structure, you can\nuse the buildConfig API, which can be used by the following documentation.\n\n * modify-output-product\n * in-depth-about-build\n\n\nReleasing components#\n\nIt is recommended to use the version release feature provided by Modern.js\nModule. You can refer to the \"Version Management and Release\" section for more\ninformation.","routePath":"/module-tools/en/guide/best-practices/components","lang":"en","toc":[{"text":"Initialize the project","id":"initialize-the-project","depth":2,"charIndex":93},{"text":"Debugging code with Storybook","id":"debugging-code-with-storybook","depth":2,"charIndex":406},{"text":"Developing Styles","id":"developing-styles","depth":2,"charIndex":505},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":711},{"text":"Less","id":"less","depth":3,"charIndex":1098},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":1251},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":1414},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":1488},{"text":"Configuring build artifacts","id":"configuring-build-artifacts","depth":2,"charIndex":1852},{"text":"Releasing components","id":"releasing-components","depth":2,"charIndex":2666}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":29,"title":"Using Tailwind CSS","content":"#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nModern.js Module supports developing component styles using Tailwind CSS.\n\n\nEnabling Tailwind CSS#\n\nTo use Tailwind CSS in Modern.js Module, you can follow the steps below:\n\n 1. Run pnpm run new in the root directory of your project and make the\n following selections:\n\n\n\nAfter successful initialization, you will see that the package.json has added\ndependencies for tailwindcss and @modern-js/plugin-tailwindcss.\n\n 2. Register the Tailwind plugin in modern.config.ts:\n\n\n\n 3. Create a index.css file and add the following code:\n\n\n\nINFO\n\nDepending on your needs, you can selectively import the CSS styles provided by\nTailwind CSS. Please refer to the @tailwind documentation for detailed usage of\nthe @tailwind directive.\n\n 4. Import the index.css file, for example, add the following code in the root\n component src/index.jsx:\n\n\n\n 5. Now you can use the Utility Classes provided by Tailwind CSS in your\n components:\n\n\n\n\nConfiguring Tailwind CSS#\n\nIn Modern.js Module, you have two ways to configure Tailwind CSS:\n\n 1. Using the tailwind.config.{ts,js} file, which follows the official usage of\n Tailwind CSS. Please refer to \"Tailwind CSS - Configuration\" for more\n details.\n\n\n\nTIP\n\nPlease upgrade Modern.js to version >= 2.33.0 to support automatic reading of\ntailwind.config.{ts,js} files.\n\n 2. Using the style.tailwindcss configuration option. This is the old way of\n configuring Tailwind CSS, and we recommend using the tailwind.config.{ts,js}\n file for configuration.\n\n\n\nIf you are using both the tailwind.config.{ts,js} file and style.tailwindcss\noption, the configuration defined in style.tailwindcss will take precedence and\noverride the content defined in tailwind.config.{ts,js}.\n\n\nTailwind CSS Autocomplete#\n\nTailwind CSS provides an official extension called Tailwind CSS IntelliSense for\nautocompletion of Tailwind CSS class names, CSS functions, and directives in VS\nCode.\n\nYou can follow the steps below to enable the autocomplete feature:\n\n 1. Install the Tailwind CSS IntelliSense extension in VS Code.\n 2. If the root directory of your project does not have a\n tailwind.config.{ts,js} file, you need to create one and write the Tailwind\n CSS configuration for your current project. Otherwise, the IDE plugin will\n not work correctly.\n\n\nBuild Modes#\n\nWhen using Tailwind CSS, please note that there are significant differences\nbetween the bundle and bundleless modes in terms of the build artifacts.\n\nTIP\n\nFor definitions of bundle and bundleless, please refer to the \"In-depth\nunderstanding of build\".\n\n\nBundle Mode#\n\nIn Bundle mode, a separate CSS file is generated, and the JS output does not\nautomatically reference the CSS output file.\n\n * Source code:\n\n\n\n * Output code:\n\n\n\n\n\nIf you need to inject styles into the JS artifact, you can enable the\nstyle.inject option.\n\nIf you haven't enabled style.inject, you can also let users manually import the\nCSS file:\n\n\n\n\nBundleless Mode#\n\nIn bundleless mode, the CSS file is automatically imported in the artifact code\nwithout the need for additional processing.\n\n * Output code:\n\n\n\n\nClass Name Prefix#\n\nYou can add a class name prefix using the prefix option provided by Tailwind\nCSS. This helps avoid potential class name conflicts, such as when different\nversions of Tailwind CSS are used in different parts of an application or\nmodule.\n\nFor example, you can add the foo- prefix using the prefix option in\ntailwind.config.js:\n\n\n\n * Source Code:\n\n\n\n * Output Code:\n\n\n\n\nUsage Guide#\n\nHere are some usage examples of Tailwind CSS.\n\n\nHTML Class Names#\n\nTailwind CSS supports adding styles to HTML tags through class names. When using\nHTML class names, please note that the corresponding CSS styles of Tailwind CSS\nmust be imported in advance.\n\n\n\nGenerated styles (after bundling):\n\n\n\n\n@apply#\n\nTailwind CSS provides the @apply directive, which allows us to inline the styles\nprovided by Tailwind CSS into our own styles.\n\n@apply can be used in CSS, Less, and Sass.\n\n\n\nHowever, there are some considerations when using it with Less and Sass:\n\nSass#\n\nWhen using Tailwind with Sass and there is an !important after @apply,\ninterpolation should be used to ensure Sass compiles correctly.\n\n * Won't work as expected:\n\n\n\n * Will work as expected:\n\n\n\nLess#\n\nWhen using Tailwind with Less, you cannot nest Tailwind's @screen directive.\n\n * Won't work as expected:\n\n\n\n * Instead, use regular media queries and the theme() function to reference your\n screen sizes or simply avoid nesting your @screen directive.\n\n\n\n\n\n\nAbout designSystem config#\n\ndesignSystem is a deprecated configuration option in Modern.js Module.\n\nStarting from Modern.js Module version 2.33.0, you can use the theme\nconfiguration option of Tailwind CSS as a replacement for designSystem. It is no\nlonger necessary to split the theme configuration and set it on designSystem.\n\n * Previous usage:\n\n\n\n * Current usage:\n\n","routePath":"/module-tools/en/guide/best-practices/use-tailwindcss","lang":"en","toc":[{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":2,"charIndex":252},{"text":"Configuring Tailwind CSS","id":"configuring-tailwind-css","depth":2,"charIndex":1105},{"text":"Tailwind CSS Autocomplete","id":"tailwind-css-autocomplete","depth":3,"charIndex":1889},{"text":"Build Modes","id":"build-modes","depth":2,"charIndex":2460},{"text":"Bundle Mode","id":"bundle-mode","depth":3,"charIndex":2728},{"text":"Bundleless Mode","id":"bundleless-mode","depth":3,"charIndex":3091},{"text":"Class Name Prefix","id":"class-name-prefix","depth":2,"charIndex":3254},{"text":"Usage Guide","id":"usage-guide","depth":2,"charIndex":3641},{"text":"HTML Class Names","id":"html-class-names","depth":3,"charIndex":3703},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":4211},{"text":"Less","id":"less","depth":4,"charIndex":4413},{"text":"About `designSystem` config","id":"about-designsystem-config","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":30,"title":"General Questions","content":"#\n\n\nWhat is the relationship between Modern.js Module and Rsbuild?#\n\nModern.js Module uses esbuild to build toolkits and component libraries, and\nRsbuild focuses on solving web application building scenarios.\n\n\nCan Modern.js Module use webpack plugins or loaders?#\n\nModern.js Module is based on esbuild for building and cannot use tools from the\nwebpack-related ecosystem. You can find more community plugins for esbuild here\n\nIf the UMD product produced by Modern.js Module does not meet your requirements,\nyou can use Rsbuild and add UMD Plugin to build UMD products.","routePath":"/module-tools/en/guide/faq/basic","lang":"en","toc":[{"text":"What is the relationship between Modern.js Module and Rsbuild?","id":"what-is-the-relationship-between-modernjs-module-and-rsbuild","depth":2,"charIndex":3},{"text":"Can Modern.js Module use webpack plugins or loaders?","id":"can-modernjs-module-use-webpack-plugins-or-loaders","depth":2,"charIndex":210}],"domain":"","frontmatter":{},"version":""},{"id":31,"title":"Build FAQ","content":"#\n\nHere only some common problems and bad cases are recorded.\n\nIf the build products do not meet expectations, especially when buildPreset is\nconfigured, please first understand what configuration items buildPreset\nrepresents, and then check each configuration item based on all configuration\nitems.\n\n\nProduct FAQ#\n\n\nInitialization of Class Fields#\n\nTypeSript provides the useDefineForClassFields configuration to control the\nconversion handling for public class fields.\n\nIf we have a piece of code:\n\n\n\nWhen useDefineForClassFields is false, then the compiled code will look like:\n\n\n\nWhen useDefineForClassFields is true, then the compiled code will look like:\n\n\n\nAlso the default value of this configuration will change depending on the target\nconfiguration of tsconfig.json: When target is ES2022 or higher, then\nuseDefineForClassFields is configured to true by default, otherwise it defaults\nto false.\n\nFor more information on this configuration of TypeScript, you can refer to the\nfollowing link:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nThe Modern.js Module will currently process according to the following logic:\n\n 1. The first decision to enable this feature inside Modern.js Module is based\n on the useDefineForClassFields configuration in tsconfig.json of the current\n project. Currently, only the contents of the tsconfig.json file under the\n current project path will be read, and the final tsconfig configuration\n based on the extends configuration is not supported at this time.\n 2. If the useDefineForClassFields configuration of tsconfig.json is not\n detected, the default value is determined based on the target configuration\n of tsconfig.json. If target is greater than ES2022 (including EsNext), then\n useDefineForClassFields defaults to true, otherwise it is false.\n 3. If the target of tsconfig.json is not detected, it is processed according to\n the value of useDefineForClassFields as true.\n\n\nbabel-plugin-lodash treats the introduced lodash as undefined#\n\nThis problem occurs when using something like the following:\n\n\n\nCurrent related issues on the babel-plugin-lodash Github:\n\n * #235\n\nThe solution to this problem is to remove babel-plugin-lodash, since the plugin\nis not needed for on-demand referencing at this point and using it would have\nside effects.\n\nA similar situation occurs with babel-plugin-import. If there is code like the\nfollowing:\n\n\n\nIn this case babel-plugin-import may also cause Comps to become undefined. So\nyou need to remove the corresponding babel-plugin-import as well.\n\n\nCannot find module http#\n\nIf the output reports an error like Cannot find module 'http' at browser\nruntime, it means that your output has bundled node modules. This may occur if\nsome of your dependencies support both browser and node, such as axios, in which\ncase you only need to set the platform to browser. If some third-party packages\ndon't support the browser, you may need to manually inject node polyfill.\n\n\nExceptions FAQ#\n\n\nDynamic require of \"react\" is not supported#\n\nProblem Description#\n\nWhen the product format in the product configuration of the build is ES modules.\n\n\n\nIf you import a cjs product from a third-party npm package, the resulting\nproduct may not work properly under webpack.\n\n\n\nSolution#\n\n 1. First you need to find which third-party package is causing the problem. For\n example, if the error message points to the react package, then look for a\n third-party package that has code like require('react') in it. For example\n react-draggable, which only contains cjs artifacts, then the problem is\n localized to the react-draggable package.\n 2. Then we need to exclude this package with the following configuration, i.e.\n not package problematic third-party packages.\n\n\n\nReference Links#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\nDuring compilation, an error was reported in the less file of a component\nlibrary:'Operation on an invalid type'#\n\nThis is probably because the component library depends on Less version v3, while\nModern.js Module defaults to v4. v3 and v4 have a Break Change in the math\nconfiguration, check this link for details.\n\nTherefore, if a component library like this is used in the source code:\n\nbuildPreset is used in the build configuration, make the following changes:\n\n\n\nOr, if a custom buildConfig is used, modify it as follows:\n\n\n\nIf you are using a component like this in Storybook, you will need to modify the\ndebugging configuration of Storybook:\n\n\n\n\nBundleless DTS failed#\n\nIn the bundleless scenario, it's tsc that generates the type declaration file\ndirectly. You can find the problem file by printing the error message in the\nterminal. For source code files, it is recommended to fix the type problem,\nwhich can better enable reuse of your package. However. if you encounter a type\nchecking problem with a thrid-party package:\n\n 1. enable skipLibCheck to skip the d.ts check of the thrid-party package.\n 2. If the package exports ts files directly, skipLibCheck will not work because\n it can only skip the d.ts check, so you can only turn off dts.abortOnError\n to ignore these errors.\n\n\nBundle DTS failed#\n\nThe Modern.js Module directly uses rollup-plugin-dts to package your type\ndescription files. It may not be able to handle the type files of some\nthird-party dependencies\n\nIf you encounter an error message titled \"Bundle DTS failed\" during the build\nprocess of the Modern.js Module, you can observe that the error message is from\na third-party dependency. Try setting dts.respectExternal to false to turn off\nthe behavior of packaging type files of third-party dependencies.\n\n\nError reported for defineConfig function type: If there is no reference to \"...\"\nthen the inferred type of \"default\" cannot be named#\n\nCheck if the include configuration exists in the project's tsconfig.json file,\nand if not, try adding the following:\n\n\n\n\nOther FAQ#\n\n\nHow to skip the pre-processing of less/scss files with bundleless#\n\nBundleless is a single-file compilation method. You just need to remove your\nless/scss files from the entry and copy them to the output. Note that we will\nalso rewrite the moduleId of js referencing less/scss, turn it off through the\nredirect plugin.\n\nBelow is an example of skipping less file processing. You will find that all\nless files in src are copied to dist and the relative path is preserved.\n\n\n\n\nAdd additional compilation feature#\n\nThe Modern.js Module is based on the esbuild implementation, so if you have\nspecial needs or want to add additional compilation capabilities, you can do so\nby implementing the esbuild plugin.\n\nThe Modern.js Module provides esbuildOptions configuration to allow modification\nof Modern.js's internal esbuild configuration, so that custom esbuild plugins\ncan be added via this configuration:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\n\nSupport for generating TypeScript declaration files for CSS Modules#\n\n * First Solution: typed-css-modules\n * Second Solution: postcss-modules-dts\n\n","routePath":"/module-tools/en/guide/faq/build","lang":"en","toc":[{"text":"Product FAQ","id":"product-faq","depth":2,"charIndex":301},{"text":"Initialization of Class Fields","id":"initialization-of-class-fields","depth":3,"charIndex":316},{"text":"babel-plugin-lodash treats the introduced lodash as `undefined`","id":"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module http","id":"cannot-find-module-http","depth":3,"charIndex":2578},{"text":"Exceptions FAQ","id":"exceptions-faq","depth":2,"charIndex":2993},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":3011},{"text":"Problem Description","id":"problem-description","depth":4,"charIndex":3057},{"text":"Solution","id":"solution","depth":4,"charIndex":3285},{"text":"Reference Links","id":"reference-links","depth":4,"charIndex":3790},{"text":"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`","id":"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":4558},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":5204},{"text":"Error reported for `defineConfig` function type: `If there is no reference to \"...\" then the inferred type of \"default\" cannot be named`","id":"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named","depth":3,"charIndex":-1},{"text":"Other FAQ","id":"other-faq","depth":2,"charIndex":5956},{"text":"How to skip the pre-processing of less/scss files with bundleless","id":"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless","depth":3,"charIndex":5969},{"text":"Add additional compilation feature","id":"add-additional-compilation-feature","depth":3,"charIndex":6443},{"text":"Support for generating TypeScript declaration files for CSS Modules","id":"support-for-generating-typescript-declaration-files-for-css-modules","depth":3,"charIndex":7171}],"domain":"","frontmatter":{},"version":""},{"id":32,"title":"FAQ","content":"#\n\nHere is a list of all frequently asked questions about Modern.js Module.\n\n * General FAQ\n * Build FAQ\n * Storybook FAQ\n * Test FAQ","routePath":"/module-tools/en/guide/faq/","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":33,"title":"Storybook FAQ","content":"#\n\n\nStorybook v7 Support#\n\nStorybook v7 is now fully supported and has become our recommended version.\n\n\nUsing Storybook Addon or other configurations does not work#\n\nModern.js Module is currently using Storybook version v6, if you are using Addon\nversion v7 you may not be able to get the addon to work.\n\nIn addition to the Addon, other configurations may also have differences. For\nexample, if you modify the preview.js configuration file, Storybook v6 is\nwritten differently than v7:\n\n * v6:Document\n * v7:Document\n\n\nCannot find module 'react-dom/package.json#\n\nWhen debug Storybook, the following problem occurs:\n\n\n\nYou can install the react-dom dependency in the project.\n\n\n\n\nUnable to locate the specific error message#\n\nSolutions:\n\n 1. Find @storybook/core-server/dist/cjs/dev-server.js\n 2. Find this code: var _await$Promise$all = await Promise.all([preview,\n manager,.\n 3. Modify it:\n\n\n\n\nCan`t find any stories is your Storybook#\n\n\n\nWhen you get a problem like this, you can first open the browser console and\nthere should be some error messages. You can use the error messages to deduce if\nthere is a problem in the code you are writing that is causing Storybook to not\nwork properly.\n\n\nStorybook Adds Proxy Functionality#\n\nStorybook does not provide a solution for this, but there is one in the\nStorybook Issue. In the Modern.js Module, you can:\n\n 1. Add the config/storybook/middleware.js file and initialize the following:\n\n\n\n 2. add http-proxy-middleware dependency\n 3. Add proxy routing-related configuration\n\n\n\nLink:https://github.com/storybookjs/storybook/issues/11551","routePath":"/module-tools/en/guide/faq/storybook","lang":"en","toc":[{"text":"Storybook v7 Support","id":"storybook-v7-support","depth":2,"charIndex":3},{"text":"Using Storybook Addon or other configurations does not work","id":"using-storybook-addon-or-other-configurations-does-not-work","depth":2,"charIndex":104},{"text":"Cannot find module 'react-dom/package.json","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":519},{"text":"Unable to locate the specific error message","id":"unable-to-locate-the-specific-error-message","depth":2,"charIndex":680},{"text":"Can`t find any stories is your Storybook","id":"cant-find-any-stories-is-your-storybook","depth":2,"charIndex":899},{"text":"Storybook Adds Proxy Functionality","id":"storybook-adds-proxy-functionality","depth":2,"charIndex":1199}],"domain":"","frontmatter":{},"version":""},{"id":34,"title":"Test FAQ","content":"#\n\n\nExecute test command with an error TypeError: Cannot read property\n'testEnvironmentOptions' of undefined#\n\n\n\nYou can check whether other projects in Monorepo have jest-environment-jsdom\ndependencies and unify them with the overrides provided by Monorepo.","routePath":"/module-tools/en/guide/faq/test","lang":"en","toc":[{"text":"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`","id":"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":35,"title":"Quick Start","content":"#\n\n\n3 minute demo#\n\nWant to experience Modern.js Module in action? The only prerequisite you need is\nNode.js LTS and make sure your Node version is >= 16.0.0.We recommend using the\nLTS version of Node.js 18.\n\n\nCreate new project#\n\nIf you want to create a complete Modern.js Module, you can execute the following\ncommand:\n\n\n\nINFO\n\nExecute npx @modern-js/create -h for more command line arguments\n\nNext, in the issue interaction, follow the options below.\n\n\n\n> The project name is the value of the \"name\" field in package.json.\n\nThen the process of initializing the project will start. After the project\ndirectory and files are generated and the dependencies are installed, a complete\nmodule project is created.\n\nWe can start the project build directly with the pnpm build command, and start\nthe build in watching mode with the pnpm build --watch command.\n\n\nAdd to an existing project#\n\nFrom your shell, install the following dependencies in your project.\n\n * @modern-js/module-tools\n * \"typescript\" (omitted if not a TypeScript project)\n\n> If it's a TypeScript project, add the \"typescript\" dependency.\n\n> For projects that use pnpm or the Yarn package manager, just replace npm. pnpm\n> is recommended.\n\nNext, create the modern.config.(t|j)s file in the root of the project.\n\n\n\nFinally, add the command \"build\": \"modern build\" to the project's package.json\nfile.\n\n\n\nIf your project has a src/index.(js|jsx) file or both src/index.(ts|tsx) and\ntsconfig.json files, then congratulations you can run the npm run build command\ndirectly to build your project with Modern.js Module.\n\n\nCore npm Package#\n\n@modern-js/module-tools is the core npm package of Modern.js Module, providing\nthe following capabilities:\n\n * It offers commonly used CLI commands such as modern dev, modern build, and\n more.\n * It integrates Modern.js Core, providing capabilities for configuration\n parsing, plugin loading, and more.\n * It integrates esbuild and SWC, providing build capabilities.\n * It integrates some commonly used plugins, such as plugin-lint,\n plugin-changeset, and others.\n\n@modern-js/module-tools is implemented based on the plugin system of Modern.js.\nEssentially, it is a plugin. Therefore, you need to register moduleTools in the\nplugins field of the configuration file:\n\n\n\n\nView official example#\n\nIf you want to see the complete project using the Modern.js Module, you can\nexecute the following command.\n\n\n\n\nLet's get started#\n\nChoose your tutorial scenario...\n\n * I'm a beginner and need to learn basic usage of Modern.js Module.\n * I have learned the basic usage of Modern.js Module and can learn advanced\n usage of Modern.js Module.\n * I need to expand my project capabilities and need to learn how to develop\n plugins for Modern.js Module.","routePath":"/module-tools/en/guide/intro/getting-started","lang":"en","toc":[{"text":"3 minute demo","id":"3-minute-demo","depth":2,"charIndex":3},{"text":"Create new project","id":"create-new-project","depth":3,"charIndex":209},{"text":"Add to an existing project","id":"add-to-an-existing-project","depth":3,"charIndex":855},{"text":"Core npm Package","id":"core-npm-package","depth":3,"charIndex":1577},{"text":"View official example","id":"view-official-example","depth":3,"charIndex":2272},{"text":"Let's get started","id":"lets-get-started","depth":2,"charIndex":2407}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":36,"title":"Welcome to Modern.js Module","content":"#\n\nModern.js Module is a modules engineering solution for Modern.js, as well as a\ncore dependency. It allows developers to build, debug, and publish module type\nproject more easily. A module type project can mostly be thought of as an npm\npackage type project, which may be a component, component library or tool\nlibrary project.\n\nIf you are planning to develop a project of the npm package type, then you came\nto the right place! Modern.js provides a professional Modern.js Module. It gives\nyou:\n\n * Simple project initialization: simply execute the npx @modern-js/create\n project-dir command, followed by a few interactive questions, to create a\n complete module type project. The created project also supports the choice of\n two package managers, pnpm and Yarn.\n * Code formatting: In Modern.js Module, you can execute modern lint to format\n the code. The initialized module project includes the ESLint ruleset for\n Modern.js for most scenarios.\n * Comprehensive build capabilities and faster builds: Modern.js Module provides\n high-performance build capabilities based on esbuild and SWC, and provides\n rich configurations for different build scenarios.\n * Storybook debugging tools: Modern.js Module provides Storybook debugging\n tools for debugging module projects. After installing the Storybook plugin\n for Modern.js Module, you can start it with the storybook dev command. You\n can use Storybook not only for debugging components, but also for other types\n of modules.\n * Testing capabilities with Jest: When you need to test a module, you can use\n the modern test command of Modern.js Module, which not only integrates with\n Jest, but also provides an API for configuring Jest.\n * Versioning based on Changesets: When you need to record changes to a project,\n you can use the modern change command to generate a Markdown file containing\n the changes; when you need to upgrade a project, you can use the modern bump\n command to analyze and upgrade the version through the Markdown file; when\n you need to release a project, you can use the modern release command to\n release the project; Modern.js Module implements these commands based on\n Changesets.\n * Extensible plugin mechanism: Want to integrate additional debugging tools for\n your project? Or maybe you want to do some extra processing during the build\n process, Modern.js Module provides a plugin mechanism and plugin hooks that\n cover both the dev command and the build command process. You can use them to\n extend the capabilities of your project.\n * Lots more! Modern.js Module will continue to optimize its build and debug\n features in the future. If there are important issues to be solved in module\n project building, or if a mainstream module project debugging tool or pattern\n emerges, then they will probably be supported by Modern.js Module.","routePath":"/module-tools/en/guide/intro/welcome","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":37,"title":"Why you need Modern.js Module","content":"#\n\nYou've probably all experienced it: when developing a component library or tool\nlibrary from scratch, we have to consider not only how to write the code logic\nof the project itself, but also how to build, debug, test, format the code, and\nother things that have nothing to do with the code logic.\n\nFor example, when we consider which builder is used to build the code for a\nmodule project, we might previously consider webpack or Rollup, but now we might\nalso consider esbuild or SWC.\n\nRegardless of which builder is chosen, this is going to be a costly learning\ncurve for developers who are not skilled in the use of these build tools. Even\nif you want to use them quickly, it will take a lot of time and effort.\n\nIn addition to the build, things like providing debugging tools for projects,\nsupporting testing capabilities, adding code format validation, etc. can take a\nlong time and effort for a novice to understand or master them and actually\nserve the current project.\n\nTo ensure the quality of the code and the integrity of the project, we often\nneed to do these things that are not related to the logical implementation of\nthe code. However, these things are likely to affect the overall project\ndevelopment progress, reduce the developer's development experience, and make\nthe developer feel that the development threshold of the module project is very\nhigh.\n\nIf you have to go through all this work every time you develop a module type\nproject, you will spend most of your development time in the beginning on these\nthings that are not related to code implementation. If we could provide a module\nengineering solution that would help developers to solve the project engineering\nissues and allow them to focus more on code implementation, it would greatly\nimprove the module type project development experience.\n\n\n\nModern.js, in order to make developing module type projects easier, provides a\nmodule engineering solution in order to solve the above mentioned problems and\nprovides the main features using Modern.js Module. Modern.js Module can be\nunderstood as a tool dedicated to the development of module type projects.","routePath":"/module-tools/en/guide/intro/why-module-engineering-solution","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":39,"title":"Quick Start","content":"#\n\nModern.js Module not only provides a rich set of features, but also supports\nextending the capabilities of the current project by way of plugins.\n\nWe can quickly see how to write a Modern.js Module plugin by using the following\nexample.\n\n 1. First we create . /plugins/example.ts file under the initialized project.\n\n\n\n 2. Next add the code for the plugin to the example.ts file.\n\n\n\n 3. Then we register the plugin we just wrote via the plugins API.\n\n\n\n 4. Finally, run modern build and you will see:\n\n\n\nWith the above example, we learned the following things.\n\n * The recommended plugin directory structure\n * The initialization code of the plugin\n * Plugin registration\n\nIn addition to the above, we also need to understand.\n\n * plugin objects, type definitions and recommended configuration options\n * setup functions, api object parameters, lifecycle hooks","routePath":"/module-tools/en/plugins/guide/getting-started","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":40,"title":"Plugin Object","content":"#\n\nThe Modern.js Module plugin is an object, and the object contains the following\nproperties.\n\n * name: The name of the plugin, a unique identifier.\n * setup: plugin initialization function, which will be executed only once.\n setup function can return a Hooks object, and Modern.js Module will execute\n the function corresponding to the Hook defined on the Hooks object at a\n specific time.\n\nFor example, in the following plugin code example, the beforeBuild function is\ntriggered before the project starts the build task and the build start log is\nprinted.\n\n\n\n\n\n\nPlugin type definitions#\n\nWhen using TypeScript, you can introduce the built-in CliPlugin and ModuleTools\ntypes to provide the correct type derivation for plugins: ``\n\n\n\n\nPlugin configuration options#\n\nIt is recommended to write the plugin as a function, so that the plugin can\nreceive configuration options via function entry.\n\n","routePath":"/module-tools/en/plugins/guide/plugin-object","lang":"en","toc":[{"text":"Plugin type definitions","id":"plugin-type-definitions","depth":2,"charIndex":570},{"text":"Plugin configuration options","id":"plugin-configuration-options","depth":2,"charIndex":741}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":41,"title":"Setup function","content":"#\n\nIn the \"Plugin object\" section we know that the plugin object contains a setup\nfunction that not only contains an api object parameter, but also returns a\nHooks object.\n\n\nPlugin API objects#\n\nThe setup function of the plugin will provide an api object parameter, and you\ncan call some of the methods provided on this object to get information about\nthe configuration, project context, etc.\n\n\n\n\napi.useAppContext#\n\nUsed to get project context information.\n\n\n\nINFO\n\nThrough the actual type file, we can see that there are some additional fields.\nHowever, for Modern.js Module, the fields mentioned above are the only ones that\nare meaningful. The same applies to other methods of the api object.\n\n\napi.useResolvedConfigContext#\n\nUsed to get the final configuration after parsing.\n\nINFO\n\nIf you need to get the build-related final configuration, you need to use the\nbeforeBuild Hook.\n\n\n\n\napi.useHookRunners#\n\nUsed to get the executors of Hooks and trigger the execution of a specific Hook.\n\n\n\n\nAsynchronous setup#\n\nThe setup of a CLI plugin can be an asynchronous function that performs\nasynchronous logic during the initialization process.\n\n\n\nNote that the setup function of the next plugin is not executed until the async\nsetup function of the current plugin has finished. Therefore, you should avoid\nperforming time-consuming asynchronous operations in the setup function to avoid\nslowing down the startup performance of the CLI.\n\n\nLife cycle hooks#\n\nWe know that the setup function returns a Hooks object, which can also be\nunderstood as an object with Modern.js Module lifecycle hooks.\n\nCurrently there are two main types of hooks.\n\n * build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * debug hooks: hooks that are triggered when running the dev command.\n\nSee the API documentation for a full list of lifecycle hooks.","routePath":"/module-tools/en/plugins/guide/setup-function","lang":"en","toc":[{"text":"Plugin API objects","id":"plugin-api-objects","depth":2,"charIndex":173},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"Asynchronous setup","id":"asynchronous-setup","depth":2,"charIndex":993},{"text":"Life cycle hooks","id":"life-cycle-hooks","depth":2,"charIndex":1434}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":42,"title":"Overview","content":"#\n\n\nOfficial Plugins#\n\n * @modern-js/plugin-module-import:Use SWC to provide the same ability as\n babel-plugin-import.\n * @modern-js/plugin-module-banner:Add custom content, such as copyright\n information, to the top and bottom of each JS and CSS file.\n * @modern-js/plugin-module-node-polyfill: Inject Polyfills of Node core modules\n in the browser side.\n * @modern-js/plugin-module-polyfill:Inject polyfill for unsupported features\n used in your code.\n * @modern-js/plugin-module-babel:Use Babel to transform your code.\n * @modern-js/plugin-module-vue:Support for Vue component.","routePath":"/module-tools/en/plugins/official-list/overview","lang":"en","toc":[{"text":"Official Plugins","id":"official-plugins","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":43,"title":"Babel Plugin","content":"#\n\nTIP\n\nNormally, we don't need to use Babel to transform our code, this plugin is only\nused as a downgrade.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nYou can also configure the registration via hooks, for example, if you need to\nbundle two files A and B at the same time and only need to use babel when bundle\nA:\n\n\n\n\nConfig#\n\nSee babel options.\n\nHere is an example with @babel/preset-env configured\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-babel","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":110},{"text":"Install","id":"install","depth":3,"charIndex":125},{"text":"Register","id":"register","depth":3,"charIndex":136},{"text":"Config","id":"config","depth":2,"charIndex":372}],"domain":"","frontmatter":{},"version":""},{"id":44,"title":"Banner Plugin","content":"#\n\nProvide the ability to inject content at the top and bottom of each JS and CSS\nfile.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nTIP\n\nNote: CSS comments do not support the //comment syntax. Refer to \"CSS Comments\"\n\n\nExample#\n\n\nAdd copyright information at the top of a JS file#\n\n\n\n\nConfiguration#\n\n * Type\n\n\n\n\nbanner#\n\nAdd content at the top.\n\n * banner.js: Add content at the top of a JS file.\n * banner.css: Add content at the top of a CSS file.\n\n\nfooter#\n\nAdd content at the bottom.\n\n * footer.js: Add content at the bottom of a JS file.\n * footer.css: Add content at the bottom of a CSS file.","routePath":"/module-tools/en/plugins/official-list/plugin-banner","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":89},{"text":"Install","id":"install","depth":3,"charIndex":104},{"text":"Register","id":"register","depth":3,"charIndex":115},{"text":"Example","id":"example","depth":2,"charIndex":271},{"text":"Add copyright information at the top of a JS file","id":"add-copyright-information-at-the-top-of-a-js-file","depth":3,"charIndex":282},{"text":"Configuration","id":"configuration","depth":2,"charIndex":337},{"text":"banner","id":"banner","depth":3,"charIndex":365},{"text":"footer","id":"footer","depth":3,"charIndex":505}],"domain":"","frontmatter":{},"version":""},{"id":45,"title":"Import Plugin","content":"#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\n\nTIP\n\nSince @modern-js/module-tools version >= 2.16.0, this plugin functionality is\nbuilt into Modern.js Module and is provided by transformImport.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nThis way we can use the ability of automatic import in Modern.js Module.\n\n\nConfigurations#\n\n * Type:\n\n\n\n\npluginImport#\n\n * Type: object[]\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\n\nNotes#\n\nSWC (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC\nand ported from babel-plugin-import. The configuration options remain\nconsistent.\n\nSome configurations can be passed in as functions, such as customName,\ncustomStyleName, etc., but in Modern.js Module, we do not recommend using\nfunctions in these configuration items. Because we will call SWC in the esbuild\nplugin, and then when Rust calls these configuration functions through Node-API,\na deadlock will occur.\n\nSimple function logic can actually be replaced by template language. Below is an\nexample of using a template with customName:\n\n\n\nAdd the following configuration on the right-hand side:\n\n\n\nThe {{ member }} in it will be replaced with the corresponding import member.\nAfter transformation:\n\n\n\nTemplate customName: 'foo/es/{{ member }}' is the same as customName: (member)\n=> `foo/es/${member}` , but template value has no performance overhead of\nNode-API.\n\nThe template used here is handlebars. There are some useful builtin tools, Take\nthe above import statement as an example:\n\n\n\nTransformed to:\n\n\n\nIn addition to kebabCase, there are cameraCase, snakeCase, upperCase and\nlowerCase can be used as well.","routePath":"/module-tools/en/plugins/official-list/plugin-import","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":230},{"text":"Install","id":"install","depth":3,"charIndex":245},{"text":"Register","id":"register","depth":3,"charIndex":256},{"text":"Configurations","id":"configurations","depth":2,"charIndex":413},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":443},{"text":"Notes","id":"notes","depth":2,"charIndex":602}],"domain":"","frontmatter":{},"version":""},{"id":46,"title":"Node Polyfill Plugin","content":"#\n\nAbout Node Polyfill\n\nNormally, we don't need to use Node libs on the browser side. However, it is\npossible to use some Node libs when the code will run on both the Node side and\nthe browser side, and Node Polyfill provides browser versions of polyfills for\nthese Node libs.\n\nBy using the Node Polyfill plugin, Node core libs polyfills are automatically\ninjected into the browser-side, allowing you to use these modules on the browser\nside with confidence.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nConfigurations#\n\n * Type:\n\n\n\n\nexclude#\n\nExclude the Node Polyfill to be injected.\n\n\n\n\noverrides#\n\nOverride the built-in Node Polyfill.\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\nWhen the above global variables are used directly in code, the corresponding\npolyfill will be injected.\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\nWhen the above module is referenced in code via import / require syntax, the\ncorresponding polyfill will be injected.\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\nCurrently there is no polyfill for the above modules on the browser side, so\nwhen you import the above modules, it will automatically fallback to an empty\nobject.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-node-polyfill","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":460},{"text":"Install","id":"install","depth":3,"charIndex":475},{"text":"Register","id":"register","depth":3,"charIndex":486},{"text":"Configurations","id":"configurations","depth":2,"charIndex":569},{"text":"exclude","id":"exclude","depth":3,"charIndex":599},{"text":"overrides","id":"overrides","depth":3,"charIndex":655},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":708},{"text":"Globals","id":"globals","depth":3,"charIndex":726},{"text":"Modules","id":"modules","depth":3,"charIndex":877},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":1336}],"domain":"","frontmatter":{},"version":""},{"id":47,"title":"Polyfill Plugin","content":"#\n\nTIP\n\nNormally, we don't need to inject polyfill for npm packages, this step should be\ndone on the web application framework side, but in some scenarios we need to\ninject polyfill in order to make our library run directly in low version\nbrowsers.\n\nNote that this plugin does not transform your code syntax, it only injects\npolyfill for unsupported functions used in your code, importing them as normal\nfunctions instead of polluting the global. You need to install the core-js-pure\ndependency.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nYou can also configure registration via hooks, for example, if you have multiple\nbuild configurations at the same time and only need to inject the polyfill when\nbundle:\n\n\n\n\nConfig#\n\n * Type\n\n\n\n\ntargets#\n\nSee Babel target.\n\nThis is a example.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-polyfill","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":497},{"text":"Install","id":"install","depth":3,"charIndex":512},{"text":"Register","id":"register","depth":3,"charIndex":523},{"text":"Config","id":"config","depth":2,"charIndex":778},{"text":"targets","id":"targets","depth":3,"charIndex":799}],"domain":"","frontmatter":{},"version":""},{"id":48,"title":"Vue Plugin","content":"#\n\nThe Vue plugin provides support for building Vue 3 components. The plugin\ninternally integrates esbuild-plugin-vue3 and @vue/babel-plugin-jsx。\n\nWARNING\n\nNotice that we have some limitation:\n\n 1. The current implementation of this plugin integrates directly with the\n community plugin and therefore does not support writing jsx/tsx in sfc.\n 2. If you want to generate d.ts for the components, please use the official\n recommendation vue-tsc.\n 3. Only support bundle, we recommend to set input to ['src/**/*.vue'] or\n ['src/index.ts'].\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nOptions#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\nOptions passed to @vue/babel-plugin-jsx, please refer to the\n@vue/babel-plugin-jsx documentation for detailed usage.","routePath":"/module-tools/en/plugins/official-list/plugin-vue","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":547},{"text":"Install","id":"install","depth":3,"charIndex":562},{"text":"Register","id":"register","depth":3,"charIndex":573},{"text":"Options","id":"options","depth":2,"charIndex":656},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":667}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file +[{"id":0,"title":"buildConfig","content":"#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. It contains all the configurations related to the build\nprocess.\n\n * Type: object | object[]\n\nTIP\n\nBefore start using buildConfig, please read the following documentation to\nunderstand its purpose:\n\n * Modifying Output Artifacts\n * In-Depth Understanding of the Build Process\n\n\nalias#\n\n * Type: Record | Function\n * Default: {'@': 'src',}\n\nTIP\n\nFor TypeScript projects, you only need to configure compilerOptions.paths in\ntsconfig.json, Modern.js Module will automatically recognize the alias in\ntsconfig.json, so there is no need to configure the alias field additionally.\n\n\n\nAfter the above configuration is done, if @common/Foo.tsx is referenced in the\ncode, it will map to the /src/common/Foo.tsx path.\n\nWhen the value of alias is defined as a function, you can accept the pre-defined\nalias object and modify it.\n\n\n\nIt is also possible to return a new object as the final result in the function,\nwhich will override the pre-defined alias object.\n\n\n\n\nasset#\n\nContains configuration related to static assets.\n\n\nasset.name#\n\nStatic resource output file name.\n\n * Type: string | ((assetPath) => name)\n * Default: [name].[hash].[ext]\n\nWhen asset.name is a string, it will automatically replace [name], [ext], and\n[hash], respectively replaced by the file name, extension, and file hash.\n\nAlso you can use asset.name as a function, and the return is output asset name.\nAt this time, this function receives a parameter assetPath, which corresponds to\nthe resource path.\n\n\n\n\nasset.limit#\n\nUsed to set the threshold for static assets to be automatically inlined as\nbase64.\n\nBy default, Modern.js Module will inline assets such as images, fonts and media\nsmaller than 10KB during bundling. They are Base64 encoded and inlined in the\nbundles, eliminating the need for separate HTTP requests.\n\nYou can adjust this threshold by modifying the limit config.\n\n * Type: number\n * Default: 10 * 1024\n\nFor example, set limit to 0 to avoid assets inlining:\n\n\n\n\nasset.path#\n\nStatic resource output path, will be based on outDir\n\n * Type: string\n * Default: assets\n\n\nasset.publicPath#\n\nThe CDN prefix given to unlinked assets when bundling.\n\n * Type: string\n * Default: undefined\n\n\n\nAt this point, all static assets will be prefixed with https://xxx/.\n\n\nasset.svgr#\n\nPackaged to handle svg as a React component, options reference svgr, plus\nsupport for two configuration options include and exclude to match the svg file\nto be handled\n\n * Type: boolean | object\n * Default: false\n\nWhen svgr feature is enabled, you can use svg as a component using the default\nexport.\n\n\n\nWhen enabled, the type of svg used can be modified by initing a new declaration\nfile and adding to the modern-app-env.d.ts:\n\n\n\n\n\n\nasset.svgr.include#\n\nSet the matching svg file\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: /\\.svg$/\n\n\nasset.svgr.exclude#\n\nSet unmatched svg files\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: undefined\n\n\nasset.svgr.exportType#\n\nUsed to configure the SVG export type when using SVGR.\n\n * Type: 'named' | 'default'\n * Default: default\n\nwhen it is 'named', use the following syntax:\n\n\n\nThe named export defaults to ReactComponent, and can be customized with the\nasset.svgr.namedExport.\n\n\nautoExtension#\n\nSuffixes for js files and type description files in automation based on format\nand type.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\nWhen disabled, js artifacts are suffixed with .js and type description files are\nsuffixed with d.ts.\n\nWhen enabled, node loads .js as esm by default when type is module, so when we\nwant to output cjs artifacts, the js product is suffixed with .cjs and the type\ndescription file is suffixed with d.cts.\n\nOn the other hand, if the type field is missing or the type is commonjs, node\nloads the .js file as cjs by default. So when we want to output esm output, the\njs output is suffixed with .mjs and the type description file is suffixed with\nd.mts.\n\n:::warning When used in bundleless mode, we have an extra step of processing the\nimport/export statement in each file. We will suffix the relative path to the js\nfile, possibly .mjs or .cjs, depending on your package configuration. You can\ndisable this step by redirect.autoExtension.\n\nNotice noUselessIndex will break this behavior, you should disable it. If you\nneed to use this configuration in bundleless, please patch the index, e.g. if\nutils is a folder, you need to rewrite to\n\n\n\n\nautoExternal#\n\nAutomatically externalize project dependencies and peerDependencies and not\npackage them into the final bundle\n\n * Type: boolean | object\n * Default: true\n\nWhen we want to turn off the default handling behavior for third-party\ndependencies, we can do so by:\n\n\n\nThis way the dependencies under \"dependencies\" and \"peerDependencies\" will be\nbundled. If you want to turn off the processing of only one of these\ndependencies, you can use the buildConfig.autoExternal in the form of an object.\n\n\n\n\nautoExternal.dependencies#\n\nWhether or not the dep dependencies of the external project are needed\n\n * Type: boolean\n * Default: true\n\n\nautoExternal.peerDependencies#\n\nWhether to require peerDep dependencies for external projects\n\n * Type: boolean\n * Default: true\n\n\nbanner#\n\nProvides the ability to inject content into the top and bottom of each JS , CSS\nand DTS file.\n\n\n\n * Type: BannerAndFooter\n * Default: {}\n * Version: >=2.36.0\n\nLet's say you want to add copyright information to JS and CSS files.\n\n\n\n\nbuildType#\n\nThe build type, bundle will package your code, bundleless will only do the code\nconversion\n\n * Type: 'bundle' | 'bundleless'\n * Default: 'bundle'\n\n\ncopy#\n\nCopies the specified file or directory into the build output directory\n\n * Type: object[]\n * Default: []\n\n\n\nReference for array settings: copy-webpack-plugin patterns\n\n\ncopy.patterns#\n\n * Type: CopyPattern[]\n * Default: []\n\n\n\n\ncopy.options#\n\n * Type:\n\n\n\n * Default: { concurrency: 100, enableCopySync: false }\n\n * concurrency: Specifies how many copy tasks to execute in parallel.\n\n * enableCopySync: Uses fs.copySync by default, instead of fs.copy.\n\n\ndefine#\n\nDefine global variables that will be injected into the code\n\n * Type: Record\n * Default: {}\n\nSince the define function is implemented by global text replacement, you need to\nensure that the global variable values are strings. A safer approach is to\nconvert the value of each global variable to a string, as follows.\n\nINFO\n\nModern.js automatically performs JSON serialization handling internally, so\nmanual serialization is not required.\n\nIf automatic serialization is not needed, you can define alias using\nesbuildOptions configuration.\n\n\n\nIf the project is a TypeScript project, then you may need to add the following\nto the .d.ts file in the project source directory.\n\n> If the .d.ts file does not exist, then you can create it manually.\n\n\n\nYou can also replace environment variable:\n\n\n\nWith the above configuration, we can put the following code.\n\n\n\nWhen executing VERSION=1.0.0 modern build, the conversion is:\n\n\n\nTIP\n\nTo prevent excessive global replacement substitution, it is recommended that the\nfollowing two principles be followed when using\n\n * Use upper case for global constants\n * Customize the prefix and suffix of global constants to ensure uniqueness\n\n\ndts#\n\nThe dts file generates the relevant configuration, by default it generates.\n\n * Type: false | object\n * Default:\n\n\n\n\ndts.abortOnError#\n\nWhether to allow the build to succeed if a type error occurs.\n\n * Type: boolean\n * Default: true\n\nBy default, type errors will cause the build to fail. When abortOnError is set\nto false, the build will still succeed even if there are type issues in the\ncode:\n\n\n\nWARNING\n\nWhen this configuration is disabled, there is no guarantee that the type files\nwill be generated correctly. In buildType: 'bundle', which is the bundle mode,\ntype files will not be generated.\n\n\ndts.distPath#\n\nThe output path of the dts file, based on outDir\n\n * Type: string\n * Default: ./\n\nFor example, output to the types directory under the outDir:\n\n\n\n\ndts.enableTscBuild#\n\nEnable the tsc '--build' option. When using project reference, you can use the\n'--build' option to achieve cooperation between projects and speed up the build\nspeed.\n\nThis option requires version > 2.43.0,In fact, we experimentally enabled this\noption in the 2.42.0 version, but the many problems it brought forced us to\nenable it dynamically.\n\n\n\n * Type: boolean\n * Default: false\n * Version: >2.43.0\n\n\n\n\ndts.only#\n\nWhether to generate only type files during the build process without generating\nJavaScript output files.\n\n * Type: boolean\n * Default: false\n\n\n\n\ndts.tsconfigPath#\n\ndeprecated,use tsconfig instead.\n\nSpecifies the path to the tsconfig file used to generate the type file.\n\n\n\n\ndts.respectExternal#\n\nWhen set to false, the type of third-party packages will be excluded from the\nbundle, when set to true, it will determine whether third-party types need to be\nbundled based on externals.\n\nWhen bundle d.ts, export is not analyzed, so any third-party package type you\nuse may break your build, which is obviously uncontrollable. So we can avoid it\nwith this configuration.\n\n * Type: boolean\n * Default: true\n\n\n\n\nesbuildOptions#\n\nUsed to modify the esbuild configuration.\n\n * Type: Function\n * Build Type: Only supported for buildType: 'bundle'\n * Default: c => c\n\nFor example, if we need to modify the file extension of the generated files:\n\n\n\nFor example, register an esbuild plugin:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\nTIP\n\nWe have done many extensions based on the original esbuild build. Therefore,\nwhen using this configuration, pay attention to the following:\n\n 1. Prefer to use the configuration that Modern.js Module provides. For example,\n esbuild does not support target: 'es5', but we support this scenario\n internally using SWC. Setting target: 'es5' through esbuildOptions will\n result in an error.\n 2. Currently, we use enhanced-resolve internally to replace esbuild's resolve\n algorithm, so modifying esbuild resolve-related configurations is invalid.\n We plan to switch back in the future.\n\n\nexternalHelpers#\n\nBy default, the output JS code may depend on helper functions to support the\ntarget environment or output format, and these helper functions will be inlined\nin the file that requires it.\n\nWith this configuration, the code will be converted using SWC, it will inline\nhelper functions to import them from the external module @swc/helpers.\n\n * Type: boolean\n * Default: false\n\nBelow is a comparison of the output file changes before and after using this\nconfiguration.\n\nBefore enable:\n\n\n\nAfter enabled:\n\n\n\n\nexternals#\n\nConfigure external dependencies that will not be bundled into the final bundle.\n\n * Type:\n\n\n\n * Default: []\n * Build Type: Only supported for buildType: 'bundle'\n * Example:\n\n\n\n\nfooter#\n\nSame as the banner configuration for adding a comment at the end of the output\nfile.\n\n\nformat#\n\nUsed to set the output format of JavaScript files. The options iife and umd only\ntake effect when buildType is bundle.\n\n * Type: 'esm' | 'cjs' | 'iife' | 'umd'\n * Default: cjs\n\n\nformat: esm#\n\nesm stands for \"ECMAScript module\" and requires the runtime environment to\nsupport import and export syntax.\n\n * Example:\n\n\n\n\nformat: cjs#\n\ncjs stands for \"CommonJS\" and requires the runtime environment to support\nexports, require, and module syntax. This format is commonly used in Node.js\nenvironments.\n\n * Example:\n\n\n\n\nformat: iife#\n\niife stands for \"immediately-invoked function expression\" and wraps the code in\na function expression to ensure that any variables in the code do not\naccidentally conflict with variables in the global scope. This format is\ncommonly used in browser environments.\n\n * Example:\n\n\n\n\nformat: umd#\n\numd stands for \"Universal Module Definition\" and is used to run modules in\ndifferent environments such as browsers and Node.js. Modules in UMD format can\nbe used in various environments, either as global variables or loaded as modules\nusing module loaders like RequireJS.\n\n * Example:\n\n\n\n\nhooks#\n\nBuild lifecycle hooks that allow custom logic to be injected at specific stages\nof the build process.\n\n * Types:\n\n\n\n * Default: [].\n\nWe can get the compiler instance in the apply method, modify its properties, and\nexecute custom logic at different stages. For more information on Hooks, see\n[Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in\nthe Build Process]). For more information on Hooks, see\nUsing-hooks-to-intervene-in-the-build-process.\n\n\n\n\ninput#\n\nSpecify the entry file for the build, in the form of an array that can specify\nthe directory\n\n * Type:\n\n\n\n * Default: ['src/index.ts'] in bundle mode, ['src'] in bundleless mode\n\nArray usage:\n\nIn bundle mode, the following configurations will be built using src/index.ts\nand src/index2.ts as entry points. The bundle mode does not support configuring\ninput as a directory.\n\n\n\nIn bundleless mode, the following configuration compiles both files in the src/a\ndirectory and src/index.ts file.\n\n\n\nIn bundleless mode, Array usage also supports the usage of ! to filter partial\nfiles:\n\n\n\nThe above configuration will build the files in the src directory, and will also\nfilter files with the spec.ts suffix.This is useful in cases where the test\nfiles are in the same root directory as the source files.\n\nObject usage:\n\nWhen you need to modify the output file name in bundle mode, you can use an\nobject configuration.\n\nThe key of the object is the file name of the output, and the value is the file\npath of the source code.\n\n\n\n\njsx#\n\nSpecify the compilation method for JSX, which by default supports React 17 and\nhigher versions and automatically injects JSX runtime code.\n\n * Type: automatic | transform\n * Default: automatic\n\nIf you need to support React 16, you can set jsx to transform:\n\n\n\nTIP\n\nIf you don't need to convert JSX, you can set jsx to preserve, but don't use swc\nto do the code conversion. For more information about JSX Transform, you can\nrefer to the following links:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX. :::\n\n\nmetafile#\n\nThis option is used for build analysis. When enabled, esbuild will generate\nmetadata about the build in JSON format.\n\n * Type: boolean\n * Default: false\n * Build Type: Only supported for buildType: 'bundle'\n\nTo enable metafile generation:\n\n\n\nAfter executing the build, a metafile-[xxx].json file will be generated in the\noutput directory. You can use tools like esbuild analyze and bundle-buddy for\nvisual analysis.\n\n\nminify#\n\nUse esbuild or terser to compress code, also pass terserOptions\n\n * Type: 'terser' | 'esbuild' | false | object\n * Default: false\n\n\n\n\noutDir#\n\nSpecifies the output directory of the build.\n\n * Type: string\n * Default: ./dist\n\n\n\n\nplatform#\n\nGenerates code for the node environment by default, you can also specify browser\nwhich will generate code for the browser environment. See esbuild.platform learn\nmore.\n\n * Type: 'browser' | 'node'\n * Default: 'node'\n\n\n\n\nredirect#\n\nIn buildType: 'bundleless' build mode, the reference path is redirected to\nensure that it points to the correct product, e.g:\n\n * import '. /index.less' will be rewritten to import '. /index.css'\n * would be rewritten as to `` (depending on the situation)\n * will be rewritten to (if generate utils.mjs, depending on the situation)\n\nIn some scenarios, you may not need these functions, then you can turn it off\nwith this configuration, and its reference path will not be changed after\nturning it off.\n\n\n\n\nresolve#\n\nCustom module resolution options\n\n\nresolve.mainFields#\n\nA list of fields in package.json to try when parsing the package entry point.\n\n * Type: string[]\n * Default: depends on platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * Version: >=2.36.0\n\nFor example, we want to load the js:source field first:\n\n\n\n:::warning resolve.mainFields has a lower priority than the exports field in\npackage.json, and if an entry point is successfully resolved from exports,\nresolve.mainFields will be ignored.\n\n\nresolve.jsExtentions#\n\nSupport for implicit file extensions\n\n * Type: string[]\n * Default: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * Version: >=2.36.0\n\nDo not use implicit file extensions for css files, currently Module only\nsupports ['.less', '.css', '.sass', '.scss'] suffixes.\n\nNode's parsing algorithm does not consider .mjs and cjs as implicit file\nextensions, so they are not included here by default, but can be included by\nchanging this configuration:\n\n\n\n\nshims#\n\nWhen building CommonJS/ESM artifacts, inject some polyfill code such as\n__dirname which can only be used in CommonJS. After enable this option, it will\ncompile __dirname as path.dirname(fileURLToPath(import.meta.url)) when format is\nesm.\n\nSee details here, Note that esm shims will only be injected if platform is node,\nbecause the url module is used.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\n\n\n\nsideEffects#\n\nModule sideEffects\n\n * Type: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * Default: undefined\n\nNormally, we configure the module's side effects via the sideEffects field in\npackage.json, but in some cases, The package.json of a third-party package is\nunreliable.Such as when we reference a third-party package style file\n\n\n\nBut the package.json of this third-party package does not have the style file\nconfigured in the sideEffects\n\n\n\nAt the same time you set style.inject to true and you will see a warning message\nlike this in the console\n\n\n\nAt this point, you can use this configuration option to manually configure the\nmodule's \"sideEffects\" to support regular and functional forms.\n\n\n\nTIP\n\nAfter adding this configuration, the sideEffects field in package.json will no\nlonger be read when packaging\n\n\nsourceDir#\n\nSpecify the source directory of the build, default is src, which is used to\ngenerate the corresponding output directory based on the source directory\nstructure when building bundleless. Same as esbuild.outbase.\n\n * Type: string\n * Default: src\n\n\nsourceMap#\n\nWhether to generate sourceMap or not\n\n * Type: boolean | 'inline' | 'external'\n * Default: false\n\n\nsourceType#\n\nSets the format of the source code. By default, the source code will be treated\nas EsModule. When the source code is using CommonJS, you need to set commonjs.\n\n * Type: 'commonjs' | 'module'\n * Default: 'module'\n\n\nsplitting#\n\nWhether to enable code splitting. Only support format: 'esm' and format:\n'cjs',see esbuild.splitting learn more.\n\n * Type: boolean\n * Default: false\n\n\nstyle#\n\nConfigure style-related configuration\n\n\nstyle.less#\n\nless-related configuration\n\n\nstyle.less.lessOptions#\n\nRefer to less for detailed configuration\n\n * Type: object\n * Default: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\nAdd Less code to the beginning of the entry file.\n\n * Type: string\n * Default: undefined\n\n\n\n\nstyle.less.implementation#\n\nConfigure the implementation library used by Less, if not specified, the\nbuilt-in version used is 4.1.3.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Less when the object type is specified.\n\n\n\nFor the string type, specify the path to the implementation library for Less\n\n\n\n\nstyle.sass#\n\nsass-related configuration.\n\n\nstyle.sass.sassOptions#\n\nRefer to node-sass for detailed configuration.\n\n * Type: object\n * Default: {}\n\n\nstyle.sass.additionalData#\n\nAdd Sass code to the beginning of the entry file.\n\n * Type: string | Function\n * Default: undefined\n\n\n\n\nstyle.sass.implementation#\n\nConfigure the implementation library used by Sass, the built-in version used is\n1.5.4 if not specified.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Sass when the object type is specified.\n\n\n\nFor the string type, specify the path to the Sass implementation library\n\n\n\n\nstyle.postcss#\n\nUsed to configure options for PostCSS. The provided values will be merged with\nthe default configuration using Object.assign. Note that Object.assign performs\na shallow copy, so it will completely override the built-in plugins array.\n\nFor detailed configuration, please refer to PostCSS.\n\n * Type:\n\n\n\n * Default:\n\n\n\n * Example:\n\n\n\n\nstyle.inject#\n\nConfigure whether to insert CSS styles into JavaScript code in bundle mode.\n\n * Type: boolean\n * Default: false\n\nSet inject to true to enable this feature:\n\n\n\nOnce enabled, you will see the CSS code referenced in the source code included\nin the bundled JavaScript output.\n\nFor example, if you write import './index.scss' in the source code, you will see\nthe following code in the output:\n\n\n\nTIP\n\nAfter enabling inject, you need to pay attention to the following points:\n\n * @import in CSS files will not be processed. If your CSS file contains\n @import, you need to manually import the CSS file in the JS file (less and\n scss files are not required because they have preprocessing).\n * Consider the impact of sideEffects. By default, our builder assumes that CSS\n has side effects. If the sideEffects field is set in your project or\n third-party package's package.json and does not include this CSS file, you\n will receive a warning:\n\n\n\nYou can resolve this by configuring sideEffects.\n\n\nstyle.autoModules#\n\nEnable CSS Modules automatically based on the filename.\n\n * Type: boolean | RegExp\n * Default: true\n\ntrue : Enables CSS Modules for style files ending with .module.css .module.less\n.module.scss .module.sass filenames\n\nfalse : Disable CSS Modules.\n\nRegExp : Enables CSS Modules for all files that match the regular condition.\n\n\nstyle.modules#\n\nCSS Modules configuration\n\n * Type: object\n * Default: {}\n\nA common configuration is localsConvention, which changes the class name\ngeneration rules for css modules\n\n\n\nFor the following styles\n\n\n\nYou can use styles.boxTitle to access\n\nFor detailed configuration see postcss-modules\n\n\nstyle.tailwindcss#\n\nUsed to modify the configuration of Tailwind CSS.\n\n * Type: object | Function\n * Default:\n\n\n\n\nEnabling Tailwind CSS#\n\nBefore using style.tailwindcss, you need to enable the Tailwind CSS plugin for\nModern.js Module.\n\nPlease refer to the section Using Tailwind CSS for instructions on how to enable\nit.\n\n\nType#\n\nWhen the value is of type object, it is merged with the default configuration\nvia Object.assign.\n\nWhen the value is of type Function, the object returned by the function is\nmerged with the default configuration via Object.assign.\n\nThe rest of the usage is the same as Tailwind CSS: Quick Portal.\n\n\nNotes#\n\nPlease note that:\n\n * If you are using both the tailwind.config.{ts,js} file and tools.tailwindcss\n option, the configuration defined in tools.tailwindcss will take precedence\n and override the content defined in tailwind.config.{ts,js}.\n * If you are using the designSystem configuration option simultaneously, the\n theme configuration of Tailwind CSS will be overridden by the value of\n designSystem.\n\nThe usage of other configurations follows the same approach as the official\nusage of Tailwind CSS. Please refer to tailwindcss - Configuration for more\ndetails.\n\n\ntarget#\n\ntarget is used to set the target environment for the generated JavaScript code.\nIt enables Modern.js Module to transform JavaScript syntax that is not\nrecognized by the target environment into older versions of JavaScript syntax\nthat are compatible with these environments.\n\n * Type:\n\n\n\n * Default: 'es6'\n\nFor example, compile the code to es5 syntax:\n\n\n\n\ntransformImport#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\nWith this configuration, the code will be converted using SWC.\n\n * Type: object[]\n * Default: []\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\nReference the Import Plugin - Notes\n\n\ntransformLodash#\n\nSpecifies whether to modularize the import of lodash and remove unused lodash\nmodules to reduce the code size of lodash.\n\nThis optimization is implemented using babel-plugin-lodash and swc-plugin-lodash\nunder the hood.\n\nWith this configuration, the code will be converted using SWC.\n\n * Type: boolean\n * Default: false\n\nWhen you enable this, Modern.js Module will automatically redirects the code\nreferences of lodash to sub-paths.\n\nFor example:\n\n\n\nThe transformed code will be:\n\n\n\n\ntsconfig#\n\nPath to the tsconfig file\n\n * Type: string\n * Default: tsconfig.json\n * Version: >=2.36.0\n\n\n\n\numdGlobals#\n\nSpecify global variables for external import of umd artifacts\n\n * Type: Record\n * Default: {}\n\n\n\nAt this point, react and react-dom will be seen as global variables imported\nexternally and will not be packed into the umd product, but will be accessible\nby way of global.React and global.ReactDOM\n\n\numdModuleName#\n\nSpecifies the module name of the umd product\n\n * Type: string | Function\n * Default: name => name\n\n\n\nAt this point the umd artifact will go to mount on global.myLib\n\n:::tip\n\n * The module name of the umd artifact must not conflict with the global\n variable name.\n * Module names will be converted to camelCase, e.g. my-lib will be converted to\n myLib, refer to toIdentifier. :::\n\nAlso the function form can take one parameter, which is the output path of the\ncurrent package file\n\n","routePath":"/module-tools/en/api/config/build-config","lang":"en","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":378},{"text":"asset","id":"asset","depth":2,"charIndex":1054},{"text":"asset.name","id":"assetname","depth":2,"charIndex":1113},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":1571},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":2045},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":2149},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":2336},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":2783},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":2901},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":3018},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":3299},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":4498},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":5006},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":5142},{"text":"banner","id":"banner","depth":2,"charIndex":5273},{"text":"buildType","id":"buildtype","depth":2,"charIndex":5514},{"text":"copy","id":"copy","depth":2,"charIndex":5674},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":5850},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":5908},{"text":"define","id":"define","depth":2,"charIndex":6133},{"text":"dts","id":"dts","depth":2,"charIndex":7312},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":7435},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":7919},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":8081},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":8508},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":8664},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":8793},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":9225},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":10401},{"text":"externals","id":"externals","depth":2,"charIndex":10923},{"text":"footer","id":"footer","depth":2,"charIndex":11113},{"text":"format","id":"format","depth":2,"charIndex":11209},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":11396},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":11536},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":11732},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":12026},{"text":"hooks","id":"hooks","depth":2,"charIndex":12329},{"text":"input","id":"input","depth":2,"charIndex":12816},{"text":"jsx","id":"jsx","depth":2,"charIndex":13845},{"text":"metafile","id":"metafile","depth":2,"charIndex":14380},{"text":"minify","id":"minify","depth":2,"charIndex":14809},{"text":"outDir","id":"outdir","depth":2,"charIndex":14952},{"text":"platform","id":"platform","depth":2,"charIndex":15046},{"text":"redirect","id":"redirect","depth":2,"charIndex":15277},{"text":"resolve","id":"resolve","depth":2,"charIndex":15793},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":15838},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":16333},{"text":"shims","id":"shims","depth":2,"charIndex":16798},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":17219},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":18068},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":18326},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":18437},{"text":"splitting","id":"splitting","depth":2,"charIndex":18664},{"text":"style","id":"style","depth":2,"charIndex":18827},{"text":"style.less","id":"styleless","depth":2,"charIndex":18875},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":18917},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":19042},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":19163},{"text":"style.sass","id":"stylesass","depth":2,"charIndex":19508},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":19551},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":19657},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":19789},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":20129},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":20477},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":21490},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":21837},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":22137},{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":3,"charIndex":22251},{"text":"Type","id":"type","depth":3,"charIndex":22460},{"text":"Notes","id":"notes","depth":3,"charIndex":22765},{"text":"target","id":"target","depth":2,"charIndex":23348},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":23712},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":24068},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":24569},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":24674},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":24985}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":1,"title":"buildPreset","content":"#\n\nA build preset string or preset function. Provides out-of-the-box build\nconfiguration\n\n * Type: string | Function\n\n\nnpm-library#\n\nLibrary generic schema used under class NPM package manager, contains esm and\ncjs bundle artifacts, and includes a type file.\n\nINFO\n\nAbout the class NPM Package Manager\n\n * npm\n * yarn\n * pnpm\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-library-with-umd#\n\nUsed under class NPM package manager, and Library supports a similar pattern to\nunpkg. Additional umd artifacts are provided on top of the pre-defined\nnpm-library.\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-component#\n\nA generic pattern for components (libraries) used under the class NPM package\nmanager. Contains both esm and cjs Bundleless artifacts (for easy Tree shaking\noptimization), as well as including a copy of the type file.\n\nFor style files included in the source code, the artifacts provide the compiled\nfiles of the style and the source file of the style.\n\n\n\nThe pre-defined strings correspond to the build configuration.\n\n\n\n\nnpm-component-with-umd#\n\nComponent (library) used under class NPM package manager, with support for class\nunpkg schema. Additional umd artifacts are provided on top of the pre-defined\nnpm-component.\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\nWhen you want to use a buildPreset preset that supports other ECMAScript\nversions, you can directly add the supported versions to the 'npm-library',\n'npm-library-with-umd', 'npm-component', 'npm-component-with-umd' presets.\n\nFor example, if you want the 'npm-library' preset to support 'es2017', you can\nconfigure it as follows.\n\n\n\n\nstring / function#\n\nThe buildPreset not only supports basic string forms, but also function forms,\nwhich can obtain the default values we provide through the preset or extend\nPreset parameter and then modify them.\n\nHere are two examples using preset and extend Preset:\n\n\n\nIn the extend Preset, lodash.merge is used for configuration merge.\n\n","routePath":"/module-tools/en/api/config/build-preset","lang":"en","toc":[{"text":"`npm-library`","id":"npm-library","depth":3,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":3,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":3,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":3,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":3,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":1651}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":2,"title":"dev","content":"#\n\nThis section describes all configuration of Modern.js Module related to\ndebugging tools.\n\n\nstorybook#\n\nWARNING\n\nDeprecated: This configuration is deprecated and only applicable to Storybook\nV6. Please see 使用Storybook to get more info.\n\n\nstorybook.webpack#\n\n * Type: object | Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpack. The usage can be found in the tools.webpack configuration\nof Modern.js Builder.\n\n\n\nConfigure Manager App#\n\nFor the webpack configuration of the Storybook Manager app section, you can\nconfigure it by adding the ./config/storybook/main.js file to configure it.\n\n\n\n\nstorybook.webpackChain#\n\n * Type: Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpackChain. You can refer to Modern.js Builder's\ntools.webpackChain configuration for how to use it.","routePath":"/module-tools/en/api/config/dev","lang":"en","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":93},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":239},{"text":"Configure Manager App","id":"configure-manager-app","depth":4,"charIndex":506},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":686}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":3,"title":"plugins","content":"#\n\nThis chapter describes the configuration of the registered Modern.js Module\nplugin.\n\n * Type: ModuleToolsPlugin[]\n * Default: undefined\n\n\nPlugin Execution Order#\n\nBy default, custom plugins are executed in the order specified in the plugins\narray. The execution of built-in plugins provided by Modern.js Module happens\nbefore the execution of custom plugins.\n\nWhen plugins use fields that control the execution order, such as pre and post,\nthe execution order is adjusted based on the declared fields. For more\ninformation, please refer to the Relationship Between Plugins guide.\n\n\nDeveloping Plugins#\n\nTo learn how to write plugins, please refer to the Plugin Writing Guide.\n\n\nExample#\n\n\nUsing Plugins from npm#\n\nTo use plugins from npm, you need to install them using a package manager and\nimport them in your configuration file.\n\n\n\nUsing Local Plugins#\n\nTo use plugins from a local code repository, you can directly import them using\na relative path.\n\n\n\n\nPlugin Configuration#\n\nIf a plugin provides custom configuration options, you can pass the\nconfiguration through the plugin function's parameters.\n\n","routePath":"/module-tools/en/api/config/plugins","lang":"en","toc":[{"text":"Plugin Execution Order","id":"plugin-execution-order","depth":2,"charIndex":140},{"text":"Developing Plugins","id":"developing-plugins","depth":2,"charIndex":584},{"text":"Example","id":"example","depth":2,"charIndex":680},{"text":"Using Plugins from npm","id":"using-plugins-from-npm","depth":3,"charIndex":691},{"text":"Using Local Plugins","id":"using-local-plugins","depth":4,"charIndex":837},{"text":"Plugin Configuration","id":"plugin-configuration","depth":3,"charIndex":960}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":4,"title":"testing","content":"#\n\nThis chapter describes the test-related configuration\n\nTIP\n\nYou need to enable the unit testing feature with pnpm run new first.\n\n\njest#\n\n * Type: object | Function\n * Default: {}\n\nThe configuration corresponding to Jest, when of type object, can be configured\nwith all the underlying configurations supported by Jest .\n\n\n\nWhen the value is of type Function, the default configuration is passed as the\nfirst parameter and a new Jest configuration object needs to be returned.\n\n\n\n\ntransformer#\n\n * Type: 'babel-jest' | 'ts-jest'\n * Default: 'babel-jest'\n\nConfigure the compilation tool for the source code when executing tests:\nbabel-jest or ts-jest. The default is babel-jest.\n\nINFO\n\nbabel-jest can also compile TS files without type errors, so use ts-jest if you\nneed to check the TS type when running tests.","routePath":"/module-tools/en/api/config/testing","lang":"en","toc":[{"text":"jest","id":"jest","depth":2,"charIndex":133},{"text":"transformer","id":"transformer","depth":2,"charIndex":482}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":5,"title":"Overview","content":"#","routePath":"/module-tools/en/api/","lang":"en","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"Overview","sidebar_position":1},"version":""},{"id":6,"title":"Plugin Hooks","content":"#\n\nThis chapter describes the lifecycle hooks supported by module-tools.\n\nCurrently there are following main types of lifecycle hooks.\n\n * Config hooks: change user config.\n * Build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * dev hooks: hooks that are triggered when running the dev command.\n\nHook Model is explained in detail here.\n\n\nConfig hooks#\n\n\nresolveModuleUserConfig#\n\nchang user config.\n\ntype: AsyncWaterfall\n\n\n\n\nbuild hooks#\n\nThe following Hooks are triggered in order when the build command is executed.\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\nTriggered before the execution of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters value types.\n\n\n\n> BuildConfig type reference API configuration\n\n\nbeforeBuildTask#\n\nBased on the build configuration, Modern.js Module will split the overall build\ninto multiple sub-build tasks. The Hook will be triggered before each build\nsubtask.\n\ntype: AsyncWaterfall\n\n\n\nParameters and return value types.\n\nBaseBuildConfig type reference API configuration\n\n\nafterBuildTask#\n\nTriggered after the end of each build subtask.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nafterBuild#\n\nTriggered after the end of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nbuildPlatform hooks#\n\nmodule-tools also provides the build --platform command to perform specific\nbuild tasks.\n\nFor example, after installing the Module Doc plugin, you can run build\n--platform or build --platform doc to perform Doc build tasks.\n\nHooks are triggered in the following order after executing build --platform.\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\nGets information about the tasks that need to be run when executing the build\n--platform command.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeBuildPlatform#\n\nTriggers all registered build tasks when the build --platform command is\nexecuted. beforeBuildPlatform will be triggered before the execution of the\noverall build task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. buildPlatform will be triggered before each build task is\nexecuted.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterBuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. afterBuildPlatform will be triggered after the overall platform\nbuild task is finished.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nDev Hooks#\n\nThe following Hooks are triggered in order when the dev command is executed.\n\n * registerDev: triggered when getting dev function information.\n * beforeDev: Triggered before starting the dev process as a whole.\n * beforeDevMenu: triggered before the dev list/menu appears.\n * afterDevMenu: triggered after dev list/menu option is selected.\n * beforeDevTask: Triggered before executing the dev task.\n * afterDev: Triggered at the end of the overall dev process.\n\n\nregisterDev#\n\nRegister dev tool related data. Mainly contains.\n\n * the name of the dev tool\n * The name of the item displayed in the menu list and the corresponding value.\n * The definition of the dev subcommand.\n * Whether to execute the source code build before running the dev task\n * The function to execute the dev task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDev#\n\nTriggered before the dev task is executed after all dev tool metadata has been\ncollected.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu is triggered before the dev list/menu appears. Receives inquirer\nquestion as argument. Default value is.\n\n\n\nafterDevMenu Triggered after selecting dev list/menu options.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDevTask#\n\nTriggered before the dev task is executed.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterDev#\n\nTriggered when the dev task process is interrupted.\n\n","routePath":"/module-tools/en/api/plugin-api/plugin-hooks","lang":"en","toc":[{"text":"Config hooks","id":"config-hooks","depth":2,"charIndex":509},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"build hooks","id":"build-hooks","depth":2,"charIndex":596},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform hooks","id":"buildplatform-hooks","depth":2,"charIndex":1494},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"Dev Hooks","id":"dev-hooks","depth":2,"charIndex":2796},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":7,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-exception","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":8,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-other","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":9,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-product","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":10,"title":"","content":"","routePath":"/module-tools/en/components/faq-storybook","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":11,"title":"","content":"","routePath":"/module-tools/en/components/faq-test","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":12,"title":"","content":"","routePath":"/module-tools/en/components/publish-emo","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":13,"title":"","content":"When adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.","routePath":"/module-tools/en/components/register-esbuild-plugin","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":14,"title":"","content":"","routePath":"/module-tools/en/components/release-module-doc","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":15,"title":"Handle static assets","content":"#\n\nModern.js Module will handle static assets used in the code. If configuration is\nrequired, then the buildConfig.asset API can be used.\n\n\nDefault behavior#\n\nBy default, Modern.js Module handles the following static assets:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\nFor the handling of static files, Modern.js Module currently supports the\nfollowing functions.\n\n * Set the static asset path to . /assets.\n * Files less than 10kb will be inlined into the code.\n\n\nExample#\n\nLet us look at the following example:\n\n * Project source code:\n\n\n\n * If the size of bg.png is less than 10 kb, then the output directory structure\n and file content are.\n\n\n\n\n\n * If the size of bg.png is larger than 10 kb, then the output directory\n structure and file content are.\n\n\n\n\n\nWhen wanting to modify the default behavior, the following API can be used:\n\n * asset.path: modify the output path of the static assets.\n * asset.limit: modify the threshold value for inline assets.","routePath":"/module-tools/en/guide/advance/asset","lang":"en","toc":[{"text":"Default behavior","id":"default-behavior","depth":2,"charIndex":139},{"text":"Example","id":"example","depth":2,"charIndex":571}],"domain":"","frontmatter":{"sidebar_position":6},"version":""},{"id":16,"title":"Build umd artifacts","content":"#\n\nThe full name of umd is Universal Module Definition, and JS files in this format\ncan run in multiple runtime environments: the\n\n * Browser environment: module loading based on AMD specification\n * Node.js environment: module loading based on CommonJS\n * Other cases: mount the module on a global object.\n\nWe can therefore specify the build artifacts of the project as an umd artifact\nin the following way:\n\n\n\n\nThird-party dependency handling for umd artifacts#\n\nIn the \"How to handle third-party dependencies\" chapter, we know that we can\ncontrol whether or not the project packages third-party dependencies via the\nautoExternals and externals APIs. So when building umd artifacts, we can also\nuse it like this:\n\n\nExample#\n\n * If the project depends on react:\n\n\n\n * modern.config.ts:\n\n\n\n * When a react dependency is used in the source code:\n\n\n\n * The react code is not bundled into the artifact at this point:\n\n\n\nWe know from the above example that when using the autoExternal and externals\nAPIs.\n\n * In a Node.js environment, you can get the react dependency with\n require('react').\n * In a browser environment, you can get the react dependency via global.react.\n\n\nGlobal variable names of third-party dependencies#\n\nHowever, in the browser environment, when getting third-party dependencies,\nglobal variable names are not necessarily identical to the dependency names, so\nyou have to use the buildConfig.umdGlobals API.\n\nAgain using the previous example, when the react dependency exists in the\nbrowser environment as a windows.React or global.React global variable, then:\n\n * modern.config.ts config file:\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nAt this point we will see the output code like this:\n\n\n\nThe project can then run in the browser and use the React variables that exist\non the global object.\n\n\nChanging the name of a global variable in a project#\n\nWhen we package the following code into an umd artifact and run it in the\nbrowser, we can use the module via window.index.\n\n\n\n** By default, the name of the source file is used as the name of the module's\nglobal variable in the browser. **For the above example, the artifact would read\nas follows:\n\n\n\nIf you need to modify it, you need to use the buildConfig.umdModuleName API.\n\nWhen this API is used:\n\n\n\nThe build artifact at this point are:\n\n","routePath":"/module-tools/en/guide/advance/build-umd","lang":"en","toc":[{"text":"Third-party dependency handling for umd artifacts","id":"third-party-dependency-handling-for-umd-artifacts","depth":2,"charIndex":412},{"text":"Example","id":"example","depth":3,"charIndex":716},{"text":"Global variable names of third-party dependencies","id":"global-variable-names-of-third-party-dependencies","depth":3,"charIndex":1171},{"text":"Changing the name of a global variable in a project","id":"changing-the-name-of-a-global-variable-in-a-project","depth":2,"charIndex":1831}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":17,"title":"Use the Copy Tools","content":"#\n\nModern.js Module provides the Copy utility for copying already existing\nindividual files or entire directories into the output directory. Next we learn\nhow to use it.\n\n\nUnderstanding the Copy API#\n\nWe can use the Copy tool via the buildConfig.copy API, which contains the\nfollowing two main configurations.\n\n * patterns\n * options\n\n\nAPI Description#\n\ncopy.patterns is used to find files to be copied and configure the output path.\n\nThe patterns.from parameter is used to specify the file or directory to be\ncopied. It accepts either a Glob pattern string or a specific path. A Glob\npattern string refers to the fast-glob pattern syntax. Therefore, we can use it\nin two ways as follows:\n\n\n\nThe patterns.context parameter is generally used in conjunction with\npatterns.from. By default, its value is the same as buildConfig.sourceDir.\nTherefore, we can specify the file src/data.json to be copied in the following\nway:\n\n> By default, buildConfig.sourceDir is set to src.\n\n\n\nWhen the specified file is not in the source code directory, you can modify the\ncontext configuration. For example, to specify the file temp/index.html in the\nproject directory to be copied:\n\n\n\nThe patterns.to parameter is used to specify the output path for the copied\nfiles. By default, its value corresponds to buildConfig.outDir. Therefore, we\ncan copy src/index.html to the dist directory as follows:\n\n\n\nWhen we configure patterns.to:\n\n * If it is a relative path, the path will be calculated relative to\n buildConfig.outDir to determine the absolute path for copying the files.\n * If it is an absolute path, the value will be used directly.\n\nFinally, patterns.globOptions is used to configure the globby object for finding\nfiles to copy. Its configuration can be referenced from:\n\n * globby.options\n\n\nExamples of Different Scenarios#\n\n\nCopying Files#\n\n\n\n\nCopying Files to a Directory#\n\n\n\n\nCopying from Directory to Directory#\n\n\n\n\nCopying from Directory to File#\n\n\n\n\nUsing Glob#\n\n","routePath":"/module-tools/en/guide/advance/copy","lang":"en","toc":[{"text":"Understanding the Copy API","id":"understanding-the-copy-api","depth":2,"charIndex":171},{"text":"API Description","id":"api-description","depth":2,"charIndex":335},{"text":"Examples of Different Scenarios","id":"examples-of-different-scenarios","depth":2,"charIndex":1783},{"text":"Copying Files","id":"copying-files","depth":3,"charIndex":1818},{"text":"Copying Files to a Directory","id":"copying-files-to-a-directory","depth":3,"charIndex":1837},{"text":"Copying from Directory to Directory","id":"copying-from-directory-to-directory","depth":3,"charIndex":1871},{"text":"Copying from Directory to File","id":"copying-from-directory-to-file","depth":3,"charIndex":1912},{"text":"Using Glob","id":"using-glob","depth":3,"charIndex":1948}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":18,"title":"Handle third-party dependencies","content":"#\n\nGenerally, third-party dependencies required by a project can be installed via\nthe install command in the package manager. After the third-party dependencies\nare successfully installed, they will generally appear under dependencies and\ndevDependencies in the project package.json.\n\n\n\nDependencies under \"dependencies\" are generally related to project code and\nbuilds, and if these third-party dependencies are declared under\n\"devDependencies\", then there will be missing dependencies in production\nenvironments.\n\nIn addition to \"dependencies\", \"peerDependencies\" can also declare dependencies\nthat are needed in the production environment, but it puts more emphasis on the\nexistence of these dependencies declared by \"peerDependencies\" in the project's\nruntime environment, similar to the plugin mechanism.\n\n\nDefault handling of third-party dependencies#\n\nBy default, third-party dependencies under \"dependencies\" and \"peerDependencies\"\nare not bundled by Modern.js Module.\n\nThis is because when the npm package is installed, its \"dependencies\" will also\nbe installed. By not packaging \"dependencies\", you can reduce the size of the\npackage product.\n\nIf you need to package some dependencies, it is recommended to move them from\n\"dependencies\" to \"devDependencies\", which is equivalent to prebundle the\ndependencies and reduces the size of the dependency installation.\n\n\nExample#\n\nIf the project has a dependency on react.\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nThe react code is not bundled into the artifact:\n\n\n\nIf you want to modify the default processing, you can use the following API.\n\n * buildConfig.autoExternal\n\n\nExclude specified third-party dependencies#\n\nWe mentioned above the use of the buildConfig.autoExternal API, and\nbuildConfig.externals can control which third-party dependencies to handle the\nproject's dependencies in a more granular way.\n\nFor example, when we need to leave only certain dependencies unpacked, we can\nconfigure it as follows.\n\n> In this case, it is likely that some dependencies are not suitable for\n> packaging. If this is the case, then you can handle it as follows.\n\n","routePath":"/module-tools/en/guide/advance/external-dependency","lang":"en","toc":[{"text":"Default handling of third-party dependencies","id":"default-handling-of-third-party-dependencies","depth":2,"charIndex":811},{"text":"Example","id":"example","depth":3,"charIndex":1373},{"text":"Exclude specified third-party dependencies","id":"exclude-specified-third-party-dependencies","depth":2,"charIndex":1643}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":19,"title":"In-depth understanding of build","content":"#\n\nIn the \"Basic Usage\" section, we already knew that you can modify the output\nfiles of a project through the buildConfig configuration. buildConfig not only\ndescribes some of the features of the product, but also provides some\nfunctionality for building the product.\n\nTIP\n\nIf you are not familiar with buildConfig, please read modify-output-product.\n\nIn this chapter we'll dive into the use of certain build configurations and\nunderstand what happens when the modern build command is executed.\n\n\nbundle / bundleless#\n\nSo first let's understand bundle and bundleless.\n\nA bundle is a package of build artifacts, which may be a single file or multiple\nfiles based on a certain code splitting strategy.\n\nbundleless, on the other hand, means that each source file is compiled and built\nseparately, but not bundled together. Each output file can be found with its\ncorresponding source code file. The process of bundleless build can also be\nunderstood as the process of code conversion of source files only.\n\nThey have their own benefits.\n\n * bundle can reduce the size of build artifacts and also pre-package\n dependencies to reduce the size of installed dependencies. Packaging\n libraries in advance can speed up application project builds.\n * bundleless maintains the original file structure and is more conducive to\n debugging and tree shaking.\n\nWARNING\n\nbundleless is a single-file compilation mode, so for referencing and exporting\ntypes, you need to add the type keyword. For example, ``. Please refer to the\nesbuild documentation for more information.\n\nIn buildConfig you can specify whether the current build task is bundle or\nbundleless by using buildConfig.buildType.\n\n\ninput / sourceDir#\n\nbuildConfig.input is used to specify the path to a file or directory from which\nto read the source code, the default value of which varies between bundle and\nbundleless builds:\n\n * When buildType: 'bundle', input defaults to src/index.(j|t)sx?.\n * When buildType: 'bundleless', input defaults to ['src'].\n\nFrom the default value, we know that building in bundle mode usually specifies\none or more files as the entry point for the build, while building in bundleless\nmode specifies a directory and uses all the files in that directory as the entry\npoint.\n\nsourceDir is used to specify the source directory, which is only related to the\nfollowing two elements:\n\n * Type file generation\n * outbase for specifying the build process\n\nSo we can get its best practices:\n\n * Only specify input during the bundle build.\n * In general, bundleless only needs to specify sourceDir (where input will be\n aligned with sourceDir). If we want to use the input in bundleless, we only\n need to specify sourceDir.\n\nIf you want to convert only some of the files in bundleless, e.g. only the files\nin the src/runtime directory, you need to configure input:\n\n\n\n\nuse swc#\n\nIn some scenarios, esbuild is not enough to meet our needs, and we will use swc\nto do the code conversion.\n\nStarting from version 2.36.0, the Modern.js Module will use swc by default when\nit comes to the following functionality, but that doesn't mean we don't use\nesbuild any more, the rest of the functionality will still use esbuild.\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\nIn fact, we've been using swc for full code conversion since version 2.16.0.\nHowever, swc also has some limitations, so we added sourceType to turn off swc\nwhen the source is formatted as 'commonjs', which isn't really user-intuitive,\nand the cjs mode of the swc formatted outputs don't have annotate each export\nname, which can cause problems in node. So we deprecated this behaviour and went\nback to the original design - using swc as a supplement only in situations where\nit was needed.\n\n\nUsing Hooks to Intervene in the Build Process#\n\nThe Modern.js Module provides a Hook mechanism that allows us to inject custom\nlogic at different stages of the build process. The Modern.js Module Hook is\nimplemented using tapable, which extends esbuild's plugin mechanism, and is\nrecommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:\n\n\nHook type#\n\nAsyncSeriesBailHook#\n\nSerial hooks that stop the execution of other tapped functions if a tapped\nfunction returns a non-undefined result.\n\nAsyncSeriesWaterFallHooks#\n\nSerial hooks whose results are passed to the next tapped function.\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * Triggered at esbuild onLoad callbacks to fetch module content based on the\n module path\n * Input parameters\n\n\n\n * Return parameters\n\n\n\n * Example\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onLoad callbacks. Transforms the contents of the module\n fetched during the load phase\n * Input parameters (return parameters)\n\n\n\n * Example\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onEnd callbacks. This is similar to the transform hook,\n but works on the artifacts generated by esbuild.\n * Input parameters (return parameters)\n\n\n\n * Examples\n\n\n\n\ndts#\n\nThe buildConfig.dts configuration is mainly used for type file generation.\n\n\nTurn off type generation#\n\nType generation is turned on by default, if you need to turn it off, you can\nconfigure it as follows:\n\n\n\nTIP\n\nThe build speed is generally improved by closing the type file.\n\n\nBuild type files#\n\nWith buildType: 'bundleless', type files are generated using the project's tsc\ncommand to complete production.\n\nThe Modern.js Module also supports bundling of type files, although care needs\nto be taken when using this feature.\n\n * Bundle type files does not enable type checking.\n * Some third-party dependencies have incorrect syntax that can cause the\n bundling process to fail. So in this case, you need to exclude such\n third-party packages manually with buildConfig.externals or close\n dts.respectExternal to external all third-party packages types.\n * It is not possible to handle the case where the type file of a third-party\n dependency points to a .ts file. For example, the package.json of a\n third-party dependency contains something like this: {\"types\": \".\n /src/index.ts\"}.\n\nFor the above problems, our recommended approach is to first use tsc to generate\nd.ts files, then package the index.d.ts as the entry and close\ndts.respectExternal. In the future evolution, we will gradually move towards\nthis handling approach.\n\n\nAlias Conversion#\n\nDuring the bundleless build process, if an alias appears in the source code,\ne.g.\n\n\n\nThe type files generated with tsc will also contain these aliases. However,\nModern.js Module will convert the aliases in the type file generated by tsc.\n\n\nSome examples of the use of dts#\n\nGeneral usage:\n\n\n\nFor the use of dts.only:\n\n\n\n\nBuild process#\n\nWhen the modern build command is executed, the\n\n * Clear the output directory according to buildConfig.outDir.\n * Compile js/ts source code to generate the JS build artifacts for\n bundle/bundleless.\n * Generate bundle/bundleless type files using tsc.\n * Handle Copy tasks.\n\n\nBuild errors#\n\nWhen a build error occurs, based on the information learned above, it is easy to\nunderstand what error appears in the terminal.\n\nErrors reported for js or ts builds:\n\n\n\nErrors reported for the type file generation process:\n\n\n\nFor js/ts build errors, we can tell from the error message.\n\n * By 'bundle failed:' to determine if the error is reported for a bundle build\n or a bundleless build\n * What is the format of the build process\n * What is the target of the build process\n * The specific error message\n\n\nDebug mode#\n\nFrom 2.36.0, For troubleshooting purposes, the Modern.js Module provides a debug\nmode, which you can enable by adding the DEBUG=module environment variable when\nexecuting a build.\n\n\n\nIn debug mode, you'll see more detailed build logs output in Shell, which are\nmainly process logs:\n\n\n\nIn addition, Module provides the ability to debug internal workflows. You can\nenable more detailed debugging logging by setting the DEBUG=module:* environment\nvariable.\n\nCurrently, only DEBUG=module:resolve is supported, which allows you to see a\ndetailed log of module resolution within the Module.\n\n","routePath":"/module-tools/en/guide/advance/in-depth-about-build","lang":"en","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"use swc","id":"use-swc","depth":2,"charIndex":2845},{"text":"Using Hooks to Intervene in the Build Process","id":"using-hooks-to-intervene-in-the-build-process","depth":2,"charIndex":3803},{"text":"Hook type","id":"hook-type","depth":3,"charIndex":4183},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":4195},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":4334},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":4431},{"text":"load","id":"load","depth":4,"charIndex":4442},{"text":"transform","id":"transform","depth":4,"charIndex":4626},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":4837},{"text":"dts","id":"dts","depth":2,"charIndex":5071},{"text":"Turn off type generation","id":"turn-off-type-generation","depth":3,"charIndex":5154},{"text":"Build type files","id":"build-type-files","depth":3,"charIndex":5357},{"text":"Alias Conversion","id":"alias-conversion","depth":3,"charIndex":6424},{"text":"Some examples of the use of `dts`","id":"some-examples-of-the-use-of-dts","depth":3,"charIndex":-1},{"text":"Build process","id":"build-process","depth":2,"charIndex":6764},{"text":"Build errors","id":"build-errors","depth":2,"charIndex":7057},{"text":"Debug mode","id":"debug-mode","depth":2,"charIndex":7582}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":20,"title":"In-depth understanding of the dev command","content":"#\n\nThe dev command provided by the Modern.js Module is mainly used for debugging\nthe code.\n\n\nThe overall flow of the command run#\n\n 1. When the dev command is executed, Modern.js Module starts looking for\n debugging tools or tasks that can be executed. A debugging tool or task is a\n Modern.js Module debugging tool plugin like module doc.\n 2. When a debugging tool is found, it is executed immediately.\n 3. When multiple debugging tools are found, the debugging tools list menu is\n displayed. A debug tool can be started by selecting the name option\n corresponding to it.\n 4. When no debug tool is found, the user is informed that no debug tool is\n available.\n\nIn addition to the dev command, you can also start a debugging tool or task\ndirectly by using the dev [debug tool name] option.\n\n\nExtending the dev command#\n\nIf you need to extend the dev command, or rather provide your own Modern.js\nModule debugging tool plugin, then you will need to know the following first.\n\n * Development of plugins\n * Debugging Tools Plugin API\n\nIn general, the code to implement a debugging tool that does nothing and the\nassociated configuration is as follows.\n\n\n\nIf this debugging tool plugin is required, it needs to be added to the\nconfiguration file.\n\n\n\nAt this point we can execute it when we execute the dev or dev do-nothing\ncommand. After execution, it will first execute the source build task in\nlistening mode and print the log messages immediately afterwards.\n\nFor currently officially supported debugging tools and third-party supported\ndebugging tools, you can view them in plugins list.","routePath":"/module-tools/en/guide/advance/in-depth-about-dev-command","lang":"en","toc":[{"text":"The overall flow of the command run","id":"the-overall-flow-of-the-command-run","depth":2,"charIndex":92},{"text":"Extending the dev command","id":"extending-the-dev-command","depth":2,"charIndex":806}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":21,"title":"Before you start","content":"#\n\n\nEnvironment preparation#\n\nIn order to use the Modern.js Module, you first need NodeJS engine, we recommend\nthe latest LTS version, and make sure the Node version is >=16.0.0. because\nnon-stable NodeJS releases frequently have bugs. You might consider installing\nvia nvm-windows and nvm (Mac / Linux), so you can easily switch to different\nNodeJS versions that might be required for different projects that you work on.\n\n\nGetting Started with npm#\n\nOnce NodeJS is installed, not only can you access the node executable from the\ncommand line, but you can also execute the npm command.\n\nNpm is the standard package manager for NodeJS. It started out as a tool for\ndownloading and managing NodeJS package dependencies, but it has since evolved\ninto a tool for front-end JavaScript.\n\nIf you already know something about usage of npm and npm packages, then you can\ndirectly see npm package manager section.\n\n\nnpm package type project#\n\nSo what is an npm package type project? When we execute the npm init command in\nan empty project directory, it creates a JSON file with the file name\npackage.json under the current directory. During the creation process, we will\nneed to fill in information including but not limited to the name, version\nnumber, description, etc. of the npm package, which will be found in the\nresulting package.json file as follows\n\n\n\nAt this point the project containing the initialized package.json file is an npm\npackage type project, and you can execute the npm publish command to publish the\nproject to the npm Registry.\n\nThe npm Registry is a npm package store where developers can not only publish\ntheir own npm packages to the npm Registry, but also use npm packages published\nby other developers through the npm Registry.\n\nA quality npm package will be used by more people because it not only saves a\nlot of code implementation work, but is also less likely to cause problems with\nthe project.\n\n\nUsing third-party npm packages#\n\nWhen adding a third-party npm package to an initial project, we can call this\nprocess \"installing dependencies for the project\" or \"adding dependencies to the\nproject\". Before adding dependencies, we need to know one thing in particular --\nthe types of packages npm depends on.\n\n * \"dependencies\": a type of package that your application will need in a\n production environment.\n * \"devDependencies\": another type of package that is only needed for local\n development and testing.\n \n > packages can be understood as third-party npm packages.\n\nYou can install the packages you need in a production environment by running npm\ninstall npm-package-name or npm add npm-package-name, or you can manually write\nthe packages you need to install and the corresponding semantic version in\n\"dependencies\" in the package.json file, and run the npm install command to.\n\n\n\nSimilarly, you can install only packages needed for local development and\ntesting by running npm install npm-package-name --save-dev or npm add\nnpm-package-name --save-dev, or you can manually write the packages to be\ninstalled and the corresponding semantic version in \"devDependencies\" in the\npackage.json file, and run the npm install command as follows\n\n\n\nWhen installing or using third-party npm packages be sure to determine what they\nare for and whether they should be placed in \"dependencies\" or \"devDependencies\"\nby distinguishing between their types.\n\nTIP\n\nIn general, packages that need to be used in source code are dependencies\ndependencies. Unless you are exporting dependent code locally via packaging, in\nwhich case it can be treated as a devDependencies dependency.\n\n\nOther npm bits and pieces to know#\n\n\nProgram entry for npm packages#\n\nThere is a \"main\" attribute in package.json that corresponds to a module ID or,\nmore intuitively, a NodeJS file path, which is the main entry point for your\napplication.\n\nFor example, if your package is named foo and the user installs it, and then\nexecutes the require(\"foo\") code, then the file corresponding to the \"main\"\nfield of the npm package foo will be exported.\n\nIt is recommended to set the \"main\" field in your npm package. If \"main\" is not\nset, the default entry will be the index.js file in the root of the package.\n\nIn addition to the \"main\" attribute, the \"module\" attribute is usually set. It\nis similar to the \"main\" attribute in that it is mainly used in webpack\nscenarios. webpack reads the npm package entry (file) in most cases in the order\n\"module\" -> \"main \".\n\n> To learn more about how webpack does this, check out this link.\n\n\nscripts#\n\nThe \"scripts\" attribute of the package.json file supports a number of built-in\nscripts and npm-preset lifecycle events, as well as arbitrary scripts.\n\nThese can be executed by running npm run-script or simply npm run .\n\nName matching pre and post commands will also be run (e.g. premyscript,\nmyscript, postmyscript ).\n\n\n\nWhen npm run myscripts is executed, the script corresponding to premyscripts\nwill be executed before it, and the script corresponding to postmyscripts will\nbe executed after it.\n\nScript commands from dependencies can be run with npm explore -- npm run .\n\nThere are also special lifecycle scripts that occur only under certain\ncircumstances. Here are a few that are usually necessary to know.\n\nnpm install#\n\nWhen you run npm install -g , the following scripts will run.\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\nIf your package root has a binding.gyp file and you don't define an install or\npreinstall script, then npm will build with node-gyp rebuild as the default\ninstall command, using node-gyp.\n\nnpm publish#\n\nWhen publishing a project, executing this command will trigger the following\nscript.\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\nWhen running in -dry-run mode, the script corresponding to prepare will not be\nexecuted.\n\n\npeerDependencies#\n\nIn some cases, your npm project has a compatibility relationship with its host\ntool or library (e.g. a webpack plugin project and webpack), and your npm\nproject does not want to use the host as a necessary dependency, which usually\nmeans that your project is probably a plugin for that host tool or library. Your\nnpm project will have certain requirements for the version of the host package,\nas only the APIs required by the npm project will be exposed under a specific\nversion.\n\nFor more explanation of peerDependencies, you can learn about the different ways\nnpm, pnpm, and Yarn handle it at the following links.\n\n * npm's explanation of peerDependencies\n * pnpm vs npm vs Yarn\n\n\nnpm package manager#\n\nIn addition to the standard package manager like npm, the mainstream ones are\npnpm and Yarn, both of which are good alternatives to npm cli.\n\nIt is recommended to use pnpm to manage project dependencies, which can be\ninstalled as follows.\n\n\n\n\nModern.js Module configuration file#\n\nThe Modern.js Module configuration file - modern.config.(j|t)s - is provided in\nthe project directory of the module project created with @modern-js/create.\nHowever, the modern.config configuration file is not required to exist.\n\nBy default, the contents of the generated configuration file are as follows.\n\n\n\nWe recommend using the defineConfig function, but it is not mandatory to use it.\nSo you can also return an object directly in the config file: the\n\n","routePath":"/module-tools/en/guide/basic/before-getting-started","lang":"en","toc":[{"text":"Environment preparation","id":"environment-preparation","depth":2,"charIndex":3},{"text":"Getting Started with npm","id":"getting-started-with-npm","depth":2,"charIndex":424},{"text":"npm package type project","id":"npm-package-type-project","depth":2,"charIndex":906},{"text":"Using third-party npm packages","id":"using-third-party-npm-packages","depth":2,"charIndex":1922},{"text":"Other npm bits and pieces to know","id":"other-npm-bits-and-pieces-to-know","depth":2,"charIndex":3606},{"text":"Program entry for npm packages","id":"program-entry-for-npm-packages","depth":3,"charIndex":3643},{"text":"`scripts`","id":"scripts","depth":3,"charIndex":-1},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":5883},{"text":"npm package manager","id":"npm-package-manager","depth":2,"charIndex":6585},{"text":"Modern.js Module configuration file","id":"modernjs-module-configuration-file","depth":2,"charIndex":6850}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":22,"title":"CLI Commands","content":"#\n\nCLI Commands available for Modern.js Module projects are as follows:\n\n\nmodern build#\n\n\n\nModern.js Module supports the platform build mode, which can be used to execute\nbuild tasks of other tools. Currently, the official support includes Rspress.\nFor example, you can start the doc build task to generate doc products by\nexecuting the modern build --platform commands.\n\n\nmodern new#\n\n\n\nThe modern new command is used to start the microgenerator functionality, which\nenables features for the project that are not provided by default.\n\nThe following features can currently be enabled.\n\n * Testing support\n * Storybook V7\n * Tailwind CSS support\n * Modern.js Runtime API\n\nYou can learn more about these features in the Using the micro generator\nsection.\n\n\nmodern dev#\n\n\n\nThe Modern.js Module provides the ability to use debugging tools, which can be\nstarted with the modern dev command. Note, however, that no debugging-related\nplugins are provided by default, so executing modern dev will prompt: \"No dev\ntools found available \".\n\nThe officially supported debugging tool is Rspress, so you can run modern dev or\nmodern dev doc to execute it after you run modern new to enable it.\n\n\nmodern test#\n\n\n\nYou need to execute modern new to turn on the test function before you can\nexecute the modern test command. The modern test command will automatically run\nthe src/tests/*.test.(js|ts|jsx|tsx) file as a test case.\n\n\nmodern lint#\n\n\n\nRun ESLint to check the syntax of the code. Usually, we only need to check the\npart of the code that was changed in this commit with lint-staged during the\n-git commit phase.\n\n * The -no-fix argument turns off the ability to automatically fix lint error\n code.\n\n\nmodern change#\n\n\n\nThe modern change command is used to generate the required Markdown file for\nchangesets.\n\n\nmodern pre#\n\n\n\nYou can use the modern pre command to pre-release a version before the official\nrelease.\n\n\nmodern bump#\n\n\n\nModify the version number in package.json according to the Markdown file of the\nchangelog generated by changesets, and generate the CHANGELOG.md file.\n\n\nmodern release#\n\n\n\nThe -modern release command releases the module to the npm Registry.\n\n * The -tag argument specifies the specific dist tags to be used for the\n release.\n\n\nmodern gen-release-note#\n\n\n\nAutomatically generate Release Note based on the changeset information of the\ncurrent repository.\n\nTIP\n\nneeds to be executed before the bump command.\n\n\nmodern upgrade#\n\n\n\nThe modern upgrade command is used to upgrade the project Modern.js related\ndependencies to the latest version.\n\nExecuting the command npx modern upgrade in the project root directory will\nupdate the Modern.js dependencies in package.json of the currently executing\nproject to the latest version by default.","routePath":"/module-tools/en/guide/basic/command-preview","lang":"en","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern test`","id":"modern-test","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":23,"title":"Modify the output","content":"#\n\n\nDefault output artifacts#\n\nWhen you use the modern build command in an initialized project, Modern.js\nModule will generate corresponding build artifacts based on the current\nconfiguration.\n\nThe default configuration is as follows:\n\n\n\nThe default output files has the following characteristics.\n\n * will generate CommonJS and ESM.\n * The code syntax is supported up to ES6 , and more advanced syntax will be\n converted.\n * All code is bundled into one file, i.e. bundle processing is performed.\n * The output root directory is the dist directory under the project, and the\n type file output directory is dist/types.\n\nYou may have the following questions when you see this.\n\n 1. what is buildPreset?\n 2. what determines these characteristics of the product?\n\nThen the next step is to first explain buildPreset.\n\n\nbuildPreset#\n\nThe buildPreset represents a prepared set or sets of build-related\nconfigurations that can be used to eliminate the trouble and complexity of\nconfiguration by using the default values corresponding to the build Preset,\nresulting in the expected product.\n\nModern.js Module mainly comes with two built-in build presets, including:\n\n * npm-component: Used to build component libraries.\n * npm-library: Used to package projects of other library types, such as tool\n libraries.\n\nIt also provides some variations, such as npm-library-with-umd and\nnpm-library-es5, which, as their names suggest, correspond to library presets\nwith umd output and support for es5 syntax, respectively. For more detailed\nconfiguration, you can refer to its API.\n\nIn addition, we can also fully customize the build configuration:\n\n\nbuildConfig#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. What was mentioned at the beginning about \"features of build\nartifacts\" are actually properties supported by buildConfig. The currently\nsupported properties cover the needs of most module type projects when building\nartifacts. buildConfig not only contains some properties that artifacts have,\nbut also contains some features needed to build artifacts. The following is a\nbrief list from a classification point of view.\n\nThe basic attributes of a build artifacts include:\n\n * Whether the artifact is bundled or not: the corresponding API is\n buildConfig.buildType.\n * Product support for syntax: the corresponding API is buildConfig.target.\n * Output format: the corresponding API is buildConfig.format.\n * How the output type file is handled: the corresponding API is\n buildConfig.dts.\n * How the sourceMap of the artifact is handled: the corresponding API is\n buildConfig.sourceMap.\n * The input (or source file) corresponding to the output: the corresponding API\n is buildConfig.input.\n * The directory of the output of the artifact: the corresponding API is\n buildConfig.outDir.\n * Build source directory: the corresponding API is buildConfig.sourceDir.\n\nCommon functions required for build artifacts include:\n\n * Alias: The corresponding API is buildConfig.alias.\n * Static resource handling: the corresponding API is buildConfig.asset.\n * Third-party dependency handling: The corresponding APIs are\n * buildConfig.autoExternal.\n * buildConfig.externals.\n * Copy: The corresponding API is buildConfig.copy.\n * Global variable substitution: the corresponding API is buildConfig.define.\n * Specify JSX compilation method, the corresponding API is\n [buildConfig.jsx](/api/config/ build-config#jsx).\n\nSome advanced properties or less frequently used functions:\n\n * Product code compression: The corresponding API is buildConfig.minify.\n * Code splitting: buildConfig.splitting\n * Specify whether the build artifacts is for the NodeJS environment or the\n browser environment: the corresponding API is buildConfig.platform.\n * umd product-related.\n * Specifies the global variables imported externally to the umd product: the\n corresponding API is buildConfig.umdGlobals.\n * Specify the module name of the umd product: the corresponding API is\n buildConfig.umdModuleName.\n\nIn addition to the above categories, frequently asked questions and best\npractices about these APIs can be found at the following links\n\n * About bundle and bundleless?\n * About input and sourceDir\n * About d.ts.\n * How to use define\n * How to handle third-party dependencies?\n * How to use copy?\n * How to use umd\n * How to use asset\n\n\nCombining Configuration and Presets#\n\nOnce we understand buildPreset and buildConfig, we can use them together.\n\nIn a real project, we can use buildPreset to quickly get a set of default build\nconfigurations. If you need to customise it, you can use buildConfig to override\nand extend it.\n\nThe extension logic is as follows.\n\n * When buildConfig is an array, new configuration items are added to the\n original preset.\n\n\n\nThis will generate an additional IIFE-formatted product that supports up to\nES2020 syntax on top of the original preset, in the dist/global directory under\nthe project.\n\n * When buildConfig is an object, the configuration items in the object are\n overwritten in the preset.\n\n\n\nThis will cause a sourceMap file to be generated for each build task.","routePath":"/module-tools/en/guide/basic/modify-output-product","lang":"en","toc":[{"text":"Default output artifacts","id":"default-output-artifacts","depth":2,"charIndex":3},{"text":"buildPreset","id":"buildpreset","depth":2,"charIndex":818},{"text":"buildConfig","id":"buildconfig","depth":2,"charIndex":1639},{"text":"Combining Configuration and Presets","id":"combining-configuration-and-presets","depth":2,"charIndex":4390}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":24,"title":"Versioning and Publishing","content":"#\n\nAn npm-type module project release process consists of two phases.\n\n * The first phase is during development, where the developer needs to provide a\n change file to record changes that need to be released.\n * The second phase is during release, collect all the change files to update\n the version, update the release log, and release new packages to the npm\n Registry.\n\nModern.js Module provides a set of version management and release solutions,\nwhich are suitable for single-package scenarios. For npm packages in monorepo,\nyou need to follow the strategies provided by various monorepo solutions.\n\n\nTracking changes#\n\nChanges need to be logged when they happen to the project. Changes that occur in\na project are typically.\n\n * New features\n * Fixes to issues\n * Configuration file changes\n * ...\n\nOnce these changes have been made, the current changes need to be documented\nwith the following command.\n\n * modern change\n\nExecuting the modern change command asks the developer several questions and\ngenerates a change log based on the developer's answers. The changelog file\ncontains the type of change and its description, and is committed to the git\nrepository.\n\n\n\nWhen executed successfully, the resulting Markdown file containing the change\nlog is saved in the project's .changeset directory. The contents will look like\nthe following.\n\n\n\n\nVersion update#\n\nWhen the project version needs to be updated, execute the following command.\n\n * modern bump\n\nExecuting modern bump will modify the version number in package.json based on\nthe contents of the Markdown file in the .changeset/ directory where the changes\nwere recorded, and generate the CHANGELOG.md file. These Markdown files are also\ndeleted when the version update is complete, so they are \"consumed \".\n\n\n\n\nPublish#\n\nTo publish a project, you can execute the following command.\n\n * modern publish\n\nThe modern release command publishes the project to the npm Registry.\n\nThe release is the latest version, which is also the official version. If you\nwant to change the dist-tag, you can specify it with the modern release --tag\ncommand. For example.\n\n\n\nHowever, if you want to change the version number of the current project to a\npre-release as well, you need to use the modern pre command.\n\n> dist-tag can be understood as: tagging the current release. Generally\n> speaking, the dist-tag for the default release is latest, so you can consider\n> latest as the dist-tag for the official release.\n\n\nPre-releases#\n\nWhen a pre-release is needed before the official release, the following command\nis executed.\n\n * modern pre\n\nFirst modern pre enter to enter pre-release mode, can be the same as the tag\nspecified with the modern release --tag command when releasing the project.\n\n\n\nThen you can update the specific version number with the modern bump command,\nwhich doesn't actually \"consume\" the Markdown file that records the changes:\n\n\n\nThen you can see that the updated version number in package.json will look like\nthis: 0.1.2-next.0.\n\nFinally, if you don't need to do a pre-release anymore, be sure to run the\nmodern pre exit command to exit the pre-release state and to release the\nofficial version when you run the modern bump command again.","routePath":"/module-tools/en/guide/basic/publish-your-project","lang":"en","toc":[{"text":"Tracking changes","id":"tracking-changes","depth":2,"charIndex":610},{"text":"Version update","id":"version-update","depth":2,"charIndex":1355},{"text":"Publish","id":"publish","depth":2,"charIndex":1780},{"text":"Pre-releases","id":"pre-releases","depth":2,"charIndex":2468}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":25,"title":"Using the Microgenerator","content":"#\n\nModern.js Module provides the Microgenerator tool, which allows for the current\nproject to.\n\n * add new directories and files\n * Modify the contents of the package.json file\n * Execute commands\n\nThus with these capabilities, Microgenerator can enable additional feature\nfunctionality for the project.\n\nThe microgenerator can be started via modern new. The current Microgenerator\nfeatures supported by the Modern.js Module are:\n\n\nDevelop Module Doc#\n\nWhen we want to write documentation for out module project, we can enable the\nmodule doc feature. will create docs directory and related files in the project\ndirectory, and add \"@modern-js/plugin-rspress\" dependency in package.json. Use\nmodern dev and modern build --platform to debug and build your doc site.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n\n\n\nStorybook#\n\nThe Storybook feature can be enabled when we want to debug a component or a\ncommon module. When this feature is enabled, the stories directory and\n.storybook directory are created in the project directory, and a new\n\"@modern-js/storybook\" dependency is added to package.json. Use storybook dev\nand storybook build to debug and build.\n\n\nTailwind CSS Support#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nIf you want to use Tailwind CSS for a project, you can refer to \"Using Tailwind\nCSS\".\n\n\nModern.js Runtime API#\n\nModern.js provides Runtime API capabilities that can only be used in the\nModern.js application project environment. If you need to develop a component\nfor use in a Modern.js application environment, then you can turn on this\nfeature and the microgenerator will add the \"@modern-js/runtime\" dependency.\n\nAlso, the Storybook debugging tool will determine if the project needs to use\nthe Runtime API by checking the project's dependencies and providing the same\nRuntime API runtime environment as the Modern.js application project.\n\n:::tip After successfully enabling it, you will be prompted to manually add a\ncode similar to the one below to the configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-micro-generator","lang":"en","toc":[{"text":"Develop Module Doc","id":"develop-module-doc","depth":2,"charIndex":431},{"text":"Storybook","id":"storybook","depth":2,"charIndex":895},{"text":"Tailwind CSS Support","id":"tailwind-css-support","depth":2,"charIndex":1243},{"text":"Modern.js Runtime API","id":"modernjs-runtime-api","depth":2,"charIndex":1528}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":26,"title":"Developing Module documentation","content":"#\n\nThis chapter describes how to quickly build a static documentation site for a\nmodule project.\n\n\nBefore we start#\n\n\nWhy we need to build a documentation site for a module#\n\n 1. a documentation site can help us to better organize the structure of the\n documentation.\n 2. the documentation site has better presentation, such as the ability to\n execute functions in the page, render components.\n 3. to make better use of AI search capabilities.\n\n\nPreliminary preparation#\n\n 1. Enable the documentation feature via micro-generator.\n 2. Read Introduction to Rspress.\n\nAfter finishing the preparation work, we will build a documentation site for the\nmodule project based on Rspress.\n\n\nBasic site structure#\n\nThe overall layout of the site consists of three parts: the navigation bar, the\nsidebar and the body part, which also includes the TOC (Table of contents found\nat the beginning of a book or document).\n\nThe Rspress uses File System Routing, on which the module documentation is\nbased, to automate the generation of the sidebar. For example, if you have the\nfollowing file structure:\n\n\n\nThen the routing path for foo/bar.md will be /foo/bar, the routing path for\nfoo.md will be /foo, and the routing path for index.md will be /.\n\nThe specific mapping rules are as follows:\n\nFILE-PATH ROUTING-PATH\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\nThe sidebars corresponding in turn to the above file paths and routing paths are\nshown below:\n\n\nConfigure sidebar#\n\nAs shown in the figure above, the module documentation has automatically\ngenerated sidebars for file system routing, where the text of each column of the\nsidebar is determined by the file's first level title or directory name. If you\nneed to customize the sidebar, please use _meta.json or configure sidebar\ndirectly.\n\nINFO\n\nIf your document directory structure complies with internationalization, for\nexample:\n\n\n\nYou need to follow internationalization guide and configure lang 和 locales,\notherwise, the automatically generated sidebar of the module will not handle the\nzh and en directories.\n\n\nWriting Documentation#\n\nNext, we can focus on writing the content of the document. In addition to the\nbasic Markdown syntax, you may also need to understand the following advanced\ntopics:\n\n * Using MDX\n * Using Assets\n\n\nComponent preview#\n\nModule documentation provides preview capabilities for component libraries. The\ncontents in code blocks written in jsx and tsx will be parsed as React\ncomponents.\n\n\nExample#\n\nHere is a complete example using the component preview feature:\n\nAssuming our project name is demo and we export a Button component.\n\n 1. Add a new docs/Button.mdx file:\n\n\n\n 2. In the tsconfig.json, configure aliases and point the package name to the\n current project directory, make the way document developers and users use\n components consistent:\n\n\n\n 3. In the .gitignore, add doc_build/:\n\n\n\nCongratulations, you have finished writing a component document, execute pnpm\nrun dev to see the result, remember to build the component library first to make\nsure the component product exists.\n\n\nMobile Preview#\n\nAlso, we support mobile preview mode, i.e. rendering mobile components using\niframe, and set iframe position by iframePosition, support swipe preview and new\npage opening.\n\n\n\nTIP\n\nIf you only want to change the way a particular jsx and tsx block is previewed,\nyou can use a different modifier to identify it:\n\n\n\n\nUsing external demos#\n\nIf our demo is very complex, then it is recommended to write the demo separately\nand then use the code tag in the mdx:\n\n\n\nThis also supports setting the preview method for each individual code block,\nfor example:\n\n\n\n\nUsing built-in components#\n\nThe plugin implements some built-in components internally so that you can\ndevelop module documentation more easily.\n\n\nAPI#\n\nDisplay the API content of the module.\n\nParse file#\n\nBefore we can use the API component, we first need to specify the files to\nparse:\n\n\n\nContent generation#\n\nNext, we'll see what kind of markdown content is generated based on the parsed\nfile.\n\nContent can be generated with two different tools, react-docgen-typescript or\ndocumentation:\n\n * react-docgen-typescript is targeted at component library scenarios and will\n only parse props to generate tables.\n\n\n\nThe above is a standard writeup where ButtonProps will be extracted into the\ntable and Button will be the title of the table. If you use the default export,\nthe filename will be used as the form title.\n\nNotice that export features declared elsewhere are not available.\n\n\n\nThe generated content is as follows:\n\n\n\nWARNING\n\nIf React types are used in Props, you need to add the types in tsconfig.json,\notherwise the types will not be resolved under the React namespace.\n\n\n\nThe best way is that you import the type directly:\n\n\n\n * documentation is used in tool library scenarios to parse JSDoc annotations.\n\n\n\nThe above is a greet function with a JSDoc annotation. The generated content is\nas follows:\n\n\n\nUsing the component#\n\nNext, you can use our built-in API components in your documentation by passing\nthe key value into the moduleName property。\n\n\n\n\nOverview#\n\nDisplays a list of modules that can be placed on the front page to display all\nmodules.\n\nThe Overview component has only one list property, which receives an array of\nobjects, and the following properties of the objects\n\nPROPERTY DESCRIPTION TYPE DEFAULT\nicon icon React.ReactNode \ntext text(required) string \nlink link(required) string \narrow whether to show arrows boolean false\n\n\nPlugin options#\n\n\napiParseTool#\n\nAPI parse tool.\n\n * Type:'react-docgen-typescript' | 'documentation'\n * Default: 'react-docgen-typescript'\n\n\ndoc#\n\nConfig.\n\n\nentries#\n\nModule names and relative paths for automatically generated documents.\n\n * Type:Entries | ToolEntries\n * Default: {}\n\n\n\nIt also supports the use of different parsing tools for different files:\n\n\n\n\niframePosition#\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nWhen the value is follow, each code block will have an iframe showing its\nrendered view. When fixed, the iframe will be fixed to the right side of the\npage, showing the view of all the code blocks on the current page.\n\n\nparseToolOptions#\n\nAPI parse tool options.\n\n * Type:ParseToolOptions\n * Default: {}\n\n\n\n\npreviewMode#\n\n * Type:'iframe' | 'internal'\n * Default: 'internal'\n\nIn case of internal, the component will be rendered directly in the page,\notherwise it will be loaded through an iframe.\n\n\ndeprecated: languages#\n\nWARNING\n\nStarting from version 2.44.0, please refer to the Internationalization section\nto implement multiple languages.\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\nStarting from version 2.44.0, a sniffing mechanism has been implemented\ninternally, so please directly use _meta.json or directly configure sidebar to\nimplement a custom sidebar.\n\n\nScripts#\n\n * modern dev: Start dev server for doc site.\n * modern build --platform: Build doc site in production, by default output\n directories is doc_build.\n\n\nAdvanced guide#\n\nThe above has covered the basics of developing module documentation, but this is\nnot enough for developing a complete documentation station. Check out the\nRspress for an in-depth look at our documentation framework. You can modify the\ndocumentation framework configuration via the doc configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-module-doc","lang":"en","toc":[{"text":"Before we start","id":"before-we-start","depth":2,"charIndex":98},{"text":"Why we need to build a documentation site for a module","id":"why-we-need-to-build-a-documentation-site-for-a-module","depth":3,"charIndex":117},{"text":"Preliminary preparation","id":"preliminary-preparation","depth":3,"charIndex":451},{"text":"Basic site structure","id":"basic-site-structure","depth":2,"charIndex":686},{"text":"Configure sidebar","id":"configure-sidebar","depth":3,"charIndex":1493},{"text":"Writing Documentation","id":"writing-documentation","depth":2,"charIndex":2109},{"text":"Component preview","id":"component-preview","depth":2,"charIndex":2329},{"text":"Example","id":"example","depth":3,"charIndex":2514},{"text":"Mobile Preview","id":"mobile-preview","depth":3,"charIndex":3121},{"text":"Using external demos","id":"using-external-demos","depth":3,"charIndex":3451},{"text":"Using built-in components","id":"using-built-in-components","depth":2,"charIndex":3691},{"text":"API","id":"api","depth":3,"charIndex":3837},{"text":"Parse file","id":"parse-file","depth":4,"charIndex":3883},{"text":"Content generation","id":"content-generation","depth":4,"charIndex":3981},{"text":"Using the component","id":"using-the-component","depth":4,"charIndex":5005},{"text":"Overview","id":"overview","depth":3,"charIndex":5154},{"text":"Plugin options","id":"plugin-options","depth":2,"charIndex":5675},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":5693},{"text":"doc","id":"doc","depth":3,"charIndex":5817},{"text":"entries","id":"entries","depth":3,"charIndex":5833},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":6040},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":6320},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":6408},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":6599},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":6746},{"text":"Scripts","id":"scripts","depth":2,"charIndex":6967},{"text":"Advanced guide","id":"advanced-guide","depth":2,"charIndex":7130}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":27,"title":"Using Storybook","content":"#\n\nStorybook is a tool dedicated to component debugging, providing around component\ndevelopment.\n\n * Develop UIs that are more durable\n * Test UIs with less effort and no flakes\n * Document UI for your team to reuse\n * Share how the UI actually works\n * Automate UI workflows\n\nBefore when using Storybook, there are various problems related to\nconfigurations, Babel, Webpack, less or sass. Modern.js integrates with\nStorybook, which greatly simplifies configuration for us as we develop our\nStorybook project.\n\n\nV7 (Recommended)#\n\n\nEnable Storybook#\n\nYou can directly enable the Storybook feature by using the following command:\n\n\n\nThis command will create a template for Storybook, including:\n\n * Creating a configuration folder .storybook and a default configuration file\n .storybook/main.ts.\n * Creating example story components.\n * Updating package.json to add dependencies @storybook/addon-essentials and\n @modern-js/storybook, as well as creating Storybook-related scripts.\n\n\nEnable Debug output#\n\nIn fact, Modern.js Module is implemented based on esbuild, while Storybook uses\nWebpack as the default build tool, and their configurations are not fully\ncompatible. Therefore, we recommend building the components first, and then\nimporting the component output in stories.\n\nThe way to import component outputs is very simple. Suppose your module exports\na Button component, then you can use it in stories like this:\n\n\n\nIf you want to update the components, you can start the build in watch mode\nbefore starting Storybook:\n\n\n\nINFO\n\nIn the development process, you may encounter situations where you cannot get\ntype definitions in real time. Because only when the code is saved, the type\nfile under the output directory will be updated. At this time:\n\nFor pnpm projects, you can modify the package.json as follows:\n\n\n\n> For the use of publishConfig in pnpm, you can read the following link.\n\nFor npm and Yarn projects, the types value of package.json can only be modified\nmanually during the development stage and release stage.\n\n\nEnable Rspack build#\n\nRspack is known for its fast build speed. To use Rspack as a build tool in\nModern.js, you only need to configure it as follows:\n\n\n\nNote that in the above configuration, the reactDocgen configuration has been\nchanged because Rspack currently does not support\n@storybook/react-docgen-typescript-plugin.\n\n\nConfigurations#\n\nThere are some separate configurations in .storybook/main.js.\n\nbundler#\n\n * Type: 'webpack' | 'rspack'\n * Default: webpack\n\nSpecify the underlying bundler to use either Webpack or Rspack.\n\nExample:\n\n\n\nbuilderConfig#\n\n * Type: BuilderConfig\n * Default: undefined\n\nThe Storybook build capability of Modern.js is provided by Rsbuild, and the\nRsbuild configuration can be modified through builderConfig.\n\n\n\n\nCommand#\n\n@modern-js/storybook proxies some storybook cli commands\n\nstorybook dev#\n\nStart Storybook,detail\n\nstorybook build#\n\nBuild Storybook for production,detail\n\n\nMigrate from V6 to V7#\n\nOur support methods for the two versions are different, so if you are migrating\nfrom V6 to V7, we hope you will also use V7 in the same way, while making the\nfollowing adjustments:\n\n * Configuration file: Migrate any custom configurations (if any) in the\n original root/config/storybook/main.(j|t)s to the new\n root/.storybook/main.(j|t)s.\n * Dependencies: Upgrade @storybook/addon-* series dependencies (if any) to\n version 7 and delete @modern-js/plugin-storybook dependencies.\n * Commands: Delete the original edenx dev storybook and edenx build --platform\n commands. If you are used to the original pnpm run dev usage, you can replace\n it with storybook dev -p 6006 and storybook build.\n * modern.config.(j|t)s : Remove the registration of @modern-js/plugin-storybook\n plugin.\n\n\nV6 (legacy)#\n\nStarting from 2.40.0 version, @modern-js/plugin-storybook will stop iterating.\nIt is recommended to use the V7 version. If your @modern-js/module-tools version\nis lower than 2.40.0, you can use Storybook V6 in the following ways:\n\n\nStart Storybook#\n\nYou can directly use the following command to enable the Storybook feature.\n\n\n\nThis command will create commonly used templates for Storybook, including\n\n * Create stories component examples\n * Update package.json, add a dependency on @modern-js/plugin-storybook, and add\n related scripts such as pnpm dev storybook.\n\n\nConfigure Storybook#\n\nThe Storybook official configures the project through a folder named .storybook,\nwhich contains various configuration files. In Modern.js Module, you can add\nStorybook configuration files in the project's config/storybook directory.\n\nFor how to use various Storybook configuration files, you can check the\nfollowing link:\n\n * Configure Storybook\n\nHowever, there are some restrictions when using it in module projects:\n\n * Cannot change the location where Story files are stored, that is, the stories\n configuration cannot be modified in the main.js file.\n * Cannot modify the configuration related to Webpack and Babel, that is, the\n webpackFinal and babel configurations cannot be modified in the main.js file.\n\n\nBuild Storybook Output#\n\nIn addition to debugging the component or ordinary modules with Storybook, you\ncan also use the following command to execute the Storybook build task.\n\n\n\nAfter the build is complete, you can see the build output files in the\ndist/storybook-static directory.","routePath":"/module-tools/en/guide/basic/using-storybook","lang":"en","toc":[{"text":"V7 (Recommended)","id":"v7-recommended","depth":2,"charIndex":511},{"text":"Enable Storybook","id":"enable-storybook","depth":3,"charIndex":531},{"text":"Enable Debug output","id":"enable-debug-output","depth":3,"charIndex":985},{"text":"Enable Rspack build","id":"enable-rspack-build","depth":3,"charIndex":2036},{"text":"Configurations","id":"configurations","depth":3,"charIndex":2361},{"text":"bundler","id":"bundler","depth":4,"charIndex":2441},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":2579},{"text":"Command","id":"command","depth":3,"charIndex":2782},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":2850},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":2890},{"text":"Migrate from V6 to V7","id":"migrate-from-v6-to-v7","depth":2,"charIndex":2948},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":3767},{"text":"Start Storybook","id":"start-storybook","depth":3,"charIndex":4013},{"text":"Configure Storybook","id":"configure-storybook","depth":3,"charIndex":4352},{"text":"Build Storybook Output","id":"build-storybook-output","depth":3,"charIndex":5092}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":28,"title":"Developing Components","content":"#\n\nThis chapter will describe how to develop component projects using the Modern.js\nModule.\n\n\nInitialize the project#\n\n 1. It is recommended to use the @modern-js/create command to initialize an npm\n project.\n\n\n\n 2. The initialized directory structure:\n\n\n\n 3. Finally, modify the file suffix and content of ./src/index.ts as follows,\n and the initialization of the component project is completed.\n\n\n\n\nDebugging code with Storybook#\n\nPlease refer to \"Using Storybook\" to debug code using Storybook.\n\n\nDeveloping Styles#\n\nNext we can add styles to the component.\n\nThe following capabilities are currently supported for developing styles.\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module supports PostCSS and has the following built-in PostCSS\nplugins.\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\nSo we can create .css files in our projects and use the syntax support and\ncapabilities provided by these plugins directly in our css files.\n\n * Source Code:\n\n\n\n * CSS artifact:\n\n\n\n\nLess#\n\nModern.js Module supports development styles using Less.\n\n> The current built-in Less version is v4.1.3\n\n * Source Code:\n\n\n\n * Less artifact:\n\n\n\n\nSass/Scss#\n\nModern.js Module supports developing styles using Scss/Sass.\n\n> The current built-in Sass version is v1.54.4\n\n * Source code:\n\n\n\n * Less artifact:\n\n\n\n\nTailwind CSS#\n\nPlease refer to \"Using Tailwind CSS\" for detailed usage.\n\n\nCSS Modules#\n\nModern.js Module supports the development of styles using CSS Modules. By\ndefault, the following files are recognized as CSS Module files.\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\nIf you need to configure CSS Modules, you can check out the API at\n\n * style.autoModules\n * style.modules\n\nThe following is a code example.\n\n\n\n\n\n\nConfiguring build artifacts#\n\nBased on most scenarios of component project usage, it is recommended to use the\nnpm-component build preset. This preset yields a output directory structure of\n\n\n\n * . /dist/es: Contains bundleless artifacts in ES modules format that support\n the es6 syntax.\n * . /dist/lib: Contains bundleless artifacts in CommonJS format with support\n for es6 syntax.\n * . /dist/types: Contains the types file.\n\nThe buildPreset can be configured manually if there is a requirement to use\nsyntax support, and supports modifying the supported syntax by adding a suffix\nto npm-component.\n\n\n\nIf you have special needs for the build artifacts directory structure, you can\nuse the buildConfig API, which can be used by the following documentation.\n\n * modify-output-product\n * in-depth-about-build\n\n\nReleasing components#\n\nIt is recommended to use the version release feature provided by Modern.js\nModule. You can refer to the \"Version Management and Release\" section for more\ninformation.","routePath":"/module-tools/en/guide/best-practices/components","lang":"en","toc":[{"text":"Initialize the project","id":"initialize-the-project","depth":2,"charIndex":93},{"text":"Debugging code with Storybook","id":"debugging-code-with-storybook","depth":2,"charIndex":406},{"text":"Developing Styles","id":"developing-styles","depth":2,"charIndex":505},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":711},{"text":"Less","id":"less","depth":3,"charIndex":1098},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":1251},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":1414},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":1488},{"text":"Configuring build artifacts","id":"configuring-build-artifacts","depth":2,"charIndex":1852},{"text":"Releasing components","id":"releasing-components","depth":2,"charIndex":2666}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":29,"title":"Using Tailwind CSS","content":"#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nModern.js Module supports developing component styles using Tailwind CSS.\n\n\nEnabling Tailwind CSS#\n\nTo use Tailwind CSS in Modern.js Module, you can follow the steps below:\n\n 1. Run pnpm run new in the root directory of your project and make the\n following selections:\n\n\n\nAfter successful initialization, you will see that the package.json has added\ndependencies for tailwindcss and @modern-js/plugin-tailwindcss.\n\n 2. Register the Tailwind plugin in modern.config.ts:\n\n\n\n 3. Create a index.css file and add the following code:\n\n\n\nINFO\n\nDepending on your needs, you can selectively import the CSS styles provided by\nTailwind CSS. Please refer to the @tailwind documentation for detailed usage of\nthe @tailwind directive.\n\n 4. Import the index.css file, for example, add the following code in the root\n component src/index.jsx:\n\n\n\n 5. Now you can use the Utility Classes provided by Tailwind CSS in your\n components:\n\n\n\n\nConfiguring Tailwind CSS#\n\nIn Modern.js Module, you have two ways to configure Tailwind CSS:\n\n 1. Using the tailwind.config.{ts,js} file, which follows the official usage of\n Tailwind CSS. Please refer to \"Tailwind CSS - Configuration\" for more\n details.\n\n\n\nTIP\n\nPlease upgrade Modern.js to version >= 2.33.0 to support automatic reading of\ntailwind.config.{ts,js} files.\n\n 2. Using the style.tailwindcss configuration option. This is the old way of\n configuring Tailwind CSS, and we recommend using the tailwind.config.{ts,js}\n file for configuration.\n\n\n\nIf you are using both the tailwind.config.{ts,js} file and style.tailwindcss\noption, the configuration defined in style.tailwindcss will take precedence and\noverride the content defined in tailwind.config.{ts,js}.\n\n\nTailwind CSS Autocomplete#\n\nTailwind CSS provides an official extension called Tailwind CSS IntelliSense for\nautocompletion of Tailwind CSS class names, CSS functions, and directives in VS\nCode.\n\nYou can follow the steps below to enable the autocomplete feature:\n\n 1. Install the Tailwind CSS IntelliSense extension in VS Code.\n 2. If the root directory of your project does not have a\n tailwind.config.{ts,js} file, you need to create one and write the Tailwind\n CSS configuration for your current project. Otherwise, the IDE plugin will\n not work correctly.\n\n\nBuild Modes#\n\nWhen using Tailwind CSS, please note that there are significant differences\nbetween the bundle and bundleless modes in terms of the build artifacts.\n\nTIP\n\nFor definitions of bundle and bundleless, please refer to the \"In-depth\nunderstanding of build\".\n\n\nBundle Mode#\n\nIn Bundle mode, a separate CSS file is generated, and the JS output does not\nautomatically reference the CSS output file.\n\n * Source code:\n\n\n\n * Output code:\n\n\n\n\n\nIf you need to inject styles into the JS artifact, you can enable the\nstyle.inject option.\n\nIf you haven't enabled style.inject, you can also let users manually import the\nCSS file:\n\n\n\n\nBundleless Mode#\n\nIn bundleless mode, the CSS file is automatically imported in the artifact code\nwithout the need for additional processing.\n\n * Output code:\n\n\n\n\nClass Name Prefix#\n\nYou can add a class name prefix using the prefix option provided by Tailwind\nCSS. This helps avoid potential class name conflicts, such as when different\nversions of Tailwind CSS are used in different parts of an application or\nmodule.\n\nFor example, you can add the foo- prefix using the prefix option in\ntailwind.config.js:\n\n\n\n * Source Code:\n\n\n\n * Output Code:\n\n\n\n\nUsage Guide#\n\nHere are some usage examples of Tailwind CSS.\n\n\nHTML Class Names#\n\nTailwind CSS supports adding styles to HTML tags through class names. When using\nHTML class names, please note that the corresponding CSS styles of Tailwind CSS\nmust be imported in advance.\n\n\n\nGenerated styles (after bundling):\n\n\n\n\n@apply#\n\nTailwind CSS provides the @apply directive, which allows us to inline the styles\nprovided by Tailwind CSS into our own styles.\n\n@apply can be used in CSS, Less, and Sass.\n\n\n\nHowever, there are some considerations when using it with Less and Sass:\n\nSass#\n\nWhen using Tailwind with Sass and there is an !important after @apply,\ninterpolation should be used to ensure Sass compiles correctly.\n\n * Won't work as expected:\n\n\n\n * Will work as expected:\n\n\n\nLess#\n\nWhen using Tailwind with Less, you cannot nest Tailwind's @screen directive.\n\n * Won't work as expected:\n\n\n\n * Instead, use regular media queries and the theme() function to reference your\n screen sizes or simply avoid nesting your @screen directive.\n\n\n\n\n\n\nAbout designSystem config#\n\ndesignSystem is a deprecated configuration option in Modern.js Module.\n\nStarting from Modern.js Module version 2.33.0, you can use the theme\nconfiguration option of Tailwind CSS as a replacement for designSystem. It is no\nlonger necessary to split the theme configuration and set it on designSystem.\n\n * Previous usage:\n\n\n\n * Current usage:\n\n","routePath":"/module-tools/en/guide/best-practices/use-tailwindcss","lang":"en","toc":[{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":2,"charIndex":252},{"text":"Configuring Tailwind CSS","id":"configuring-tailwind-css","depth":2,"charIndex":1105},{"text":"Tailwind CSS Autocomplete","id":"tailwind-css-autocomplete","depth":3,"charIndex":1889},{"text":"Build Modes","id":"build-modes","depth":2,"charIndex":2460},{"text":"Bundle Mode","id":"bundle-mode","depth":3,"charIndex":2728},{"text":"Bundleless Mode","id":"bundleless-mode","depth":3,"charIndex":3091},{"text":"Class Name Prefix","id":"class-name-prefix","depth":2,"charIndex":3254},{"text":"Usage Guide","id":"usage-guide","depth":2,"charIndex":3641},{"text":"HTML Class Names","id":"html-class-names","depth":3,"charIndex":3703},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":4211},{"text":"Less","id":"less","depth":4,"charIndex":4413},{"text":"About `designSystem` config","id":"about-designsystem-config","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":30,"title":"General Questions","content":"#\n\n\nWhat is the relationship between Modern.js Module and Rsbuild?#\n\nModern.js Module uses esbuild to build toolkits and component libraries, and\nRsbuild focuses on solving web application building scenarios.\n\n\nCan Modern.js Module use webpack plugins or loaders?#\n\nModern.js Module is based on esbuild for building and cannot use tools from the\nwebpack-related ecosystem. You can find more community plugins for esbuild here\n\nIf the UMD product produced by Modern.js Module does not meet your requirements,\nyou can use Rsbuild and add UMD Plugin to build UMD products.","routePath":"/module-tools/en/guide/faq/basic","lang":"en","toc":[{"text":"What is the relationship between Modern.js Module and Rsbuild?","id":"what-is-the-relationship-between-modernjs-module-and-rsbuild","depth":2,"charIndex":3},{"text":"Can Modern.js Module use webpack plugins or loaders?","id":"can-modernjs-module-use-webpack-plugins-or-loaders","depth":2,"charIndex":210}],"domain":"","frontmatter":{},"version":""},{"id":31,"title":"Build FAQ","content":"#\n\nHere only some common problems and bad cases are recorded.\n\nIf the build products do not meet expectations, especially when buildPreset is\nconfigured, please first understand what configuration items buildPreset\nrepresents, and then check each configuration item based on all configuration\nitems.\n\n\nProduct FAQ#\n\n\nInitialization of Class Fields#\n\nTypeSript provides the useDefineForClassFields configuration to control the\nconversion handling for public class fields.\n\nIf we have a piece of code:\n\n\n\nWhen useDefineForClassFields is false, then the compiled code will look like:\n\n\n\nWhen useDefineForClassFields is true, then the compiled code will look like:\n\n\n\nAlso the default value of this configuration will change depending on the target\nconfiguration of tsconfig.json: When target is ES2022 or higher, then\nuseDefineForClassFields is configured to true by default, otherwise it defaults\nto false.\n\nFor more information on this configuration of TypeScript, you can refer to the\nfollowing link:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nThe Modern.js Module will currently process according to the following logic:\n\n 1. The first decision to enable this feature inside Modern.js Module is based\n on the useDefineForClassFields configuration in tsconfig.json of the current\n project. Currently, only the contents of the tsconfig.json file under the\n current project path will be read, and the final tsconfig configuration\n based on the extends configuration is not supported at this time.\n 2. If the useDefineForClassFields configuration of tsconfig.json is not\n detected, the default value is determined based on the target configuration\n of tsconfig.json. If target is greater than ES2022 (including EsNext), then\n useDefineForClassFields defaults to true, otherwise it is false.\n 3. If the target of tsconfig.json is not detected, it is processed according to\n the value of useDefineForClassFields as true.\n\n\nbabel-plugin-lodash treats the introduced lodash as undefined#\n\nThis problem occurs when using something like the following:\n\n\n\nCurrent related issues on the babel-plugin-lodash Github:\n\n * #235\n\nThe solution to this problem is to remove babel-plugin-lodash, since the plugin\nis not needed for on-demand referencing at this point and using it would have\nside effects.\n\nA similar situation occurs with babel-plugin-import. If there is code like the\nfollowing:\n\n\n\nIn this case babel-plugin-import may also cause Comps to become undefined. So\nyou need to remove the corresponding babel-plugin-import as well.\n\n\nCannot find module 'http'#\n\nIf the output reports an error like Cannot find module 'http' at browser\nruntime, it means that your output has bundled node modules. This may occur if\nsome of your dependencies support both browser and node, such as axios, in which\ncase you only need to set the platform to browser. If some third-party packages\ndon't support the browser, you may need to manually inject node polyfill.\n\n\nExceptions FAQ#\n\n\nDynamic require of \"react\" is not supported#\n\nProblem Description#\n\nWhen the product format in the product configuration of the build is ES modules.\n\n\n\nIf you import a cjs product from a third-party npm package, the resulting\nproduct may not work properly under webpack.\n\n\n\nSolution#\n\n 1. First you need to find which third-party package is causing the problem. For\n example, if the error message points to the react package, then look for a\n third-party package that has code like require('react') in it. For example\n react-draggable, which only contains cjs artifacts, then the problem is\n localized to the react-draggable package.\n 2. Then we need to exclude this package with the following configuration, i.e.\n not package problematic third-party packages.\n\n\n\nReference Links#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\nDuring compilation, an error was reported in the less file of a component\nlibrary:'Operation on an invalid type'#\n\nThis is probably because the component library depends on Less version v3, while\nModern.js Module defaults to v4. v3 and v4 have a Break Change in the math\nconfiguration, check this link for details.\n\nTherefore, if a component library like this is used in the source code:\n\nbuildPreset is used in the build configuration, make the following changes:\n\n\n\nOr, if a custom buildConfig is used, modify it as follows:\n\n\n\nIf you are using a component like this in Storybook, you will need to modify the\ndebugging configuration of Storybook:\n\n\n\n\nBundleless DTS failed#\n\nIn the bundleless scenario, it's tsc that generates the type declaration file\ndirectly. You can find the problem file by printing the error message in the\nterminal. For source code files, it is recommended to fix the type problem,\nwhich can better enable reuse of your package. However. if you encounter a type\nchecking problem with a thrid-party package:\n\n 1. enable skipLibCheck to skip the d.ts check of the thrid-party package.\n 2. If the package exports ts files directly, skipLibCheck will not work because\n it can only skip the d.ts check, so you can only turn off dts.abortOnError\n to ignore these errors.\n\n\nBundle DTS failed#\n\nThe Modern.js Module directly uses rollup-plugin-dts to package your type\ndescription files. It may not be able to handle the type files of some\nthird-party dependencies\n\nIf you encounter an error message titled \"Bundle DTS failed\" during the build\nprocess of the Modern.js Module, you can observe that the error message is from\na third-party dependency. Try setting dts.respectExternal to false to turn off\nthe behavior of packaging type files of third-party dependencies.\n\n\nError reported for defineConfig function type: If there is no reference to \"...\"\nthen the inferred type of \"default\" cannot be named#\n\nCheck if the include configuration exists in the project's tsconfig.json file,\nand if not, try adding the following:\n\n\n\n\nOther FAQ#\n\n\nHow to skip the pre-processing of less/scss files with bundleless#\n\nBundleless is a single-file compilation method. You just need to remove your\nless/scss files from the entry and copy them to the output. Note that we will\nalso rewrite the moduleId of js referencing less/scss, turn it off through the\nredirect plugin.\n\nBelow is an example of skipping less file processing. You will find that all\nless files in src are copied to dist and the relative path is preserved.\n\n\n\n\nAdd additional compilation feature#\n\nThe Modern.js Module is based on the esbuild implementation, so if you have\nspecial needs or want to add additional compilation capabilities, you can do so\nby implementing the esbuild plugin.\n\nThe Modern.js Module provides esbuildOptions configuration to allow modification\nof Modern.js's internal esbuild configuration, so that custom esbuild plugins\ncan be added via this configuration:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\n\nSupport for generating TypeScript declaration files for CSS Modules#\n\n * First Solution: typed-css-modules\n * Second Solution: postcss-modules-dts\n\n","routePath":"/module-tools/en/guide/faq/build","lang":"en","toc":[{"text":"Product FAQ","id":"product-faq","depth":2,"charIndex":301},{"text":"Initialization of Class Fields","id":"initialization-of-class-fields","depth":3,"charIndex":316},{"text":"babel-plugin-lodash treats the introduced lodash as `undefined`","id":"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":2578},{"text":"Exceptions FAQ","id":"exceptions-faq","depth":2,"charIndex":2995},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":3013},{"text":"Problem Description","id":"problem-description","depth":4,"charIndex":3059},{"text":"Solution","id":"solution","depth":4,"charIndex":3287},{"text":"Reference Links","id":"reference-links","depth":4,"charIndex":3792},{"text":"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`","id":"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":4560},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":5206},{"text":"Error reported for `defineConfig` function type: `If there is no reference to \"...\" then the inferred type of \"default\" cannot be named`","id":"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named","depth":3,"charIndex":-1},{"text":"Other FAQ","id":"other-faq","depth":2,"charIndex":5958},{"text":"How to skip the pre-processing of less/scss files with bundleless","id":"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless","depth":3,"charIndex":5971},{"text":"Add additional compilation feature","id":"add-additional-compilation-feature","depth":3,"charIndex":6445},{"text":"Support for generating TypeScript declaration files for CSS Modules","id":"support-for-generating-typescript-declaration-files-for-css-modules","depth":3,"charIndex":7173}],"domain":"","frontmatter":{},"version":""},{"id":32,"title":"FAQ","content":"#\n\nHere is a list of all frequently asked questions about Modern.js Module.\n\n * General FAQ\n * Build FAQ\n * Storybook FAQ\n * Test FAQ","routePath":"/module-tools/en/guide/faq/","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":33,"title":"Storybook FAQ","content":"#\n\n\nStorybook v7 Support#\n\nStorybook v7 is now fully supported and has become our recommended version.\n\n\nUsing Storybook Addon or other configurations does not work#\n\nModern.js Module is currently using Storybook version v6, if you are using Addon\nversion v7 you may not be able to get the addon to work.\n\nIn addition to the Addon, other configurations may also have differences. For\nexample, if you modify the preview.js configuration file, Storybook v6 is\nwritten differently than v7:\n\n * v6:Document\n * v7:Document\n\n\nCannot find module 'react-dom/package.json'#\n\nWhen debug Storybook, the following problem occurs:\n\n\n\nYou can install the react-dom dependency in the project.\n\n\n\n\nUnable to locate the specific error message#\n\nSolutions:\n\n 1. Find @storybook/core-server/dist/cjs/dev-server.js\n 2. Find this code: var _await$Promise$all = await Promise.all([preview,\n manager,.\n 3. Modify it:\n\n\n\n\nCan`t find any stories is your Storybook#\n\n\n\nWhen you get a problem like this, you can first open the browser console and\nthere should be some error messages. You can use the error messages to deduce if\nthere is a problem in the code you are writing that is causing Storybook to not\nwork properly.\n\n\nStorybook Adds Proxy Functionality#\n\nStorybook does not provide a solution for this, but there is one in the\nStorybook Issue. In the Modern.js Module, you can:\n\n 1. Add the config/storybook/middleware.js file and initialize the following:\n\n\n\n 2. add http-proxy-middleware dependency\n 3. Add proxy routing-related configuration\n\n\n\nLink:https://github.com/storybookjs/storybook/issues/11551","routePath":"/module-tools/en/guide/faq/storybook","lang":"en","toc":[{"text":"Storybook v7 Support","id":"storybook-v7-support","depth":2,"charIndex":3},{"text":"Using Storybook Addon or other configurations does not work","id":"using-storybook-addon-or-other-configurations-does-not-work","depth":2,"charIndex":104},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":519},{"text":"Unable to locate the specific error message","id":"unable-to-locate-the-specific-error-message","depth":2,"charIndex":681},{"text":"Can`t find any stories is your Storybook","id":"cant-find-any-stories-is-your-storybook","depth":2,"charIndex":900},{"text":"Storybook Adds Proxy Functionality","id":"storybook-adds-proxy-functionality","depth":2,"charIndex":1200}],"domain":"","frontmatter":{},"version":""},{"id":34,"title":"Test FAQ","content":"#\n\n\nExecute test command with an error TypeError: Cannot read property\n'testEnvironmentOptions' of undefined#\n\n\n\nYou can check whether other projects in Monorepo have jest-environment-jsdom\ndependencies and unify them with the overrides provided by Monorepo.","routePath":"/module-tools/en/guide/faq/test","lang":"en","toc":[{"text":"Execute `test` command with an error `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`","id":"execute-test-command-with-an-error-typeerror-cannot-read-property-testenvironmentoptions-of-undefined","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":35,"title":"Quick Start","content":"#\n\n\n3 minute demo#\n\nWant to experience Modern.js Module in action? The only prerequisite you need is\nNode.js LTS and make sure your Node version is >= 16.0.0.We recommend using the\nLTS version of Node.js 18.\n\n\nCreate new project#\n\nIf you want to create a complete Modern.js Module, you can execute the following\ncommand:\n\n\n\nINFO\n\nExecute npx @modern-js/create -h for more command line arguments\n\nNext, in the issue interaction, follow the options below.\n\n\n\n> The project name is the value of the \"name\" field in package.json.\n\nThen the process of initializing the project will start. After the project\ndirectory and files are generated and the dependencies are installed, a complete\nmodule project is created.\n\nWe can start the project build directly with the pnpm build command, and start\nthe build in watching mode with the pnpm build --watch command.\n\n\nAdd to an existing project#\n\nFrom your shell, install the following dependencies in your project.\n\n * @modern-js/module-tools\n * \"typescript\" (omitted if not a TypeScript project)\n\n> If it's a TypeScript project, add the \"typescript\" dependency.\n\n> For projects that use pnpm or the Yarn package manager, just replace npm. pnpm\n> is recommended.\n\nNext, create the modern.config.(t|j)s file in the root of the project.\n\n\n\nFinally, add the command \"build\": \"modern build\" to the project's package.json\nfile.\n\n\n\nIf your project has a src/index.(js|jsx) file or both src/index.(ts|tsx) and\ntsconfig.json files, then congratulations you can run the npm run build command\ndirectly to build your project with Modern.js Module.\n\n\nCore npm Package#\n\n@modern-js/module-tools is the core npm package of Modern.js Module, providing\nthe following capabilities:\n\n * It offers commonly used CLI commands such as modern dev, modern build, and\n more.\n * It integrates Modern.js Core, providing capabilities for configuration\n parsing, plugin loading, and more.\n * It integrates esbuild and SWC, providing build capabilities.\n * It integrates some commonly used plugins, such as plugin-lint,\n plugin-changeset, and others.\n\n@modern-js/module-tools is implemented based on the plugin system of Modern.js.\nEssentially, it is a plugin. Therefore, you need to register moduleTools in the\nplugins field of the configuration file:\n\n\n\n\nView official example#\n\nIf you want to see the complete project using the Modern.js Module, you can\nexecute the following command.\n\n\n\n\nLet's get started#\n\nChoose your tutorial scenario...\n\n * I'm a beginner and need to learn basic usage of Modern.js Module.\n * I have learned the basic usage of Modern.js Module and can learn advanced\n usage of Modern.js Module.\n * I need to expand my project capabilities and need to learn how to develop\n plugins for Modern.js Module.","routePath":"/module-tools/en/guide/intro/getting-started","lang":"en","toc":[{"text":"3 minute demo","id":"3-minute-demo","depth":2,"charIndex":3},{"text":"Create new project","id":"create-new-project","depth":3,"charIndex":209},{"text":"Add to an existing project","id":"add-to-an-existing-project","depth":3,"charIndex":855},{"text":"Core npm Package","id":"core-npm-package","depth":3,"charIndex":1577},{"text":"View official example","id":"view-official-example","depth":3,"charIndex":2272},{"text":"Let's get started","id":"lets-get-started","depth":2,"charIndex":2407}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":36,"title":"Welcome to Modern.js Module","content":"#\n\nModern.js Module is a modules engineering solution for Modern.js, as well as a\ncore dependency. It allows developers to build, debug, and publish module type\nproject more easily. A module type project can mostly be thought of as an npm\npackage type project, which may be a component, component library or tool\nlibrary project.\n\nIf you are planning to develop a project of the npm package type, then you came\nto the right place! Modern.js provides a professional Modern.js Module. It gives\nyou:\n\n * Simple project initialization: simply execute the npx @modern-js/create\n project-dir command, followed by a few interactive questions, to create a\n complete module type project. The created project also supports the choice of\n two package managers, pnpm and Yarn.\n * Code formatting: In Modern.js Module, you can execute modern lint to format\n the code. The initialized module project includes the ESLint ruleset for\n Modern.js for most scenarios.\n * Comprehensive build capabilities and faster builds: Modern.js Module provides\n high-performance build capabilities based on esbuild and SWC, and provides\n rich configurations for different build scenarios.\n * Storybook debugging tools: Modern.js Module provides Storybook debugging\n tools for debugging module projects. After installing the Storybook plugin\n for Modern.js Module, you can start it with the storybook dev command. You\n can use Storybook not only for debugging components, but also for other types\n of modules.\n * Testing capabilities with Jest: When you need to test a module, you can use\n the modern test command of Modern.js Module, which not only integrates with\n Jest, but also provides an API for configuring Jest.\n * Versioning based on Changesets: When you need to record changes to a project,\n you can use the modern change command to generate a Markdown file containing\n the changes; when you need to upgrade a project, you can use the modern bump\n command to analyze and upgrade the version through the Markdown file; when\n you need to release a project, you can use the modern release command to\n release the project; Modern.js Module implements these commands based on\n Changesets.\n * Extensible plugin mechanism: Want to integrate additional debugging tools for\n your project? Or maybe you want to do some extra processing during the build\n process, Modern.js Module provides a plugin mechanism and plugin hooks that\n cover both the dev command and the build command process. You can use them to\n extend the capabilities of your project.\n * Lots more! Modern.js Module will continue to optimize its build and debug\n features in the future. If there are important issues to be solved in module\n project building, or if a mainstream module project debugging tool or pattern\n emerges, then they will probably be supported by Modern.js Module.","routePath":"/module-tools/en/guide/intro/welcome","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":37,"title":"Why you need Modern.js Module","content":"#\n\nYou've probably all experienced it: when developing a component library or tool\nlibrary from scratch, we have to consider not only how to write the code logic\nof the project itself, but also how to build, debug, test, format the code, and\nother things that have nothing to do with the code logic.\n\nFor example, when we consider which builder is used to build the code for a\nmodule project, we might previously consider webpack or Rollup, but now we might\nalso consider esbuild or SWC.\n\nRegardless of which builder is chosen, this is going to be a costly learning\ncurve for developers who are not skilled in the use of these build tools. Even\nif you want to use them quickly, it will take a lot of time and effort.\n\nIn addition to the build, things like providing debugging tools for projects,\nsupporting testing capabilities, adding code format validation, etc. can take a\nlong time and effort for a novice to understand or master them and actually\nserve the current project.\n\nTo ensure the quality of the code and the integrity of the project, we often\nneed to do these things that are not related to the logical implementation of\nthe code. However, these things are likely to affect the overall project\ndevelopment progress, reduce the developer's development experience, and make\nthe developer feel that the development threshold of the module project is very\nhigh.\n\nIf you have to go through all this work every time you develop a module type\nproject, you will spend most of your development time in the beginning on these\nthings that are not related to code implementation. If we could provide a module\nengineering solution that would help developers to solve the project engineering\nissues and allow them to focus more on code implementation, it would greatly\nimprove the module type project development experience.\n\n\n\nModern.js, in order to make developing module type projects easier, provides a\nmodule engineering solution in order to solve the above mentioned problems and\nprovides the main features using Modern.js Module. Modern.js Module can be\nunderstood as a tool dedicated to the development of module type projects.","routePath":"/module-tools/en/guide/intro/why-module-engineering-solution","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":39,"title":"Quick Start","content":"#\n\nModern.js Module not only provides a rich set of features, but also supports\nextending the capabilities of the current project by way of plugins.\n\nWe can quickly see how to write a Modern.js Module plugin by using the following\nexample.\n\n 1. First we create . /plugins/example.ts file under the initialized project.\n\n\n\n 2. Next add the code for the plugin to the example.ts file.\n\n\n\n 3. Then we register the plugin we just wrote via the plugins API.\n\n\n\n 4. Finally, run modern build and you will see:\n\n\n\nWith the above example, we learned the following things.\n\n * The recommended plugin directory structure\n * The initialization code of the plugin\n * Plugin registration\n\nIn addition to the above, we also need to understand.\n\n * plugin objects, type definitions and recommended configuration options\n * setup functions, api object parameters, lifecycle hooks","routePath":"/module-tools/en/plugins/guide/getting-started","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":40,"title":"Plugin Object","content":"#\n\nThe Modern.js Module plugin is an object, and the object contains the following\nproperties.\n\n * name: The name of the plugin, a unique identifier.\n * setup: plugin initialization function, which will be executed only once.\n setup function can return a Hooks object, and Modern.js Module will execute\n the function corresponding to the Hook defined on the Hooks object at a\n specific time.\n\nFor example, in the following plugin code example, the beforeBuild function is\ntriggered before the project starts the build task and the build start log is\nprinted.\n\n\n\n\n\n\nPlugin type definitions#\n\nWhen using TypeScript, you can introduce the built-in CliPlugin and ModuleTools\ntypes to provide the correct type derivation for plugins: ``\n\n\n\n\nPlugin configuration options#\n\nIt is recommended to write the plugin as a function, so that the plugin can\nreceive configuration options via function entry.\n\n","routePath":"/module-tools/en/plugins/guide/plugin-object","lang":"en","toc":[{"text":"Plugin type definitions","id":"plugin-type-definitions","depth":2,"charIndex":570},{"text":"Plugin configuration options","id":"plugin-configuration-options","depth":2,"charIndex":741}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":41,"title":"Setup function","content":"#\n\nIn the \"Plugin object\" section we know that the plugin object contains a setup\nfunction that not only contains an api object parameter, but also returns a\nHooks object.\n\n\nPlugin API objects#\n\nThe setup function of the plugin will provide an api object parameter, and you\ncan call some of the methods provided on this object to get information about\nthe configuration, project context, etc.\n\n\n\n\napi.useAppContext#\n\nUsed to get project context information.\n\n\n\nINFO\n\nThrough the actual type file, we can see that there are some additional fields.\nHowever, for Modern.js Module, the fields mentioned above are the only ones that\nare meaningful. The same applies to other methods of the api object.\n\n\napi.useResolvedConfigContext#\n\nUsed to get the final configuration after parsing.\n\nINFO\n\nIf you need to get the build-related final configuration, you need to use the\nbeforeBuild Hook.\n\n\n\n\napi.useHookRunners#\n\nUsed to get the executors of Hooks and trigger the execution of a specific Hook.\n\n\n\n\nAsynchronous setup#\n\nThe setup of a CLI plugin can be an asynchronous function that performs\nasynchronous logic during the initialization process.\n\n\n\nNote that the setup function of the next plugin is not executed until the async\nsetup function of the current plugin has finished. Therefore, you should avoid\nperforming time-consuming asynchronous operations in the setup function to avoid\nslowing down the startup performance of the CLI.\n\n\nLife cycle hooks#\n\nWe know that the setup function returns a Hooks object, which can also be\nunderstood as an object with Modern.js Module lifecycle hooks.\n\nCurrently there are two main types of hooks.\n\n * build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * debug hooks: hooks that are triggered when running the dev command.\n\nSee the API documentation for a full list of lifecycle hooks.","routePath":"/module-tools/en/plugins/guide/setup-function","lang":"en","toc":[{"text":"Plugin API objects","id":"plugin-api-objects","depth":2,"charIndex":173},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"Asynchronous setup","id":"asynchronous-setup","depth":2,"charIndex":993},{"text":"Life cycle hooks","id":"life-cycle-hooks","depth":2,"charIndex":1434}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":42,"title":"Overview","content":"#\n\n\nOfficial Plugins#\n\n * @modern-js/plugin-module-import:Use SWC to provide the same ability as\n babel-plugin-import.\n * @modern-js/plugin-module-banner:Add custom content, such as copyright\n information, to the top and bottom of each JS and CSS file.\n * @modern-js/plugin-module-node-polyfill: Inject Polyfills of Node core modules\n in the browser side.\n * @modern-js/plugin-module-polyfill:Inject polyfill for unsupported features\n used in your code.\n * @modern-js/plugin-module-babel:Use Babel to transform your code.\n * @modern-js/plugin-module-vue:Support for Vue component.","routePath":"/module-tools/en/plugins/official-list/overview","lang":"en","toc":[{"text":"Official Plugins","id":"official-plugins","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":43,"title":"Babel Plugin","content":"#\n\nTIP\n\nNormally, we don't need to use Babel to transform our code, this plugin is only\nused as a downgrade.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nYou can also configure the registration via hooks, for example, if you need to\nbundle two files A and B at the same time and only need to use babel when bundle\nA:\n\n\n\n\nConfig#\n\nSee babel options.\n\nHere is an example with @babel/preset-env configured\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-babel","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":110},{"text":"Install","id":"install","depth":3,"charIndex":125},{"text":"Register","id":"register","depth":3,"charIndex":136},{"text":"Config","id":"config","depth":2,"charIndex":372}],"domain":"","frontmatter":{},"version":""},{"id":44,"title":"Banner Plugin","content":"#\n\nProvide the ability to inject content at the top and bottom of each JS and CSS\nfile.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nTIP\n\nNote: CSS comments do not support the //comment syntax. Refer to \"CSS Comments\"\n\n\nExample#\n\n\nAdd copyright information at the top of a JS file#\n\n\n\n\nConfiguration#\n\n * Type\n\n\n\n\nbanner#\n\nAdd content at the top.\n\n * banner.js: Add content at the top of a JS file.\n * banner.css: Add content at the top of a CSS file.\n\n\nfooter#\n\nAdd content at the bottom.\n\n * footer.js: Add content at the bottom of a JS file.\n * footer.css: Add content at the bottom of a CSS file.","routePath":"/module-tools/en/plugins/official-list/plugin-banner","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":89},{"text":"Install","id":"install","depth":3,"charIndex":104},{"text":"Register","id":"register","depth":3,"charIndex":115},{"text":"Example","id":"example","depth":2,"charIndex":271},{"text":"Add copyright information at the top of a JS file","id":"add-copyright-information-at-the-top-of-a-js-file","depth":3,"charIndex":282},{"text":"Configuration","id":"configuration","depth":2,"charIndex":337},{"text":"banner","id":"banner","depth":3,"charIndex":365},{"text":"footer","id":"footer","depth":3,"charIndex":505}],"domain":"","frontmatter":{},"version":""},{"id":45,"title":"Import Plugin","content":"#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\n\nTIP\n\nSince @modern-js/module-tools version >= 2.16.0, this plugin functionality is\nbuilt into Modern.js Module and is provided by transformImport.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nThis way we can use the ability of automatic import in Modern.js Module.\n\n\nConfigurations#\n\n * Type:\n\n\n\n\npluginImport#\n\n * Type: object[]\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\n\nNotes#\n\nSWC (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC\nand ported from babel-plugin-import. The configuration options remain\nconsistent.\n\nSome configurations can be passed in as functions, such as customName,\ncustomStyleName, etc., but in Modern.js Module, we do not recommend using\nfunctions in these configuration items. Because we will call SWC in the esbuild\nplugin, and then when Rust calls these configuration functions through Node-API,\na deadlock will occur.\n\nSimple function logic can actually be replaced by template language. Below is an\nexample of using a template with customName:\n\n\n\nAdd the following configuration on the right-hand side:\n\n\n\nThe {{ member }} in it will be replaced with the corresponding import member.\nAfter transformation:\n\n\n\nTemplate customName: 'foo/es/{{ member }}' is the same as customName: (member)\n=> `foo/es/${member}` , but template value has no performance overhead of\nNode-API.\n\nThe template used here is handlebars. There are some useful builtin tools, Take\nthe above import statement as an example:\n\n\n\nTransformed to:\n\n\n\nIn addition to kebabCase, there are cameraCase, snakeCase, upperCase and\nlowerCase can be used as well.","routePath":"/module-tools/en/plugins/official-list/plugin-import","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":230},{"text":"Install","id":"install","depth":3,"charIndex":245},{"text":"Register","id":"register","depth":3,"charIndex":256},{"text":"Configurations","id":"configurations","depth":2,"charIndex":413},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":443},{"text":"Notes","id":"notes","depth":2,"charIndex":602}],"domain":"","frontmatter":{},"version":""},{"id":46,"title":"Node Polyfill Plugin","content":"#\n\nAbout Node Polyfill\n\nNormally, we don't need to use Node libs on the browser side. However, it is\npossible to use some Node libs when the code will run on both the Node side and\nthe browser side, and Node Polyfill provides browser versions of polyfills for\nthese Node libs.\n\nBy using the Node Polyfill plugin, Node core libs polyfills are automatically\ninjected into the browser-side, allowing you to use these modules on the browser\nside with confidence.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nConfigurations#\n\n * Type:\n\n\n\n\nexclude#\n\nExclude the Node Polyfill to be injected.\n\n\n\n\noverrides#\n\nOverride the built-in Node Polyfill.\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\nWhen the above global variables are used directly in code, the corresponding\npolyfill will be injected.\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\nWhen the above module is referenced in code via import / require syntax, the\ncorresponding polyfill will be injected.\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\nCurrently there is no polyfill for the above modules on the browser side, so\nwhen you import the above modules, it will automatically fallback to an empty\nobject.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-node-polyfill","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":460},{"text":"Install","id":"install","depth":3,"charIndex":475},{"text":"Register","id":"register","depth":3,"charIndex":486},{"text":"Configurations","id":"configurations","depth":2,"charIndex":569},{"text":"exclude","id":"exclude","depth":3,"charIndex":599},{"text":"overrides","id":"overrides","depth":3,"charIndex":655},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":708},{"text":"Globals","id":"globals","depth":3,"charIndex":726},{"text":"Modules","id":"modules","depth":3,"charIndex":877},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":1336}],"domain":"","frontmatter":{},"version":""},{"id":47,"title":"Polyfill Plugin","content":"#\n\nTIP\n\nNormally, we don't need to inject polyfill for npm packages, this step should be\ndone on the web application framework side, but in some scenarios we need to\ninject polyfill in order to make our library run directly in low version\nbrowsers.\n\nNote that this plugin does not transform your code syntax, it only injects\npolyfill for unsupported functions used in your code, importing them as normal\nfunctions instead of polluting the global. You need to install the core-js-pure\ndependency.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nYou can also configure registration via hooks, for example, if you have multiple\nbuild configurations at the same time and only need to inject the polyfill when\nbundle:\n\n\n\n\nConfig#\n\n * Type\n\n\n\n\ntargets#\n\nSee Babel target.\n\nThis is a example.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-polyfill","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":497},{"text":"Install","id":"install","depth":3,"charIndex":512},{"text":"Register","id":"register","depth":3,"charIndex":523},{"text":"Config","id":"config","depth":2,"charIndex":778},{"text":"targets","id":"targets","depth":3,"charIndex":799}],"domain":"","frontmatter":{},"version":""},{"id":48,"title":"Vue Plugin","content":"#\n\nThe Vue plugin provides support for building Vue 3 components. The plugin\ninternally integrates esbuild-plugin-vue3 and @vue/babel-plugin-jsx。\n\nWARNING\n\nNotice that we have some limitation:\n\n 1. The current implementation of this plugin integrates directly with the\n community plugin and therefore does not support writing jsx/tsx in sfc.\n 2. If you want to generate d.ts for the components, please use the official\n recommendation vue-tsc.\n 3. Only support bundle, we recommend to set input to ['src/**/*.vue'] or\n ['src/index.ts'].\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nOptions#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\nOptions passed to @vue/babel-plugin-jsx, please refer to the\n@vue/babel-plugin-jsx documentation for detailed usage.","routePath":"/module-tools/en/plugins/official-list/plugin-vue","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":547},{"text":"Install","id":"install","depth":3,"charIndex":562},{"text":"Register","id":"register","depth":3,"charIndex":573},{"text":"Options","id":"options","depth":2,"charIndex":656},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":667}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file diff --git a/modern-js/module-tools/static/search_index.zh.678be30e.json b/modern-js/module-tools/static/search_index.zh.10a5690c.json similarity index 52% rename from modern-js/module-tools/static/search_index.zh.678be30e.json rename to modern-js/module-tools/static/search_index.zh.10a5690c.json index 1df1d745ea..302484e730 100644 --- a/modern-js/module-tools/static/search_index.zh.678be30e.json +++ b/modern-js/module-tools/static/search_index.zh.10a5690c.json @@ -1 +1 @@ -[{"id":49,"title":"buildConfig","content":"#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项,它包含了构建的所有配置。\n\n * 类型:object | object[]\n\nTIP\n\n在开始使用 buildConfig 之前,请先阅读以下文档来了解其作用:\n\n * 修改输出产物\n * 深入理解构建\n\n\nalias#\n\n * 类型:Record | Function\n * 默认值:{'@': 'src',}\n\nTIP\n\n对于 TypeScript 项目,只需要在 tsconfig.json 中配置 compilerOptions.paths, Modern.js Module\n会自动识别 tsconfig.json 里的别名,因此不需要额外配置 alias 字段。\n\n\n\n以上配置完成后,如果在代码中引用 @common/Foo.tsx, 则会映射到 /src/common/Foo.tsx 路径上。\n\nalias 的值定义为函数时,可以接受预设的 alias 对象,并对其进行修改。\n\n\n\n也可以在函数中返回一个新对象作为最终结果,新对象会覆盖预设的 alias 对象。\n\n\n\n\nasset#\n\n包含静态资源相关的配置。\n\n\nasset.name#\n\n静态资源输出文件名。\n\n * 类型: string | ((assetPath) => name)\n * 默认值: [name].[hash].[ext]\n\n当 asset.name 为 string 类型时,会自动对 [name]、[ext]、[hash] 进行替换,分别替换为文件名、拓展名、文件 hash。\n如果想要更高的自由度,可以把 asset.name 作为方法使用,返回值即为文件名。此时,该方法接收一个参数 assetPath,对应资源路径。\n\n\n\n\nasset.limit#\n\n用于设置静态资源被自动内联为 base64 的体积阈值。\n\nModern.js Module 在进行打包时,默认会内联体积小于 10KB 的图片、字体、媒体等资源,将它们通过 Base64\n编码,并内联到产物中,不再会发送独立的 HTTP 请求。\n\n你可以通过修改 limit 参数来调整这个阈值。\n\n * 类型: number\n * 默认值: 10 * 1024\n\n例如,将 limit 设置为 0 来避免资源内联:\n\n\n\n\nasset.path#\n\n静态资源输出路径,会基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: assets\n\n\nasset.publicPath#\n\n打包时给未内联资源的 CDN 前缀。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n此时,所有静态资源都会添加 https://xxx/ 前缀。\n\n\nasset.svgr#\n\n打包时将 SVG 作为一个 React 组件处理,options 参考 svgr,另外还支持了 include 和 exclude\n两个配置项,用于匹配需要处理的 SVG 文件。\n\n * 类型: boolean | object\n * 默认值: false\n\n开启 svgr 功能后,可以使用默认导出的方式将 SVG 当做组件使用。\n\n\n\n当开启功能后,可以新建一个类型描述文件,并在 modern-app-env.d.ts 文件中增加,修改使用 SVG 的类型:\n\n\n\n\n\n\nasset.svgr.include#\n\n设定匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: /\\.svg$/\n\n\nasset.svgr.exclude#\n\n设定不匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: undefined\n\n\nasset.svgr.exportType#\n\n用于配置使用 SVGR 时 SVG 的导出形式。\n\n * 类型: 'named' | 'default'\n * 默认值: default\n\n当此选项设置为 'named' 时,你可以使用以下语法导入组件:\n\n\n\n命名导出默认为 ReactComponent,并可以通过 asset.svgr.namedExport 进行自定义。\n\n\nautoExtension#\n\n根据 format 和 type 自动添加产物里 js 文件和类型描述文件的后缀。\n\n * 类型:boolean\n * 默认值:false\n * 版本:>=2.38.0\n\n关闭时,js 产物后缀为 .js,类型描述文件后缀为 d.ts。\n\n开启后,当 type 为 module 时,node 默认将 .js 作为 esm 加载,因此当我们要输出 cjs 产物时,js 产物后缀为\n.cjs,类型描述文件后缀为 d.cts; 反之,如果缺少 type 字段或者 type 为 commonjs 时, node 默认将 .js 文件作为 cjs\n加载,因此当我们要输出 esm 产物时,js 产物后缀为 .mjs,类型描述文件后缀为 d.mts。\n\nWARNING\n\n在 bundleless 模式下使用时,我们会有一步额外的操作,那就是处理每个文件里的 import/export 语句。我们会给相对路径加上 js\n文件后缀,可能是 .mjs 或者 .cjs,这取决于你的包配置,此行为可以通过 redirect.autoExtension关闭。\n\n注意 noUselessIndex 规则会破坏此行为,你需要禁用此规则 如果你需要在 bundleless 使用此配置,请补齐 index,例如 utils\n是一个文件夹, 你需要将 改写为\n\n\n\n\nautoExternal#\n\n自动外置项目的 \"dependencies\" 和 \"peerDependencies\",不会将其打包到最终的 bundle 产物中。\n\n * 类型: boolean | object\n * 默认值: true\n\n当我们希望关闭对于第三方依赖的默认处理行为时候,可以通过以下方式来实现:\n\n\n\n这样对于 \"dependencies\" 和 \"peerDependencies\" 下面的依赖都会进行打包处理。如果只想要关闭其中某个下面的依赖处理,则可以使用\nbuildConfig.autoExternal 的对象形式:\n\n\n\n\nautoExternal.dependencies#\n\n是否需要外置项目的 \"dependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nautoExternal.peerDependencies#\n\n是否需要外置项目的 \"peerDependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nbanner#\n\n提供为每个 JS , CSS 和 DTS 文件的顶部和底部注入内容的能力。\n\n\n\n * 类型: BannerAndFooter\n * 默认值: {}\n * 版本: >=2.36.0\n\n例如你想为 JS 和 CSS 文件添加版权信息:\n\n\n\n\nbuildType#\n\n构建类型,bundle 会打包你的代码,bundleless 只做代码的转换。\n\n * 类型: 'bundle' | 'bundleless'\n * 默认值: 'bundle'\n\n\ncopy#\n\n将文件或目录拷贝到指定位置。\n\n * 类型: object\n\n\n\n\ncopy.patterns#\n\n * 类型: CopyPattern[]\n * 默认值: []\n\n\n\n\ncopy.options#\n\n * 类型:\n\n\n\n * 默认值: { concurrency: 100, enableCopySync: false }\n\n * concurrency: 指定并行执行多少个复制任务。\n\n * enableCopySync: 使用 fs.copySync,默认情况下 fs.copy。\n\n\ndefine#\n\n定义全局变量,注入到代码中\n\n * 类型: Record\n * 默认值: {}\n\n由于 define 功能是由全局文本替换实现的,所以需要保证全局变量值为字符串,更为安全的做法是将每个全局变量的值转化为字符串,如下所示:\n\nINFO\n\n框架内部会自动进行 JSON 序列化处理,因此不需要手动执行序列化。\n\n如果不需要自动序列化,可以通过配置 esbuildOptions 定义 alias 来实现。\n\n\n\n不过要注意:如果项目是一个 TypeScript 项目,那么你可能需要在项目源代码目录下的 .d.ts 文件里增加以下内容:\n\n> 如果不存在 d.ts 文件,则可以手动创建。\n\n\n\n我们也可以进行环境变量替换:\n\n\n\n通过上面的配置,我们就可以将下面这段代码:\n\n\n\n在执行 VERSION=1.0.0 modern build 的时候,转换为:\n\n\n\nTIP\n\n为了防止全局替换替换过度,建议使用时遵循以下两个原则:\n\n * 全局常量使用大写\n * 自定义全局常量前缀后缀,确保独一无二\n\n\ndts#\n\n类型文件生成的相关配置,默认情况会生成。\n\n * 类型: false | object\n * 默认值:\n\n\n\n\ndts.abortOnError#\n\n用于控制在出现类型错误的时候,是否允许构建成功。\n\n * 类型:boolean\n * 默认值:true\n\n默认情况下,在出现类型错误的时候会导致构建失败。将 abortOnError 设置为 false 后,即使代码中出现了类型问题,构建依然会成功:\n\n\n\nWARNING\n\n当关闭该配置后,无法保证类型文件能正常生成,且不保证内容正确。在 buildType: 'bundle' 时,即打包模式下,类型文件一定不会生成。\n\n\ndts.distPath#\n\n类型文件的输出路径,基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: ./\n\n比如输出到 outDir 下面的 types 目录:\n\n\n\n\ndts.enableTscBuild#\n\n开启 tsc '--build' 选项。当使用 project reference 时, 可以使用 '--build'\n选项以实现项目之间的协同工作以加快构建速度。\n\n此选项要求版本 > 2.43.0, 事实上,我们在 2.42.0 版本曾试验性地开启此选项,但其带来的许多问题使我们不得不动态开启。\n\n\n\n * 类型: boolean\n * 默认值: false\n * 版本: >2.43.0\n\n\n\n\ndts.only#\n\n是否在构建时只生成类型文件,不生成 JavaScript 产物文件。\n\n * 类型: boolean\n * 默认值: false\n\n\n\n\ndts.respectExternal#\n\n当设为 false 时,不会打包任何三方包类型,设为 true 时,会根据 externals 来决定是否需要打包三方类型。\n\n在对类型文件进行打包时,构建工具还未对 export\n进行分析,因此当你引用的任何一个三方包出现类型错误时,都可能会中断当前的构建流程,这会导致构建流程不可控,因此我们可以通过这个配置来避免该问题。\n\n * 类型: boolean\n * 默认值: true\n\n\n\n\ndts.tsconfigPath#\n\n废弃,使用 tsconfig 配置替代。\n\n指定用于生成类型文件的 tsconfig 文件路径。\n\n\n\n\nesbuildOptions#\n\n用于修改底层的 esbuild 配置。\n\n * 类型: Function\n * 默认值: c => c\n\n例如,我们需要修改生成文件的后缀:\n\n\n\n例如,注册一个 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\nTIP\n\n我们在原本 esbuild 构建的基础上做了许多扩展,因此使用此配置需要注意以下几点:\n\n 1. 优先使用 Modern.js Module 提供的配置,例如 esbuild 并不支持 target: 'es5',但我们内部使用 SWC\n 支持了此场景,此时通过 esbuildOptions 设置target: 'es5'会报错。\n 2. 目前我们内部使用 enhanced-resolve 替代了 esbuild 的 resolve 解析算法,所以修改 esbuild resolve\n 相关配置无效,计划在未来会切换回来。\n\n\nexternalHelpers#\n\n默认情况下,输出的 JS 代码可能会依赖一些辅助函数来支持目标环境或者输出格式,这些辅助函数会被内联在需要它的文件中。\n\n使用此配置,将会使用 SWC 对代码进行转换,将内联的辅助函数转换为从外部模块 @swc/helpers 导入这些辅助函数。\n\n * 类型:boolean\n * 默认值:false\n\n下面是使用该配置前后的产物变化比较。\n\n开启前:\n\n\n\n开启后:\n\n\n\n\nexternals#\n\n用于在打包时排除一些外部依赖,避免将这些依赖打包到最终的 bundle 中。\n\n * 类型:\n\n\n\n * 默认值: []\n * 构建类型:仅支持 buildType: 'bundle'\n * 示例:\n\n\n\n\nfooter#\n\n同 banner 配置,用于在输出文件末尾添加注释。\n\n\nformat#\n\n用于设置 JavaScript 产物输出的格式,其中 iife 和 umd 只在 buildType 为 bundle 时生效。\n\n * 类型:'esm' | 'cjs' | 'iife' | 'umd'\n * 默认值:cjs\n\n\nformat: esm#\n\nesm 代表 \"ECMAScript 模块\",它需要运行环境支持 import 和 export 语法。\n\n * 示例:\n\n\n\n\nformat: cjs#\n\ncjs 代表 \"CommonJS\",它需要运行环境支持 exports、require 和 module 语法,通常为 Node.js 环境。\n\n * 示例:\n\n\n\n\nformat: iife#\n\niife 代表 \"立即调用函数表达式\",它将代码包裹在函数表达式中,确保代码中的任何变量不会意外地与全局范围中的变量冲突,通常在浏览器环境中运行。\n\n * 示例:\n\n\n\n\nformat: umd#\n\numd 代表 \"Universal Module Definition\",用于在不同环境(浏览器、Node.js 等)中运行。umd\n格式的模块可以在多种环境下使用,既可以作为全局变量访问,也可以通过模块加载器(如 RequireJS)进行模块化加载。\n\n * 示例:\n\n\n\n\nhooks#\n\n构建生命周期钩子,允许在构建流程的特定阶段注入自定义逻辑。\n\n * 类型:\n\n\n\n * 默认值:[]\n\n我们可以在 apply 方法里拿到 compiler 实例,修改其属性,以及在不同阶段执行自定义逻辑,对于 Hook 的详细介绍, 参考使用 Hook\n介入构建流程。\n\n\n\n\ninput#\n\n指定构建的入口文件,数组形式可以指定目录。\n\n * 类型:\n\n\n\n * 默认值:bundle 模式下默认为 ['src/index.ts'],bundleless 模式下默认为 ['src']\n\n数组用法:\n\n在 bundle 模式下,下面的配置会以 src/index.ts 和 src/index2.ts 为入口分别进行构建。bundle 模式不支持配置 input\n为目录。\n\n\n\n在 bundleless 模式下,下面的配置会同时处理 src/a 目录下的文件和 src/index.ts 文件。\n\n\n\n在 bundleless 模式下,数组模式还支持使用 ! 来过滤部分文件:\n\n\n\n上面的配置将打包 src 目录下的文件,同时会过滤以 spec.ts 为后缀的文件。这在测试文件与源码文件在同一个根目录下的情况会很有用。\n\n对象用法:\n\n当在 bundle 模式下需要修改产物的输出文件名称的时候,可以使用对象形式进行配置。\n\n对象的 Key 是产物的文件名称,Value 是源码的文件路径。\n\n\n\n\njsx#\n\n指定 JSX 的编译方式,默认支持 React 17 及更高版本,自动注入 JSX 运行时代码。\n\n * 类型: automatic | transform | preserve\n * 默认值: automatic\n\n如果你需要支持 React 16,则可以设置 jsx 为 transform:\n\n\n\nTIP\n\n如果你不需要转换 JSX ,可以设置 jsx 为 preserve, 但此时请不要使用 swc 做代码转换。 关于 JSX Transform\n的更多说明,可以参考以下链接:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\n这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。\n\n * 类型:boolean\n * 默认值:false\n * 构建类型:仅支持 buildType: 'bundle'\n\n开启 metafile 生成:\n\n\n\n在执行 build 构建后,产物目录下会生成 metafile-[xxx].json 文件,你可以通过 esbuild analyze 和\nbundle-buddy 等工具进行可视化分析。\n\n\nminify#\n\n使用 esbuild 或者 terser 压缩代码,也可以传入 terserOptions。\n\n * 类型: 'terser' | 'esbuild' | false | object\n * 默认值: false\n\n\n\n\noutDir#\n\n指定构建的输出目录。\n\n * 类型: string\n * 默认值: ./dist\n\n\n\n\nplatform#\n\n默认生成用于 Node.js 环境下的代码,你也可以指定为 browser,会生成用于浏览器环境的代码。 查看esbuild.platform了解更多。\n\n * 类型: 'browser' | 'node'\n * 默认值: 'node'\n\n\n\n\nredirect#\n\n在 buildType: 'bundleless' 构建模式下,会对引用路径进行重定向,确保指向了正确的产物,例如:\n\n * import './index.less' 会被改写成 import './index.css'\n * 会被改写成 (依实际情况而定)\n * 会被改写成 (如果生成了 utils.mjs,视实际情况而定)\n\n在某些场景下,你可能不需要这些功能,那么可以通过此配置关闭它,关闭后,其引用路径将不会发生改变。\n\n\n\n\nresolve#\n\n自定义模块解析选项\n\n\nresolve.mainFields#\n\npackage.json 中,在解析包的入口点时尝试的字段列表。\n\n * 类型:string[]\n * 默认值:取决于platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * 版本:>=2.36.0\n\n例如,我们想要先加载 js:source 字段:\n\n\n\nWARNING\n\nresolve.mainFields 比 package.json 中 exports 字段的优先级低,如果一个入口点从 exports\n成功解析,resolve.mainFields 将被忽略。\n\n\nresolve.jsExtentions#\n\n支持隐式文件扩展名\n\n * 类型: string[]\n * 默认值: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * 版本:>=2.36.0\n\n对于 css 文件,请不要使用隐式文件扩展名,目前 Module 仅支持 ['.less', '.css', '.sass', '.scss'] 后缀。\n\nNode 的解析算法不会将 .mjs 和 cjs 视为隐式文件扩展名,因此这里默认也不会,但是可以通过更改此配置来包含:\n\n\n\n\nshims#\n\n在构建 cjs / esm 产物时注入一些垫片代码。\n\n例如 __dirname 只能在 commonjs 里使用,开启此选项后,当产物格式为 esm 时,会将 __dirname 编译为\npath.dirname(fileURLToPath(import.meta.url))。\n\n详细代码见 shims, 需要注意的是 esm shims 只会在 platform 为 node 时注入,因为用到了 url 模块。\n\n * 类型: boolean\n * 默认值: false\n * 版本:>=2.38.0\n\n\n\n\nsideEffects#\n\n配置模块的副作用\n\n * 类型: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * 默认值: undefined\n\n通常情况下,我们通过 package.json 的 \"sideEffects\" 字段来配置模块的副作用,但是在某些情况下,三方包的 package.json\n是不可靠的。 例如我们引用了一个三方包的样式文件。\n\n\n\n但是这个三方包的 package.json 里并没有将样式文件配置到 \"sideEffects\" 里。\n\n\n\n同时你又设置了 style.inject 为 true,在控制台可以看到类似的警告信息:\n\n\n\n这时候就可以使用这个配置项,手动配置模块的\"sideEffects\",配置支持正则和函数形式。\n\n\n\nTIP\n\n添加此配置后,打包时将不会再读取 package.json 里的 \"sideEffects\" 字段。\n\n\nsourceDir#\n\n指定构建的源码目录,默认为 src,用于在 bundleless 构建时基于源码目录结构生成对应的产物目录。 等同于esbuild.outbase。\n\n * 类型: string\n * 默认值: src\n\n\nsourceMap#\n\n控制 sourceMap 如何生成。\n\n * 类型: boolean | 'inline' | 'external'\n * 默认值: false\n\n\nsourceType#\n\nWARNING\n\n已废弃,此配置不会产生任何影响。\n\n设置源码的格式。默认情况下,会将源码作为 EsModule 进行处理。当源码使用的是 CommonJS 的时候,需要设置 commonjs。\n\n * 类型:'commonjs' | 'module'\n * 默认值:'module'\n\n\nsplitting#\n\n是否开启代码分割。 仅支持 format: 'esm' 和 format: 'cjs',查看esbuild.splitting了解更多。\n\n * 类型: boolean\n * 默认值: false\n\n\nstyle#\n\n配置样式相关的配置。\n\n\nstyle.less#\n\nless 相关配置。\n\n\nstyle.less.lessOptions#\n\n详细配置参考 less。\n\n * 类型: object\n * 默认值: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\n在入口文件起始添加 Less 代码。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n\nstyle.less.implementation#\n\n配置 Less 使用的实现库,在不指定的情况下,使用的内置版本是 4.1.3。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置 object 类型时,可以指定 Less 的实现库。\n\n\n\nstring 类型时,指定 Less 的实现库的路径\n\n\n\n\nsass#\n\nSass 相关配置。\n\n\nstyle.sass.sassOptions#\n\n详细配置参考 node-sass\n\n * 类型: object\n * 默认值: {}\n\n\nstyle.sass.additionalData#\n\n在入口文件起始添加 Sass 代码。\n\n * 类型: string | Function\n * 默认值: undefined\n\n\n\n\nstyle.sass.implementation#\n\n配置 Sass 使用的实现库,在不指定的情况下,使用的内置版本是 1.5.4。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置为 object 类型时,可以指定 Sass 的实现库。\n\n\n\nstring 类型时,指定 Sass 的实现库的路径\n\n\n\n\nstyle.postcss#\n\n用于配置 PostCSS 的选项,传入的值会与默认配置通过 Object.assign 合并。注意 Object.assign 是浅拷贝,因此会完全覆盖内置的\nplugins 数组。\n\n详细配置请查看 PostCSS。\n\n * 类型:\n\n\n\n * 默认值:\n\n\n\n * 示例:\n\n\n\n\nstyle.inject#\n\n配置打包模式下是否将 CSS 样式插入到 JavaScript 代码中。\n\n * 类型: boolean\n * 默认值: false\n\n将 inject 设置为 true 来开启此功能:\n\n\n\n开启后,你会看到源码中引用的 CSS 代码被包含在了打包后的 JS 产物中。\n\n例如,你在源码里写了 import './index.scss',那么在产物中你会看到以下代码:\n\n\n\nTIP\n\n开启 inject 后,你需要注意以下几点:\n\n * CSS 文件中的 @import 不会被处理。如果你的 CSS 文件中有 @import ,那么你需要在 JS 文件中手动引入 CSS\n 文件(less,scss 文件不需要,因为它们会有预处理)。\n * 需要考虑 sideEffects 的影响。默认情况下,我们的构建器会认为 CSS 是有副作用的,如果你的项目中或者三方包的 package.json\n 设置了 sideEffects 字段并且没有包含此 CSS 文件,那么你将会得到一个警告:\n\n\n\n此时可以通过配置 sideEffects 来解决。\n\n\nstyle.autoModules#\n\n根据文件名自动启用 CSS Modules。\n\n * 类型: boolean | RegExp\n * 默认值: true\n\ntrue : 为以 .module.css .module.less .module.scss .module.sass 文件名结尾的样式文件启用 CSS\nModules。\n\nfalse : 禁用 CSS Modules.\n\nRegExp : 为匹配正则条件的所有文件启用 CSS Modules.\n\n\nstyle.modules#\n\nCSS Modules 配置。\n\n * 类型: object\n * 默认值: {}\n\n一个常用的配置是 localsConvention,它可以改变 CSS Modules 的类名生成规则。\n\n\n\n对于以下样式:\n\n\n\n你可以使用 styles.boxTitle 来访问。\n\n详细配置查看 postcss-modules\n\n\nstyle.tailwindcss#\n\n用于修改 Tailwind CSS 的配置项。\n\n * 类型: object | Function\n * 默认值:\n\n\n\n\n启用 Tailwind CSS#\n\n在使用 style.tailwindcss 之前,你需要启用 Modern.js Module 的 Tailwind CSS 插件。\n\n请阅读「使用 Tailwind CSS」 章节来了解开启方式。\n\n\n类型#\n\n值为 object 类型时,与默认配置通过 Object.assign 合并。\n\n值为 Function 类型时,函数返回的对象与默认配置通过 Object.assign 合并。\n\n其他的使用方式和 Tailwind CSS 一致: 快速传送门。\n\n\n注意事项#\n\n注意:\n\n * 如果你同时使用了 tailwind.config.{ts,js} 文件和 tools.tailwindcss 选项,那么\n tools.tailwindcss 定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n * 如果你同时使用了 designSystem 配置项,那么 Tailwind CSS 的 theme 配置将会被 designSystem 的值所覆盖。\n\n其他配置的使用方式与 Tailwind CSS 官方用法一致,请参考 tailwindcss - Configuration。\n\n\ntarget#\n\ntarget 用于为生成的 JavaScript 代码设置目标环境。它让 Modern.js Module 将目标环境无法识别的 JavaScript\n语法转换为在这些环境中可用的低版本 JavaScript 语法。\n\n * 类型:\n\n\n\n * 默认值: 'es6'\n\n例如,将代码编译到 es5 语法:\n\n\n\n\ntransformImport#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现,使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:object[]\n * 默认值:[]\n\n数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n参考「Import 插件——注意事项」\n\n\ntransformLodash#\n\n是否模块化 lodash 的导入,删除未使用的 lodash 模块,从而减少 lodash 代码体积。这项优化基于 babel-plugin-lodash 和\nswc-plugin-lodash 实现。 使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:boolean\n * 默认值:false\n\n当开启此选项时,Modern.js Module 会自动将 lodash 的代码引用指向子路径。\n\n比如:\n\n\n\n转换后的代码:\n\n\n\n\ntsconfig#\n\nTypeScript 配置文件的路径。\n\n * 类型: string\n * 默认值: tsconfig.json\n * 版本: >=2.36.0\n\n\n\n\numdGlobals#\n\n指定 UMD 产物外部导入的全局变量。\n\n * 类型: Record\n * 默认值: {}\n\n\n\n此时,react 和 react-dom 会被看做是外部导入的全局变量,不会被打包进 UMD 产物中,而是通过 global.React 和\nglobal.ReactDOM 的方式进行访问。\n\n\numdModuleName#\n\n指定 UMD 产物的模块名。\n\n * 类型: string | Function\n * 默认值: name => name\n\n\n\n此时 UMD 产物会去挂载到 global.myLib 上。\n\nTIP\n * 需要遵守 UMD 规范,UMD 产物的模块名不能和全局变量名冲突。\n * 模块名会被转换为驼峰命名,如 my-lib 会被转换为 myLib,可参考toIdentifier。\n\n同时函数形式可以接收一个参数,为当前打包文件的输出路径\n\n","routePath":"/module-tools/api/config/build-config","lang":"zh","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":141},{"text":"asset","id":"asset","depth":2,"charIndex":483},{"text":"asset.name","id":"assetname","depth":2,"charIndex":506},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":753},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":981},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":1052},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":1159},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":1411},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":1510},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":1611},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":1802},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":2393},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":2670},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":2758},{"text":"banner","id":"banner","depth":2,"charIndex":2854},{"text":"buildType","id":"buildtype","depth":2,"charIndex":2984},{"text":"copy","id":"copy","depth":2,"charIndex":3087},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":3128},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":3180},{"text":"define","id":"define","depth":2,"charIndex":3341},{"text":"dts","id":"dts","depth":2,"charIndex":3802},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":3864},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":4097},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":4196},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":4419},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":4499},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":4718},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":4790},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":5293},{"text":"externals","id":"externals","depth":2,"charIndex":5501},{"text":"footer","id":"footer","depth":2,"charIndex":5617},{"text":"format","id":"format","depth":2,"charIndex":5655},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":5780},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":5859},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":5957},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":6058},{"text":"hooks","id":"hooks","depth":2,"charIndex":6211},{"text":"input","id":"input","depth":2,"charIndex":6359},{"text":"jsx","id":"jsx","depth":2,"charIndex":6824},{"text":"metafile","id":"metafile","depth":2,"charIndex":7147},{"text":"minify","id":"minify","depth":2,"charIndex":7385},{"text":"outDir","id":"outdir","depth":2,"charIndex":7505},{"text":"platform","id":"platform","depth":2,"charIndex":7559},{"text":"redirect","id":"redirect","depth":2,"charIndex":7693},{"text":"resolve","id":"resolve","depth":2,"charIndex":7924},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":7946},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":8263},{"text":"shims","id":"shims","depth":2,"charIndex":8520},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":8787},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":9229},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":9345},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":9432},{"text":"splitting","id":"splitting","depth":2,"charIndex":9590},{"text":"style","id":"style","depth":2,"charIndex":9703},{"text":"style.less","id":"styleless","depth":2,"charIndex":9724},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":9750},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":9841},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":9925},{"text":"sass","id":"sass","depth":2,"charIndex":10100},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":10120},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":10190},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":10285},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":10461},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":10620},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":11116},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":11350},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":11529},{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":3,"charIndex":11611},{"text":"类型","id":"类型","depth":3,"charIndex":11731},{"text":"注意事项","id":"注意事项","depth":3,"charIndex":11862},{"text":"target","id":"target","depth":2,"charIndex":12152},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":12318},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":12514},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":12756},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":12844},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":13004}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":50,"title":"buildPreset","content":"#\n\n构建的预设字符串或者预设函数。提供开箱即用的构建配置。\n\n * 类型:string | Function\n\n * 默认值: undefined\n\n\nnpm-library#\n\n在类 NPM 包管理器下使用的 Library 通用模式,包含 esm 和 cjs 两种 Bundle 产物,并且包含一份类型文件。\n\nINFO\n\n关于类 NPM 包管理器\n\n * npm\n * yarn\n * pnpm\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-library-with-umd#\n\n在类 NPM 包管理器下使用,并且 Library 支持类似 unpkg 的模式。在预设 'npm-library' 的基础上,额外提供 umd 产物。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component#\n\n在类 NPM 包管理器下使用的 组件(库)通用模式。包含 esm 和 cjs 两种 Bundleless 产物(便于 Tree shaking\n优化),以及包含一份类型文件。\n\n对于源码中包含的样式文件,产物中提供样式的编译产物和样式的源文件。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component-with-umd#\n\n在类 NPM 包管理器下使用的组件(库),同时支持类 unpkg 的模式。 在预设 'npm-component' 的基础上,额外提供 umd 产物。\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\n当想要使用支持其他 ECMAScript 版本的 buildPreset 预设的时候,可以直接在\n'npm-library'、'npm-library-with-umd'、'npm-component'、'npm-component-with-umd'\n这些预设值后面增加想要支持的版本。\n\n例如希望 'npm-library' 预设支持 'es2017',则可以按照如下方式配置:\n\n\n\n\nstring / function#\n\nbuildPreset 除了支持基本的字符串形式,还支持函数形式,可以通过 preset 或者 extendPreset\n参数获取我们提供的预设值,然后进行修改。\n\n以下是两个分别使用 preset 和 extendPreset 的例子:\n\n\n\nextendPreset 里会使用 lodash.merge 进行配置合并\n\n","routePath":"/module-tools/api/config/build-preset","lang":"zh","toc":[{"text":"`npm-library`","id":"npm-library","depth":2,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":2,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":2,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":2,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":2,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":835}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":51,"title":"dev","content":"#\n\n本章节描述了 Modern.js Module 关于调试工具相关的所有配置。\n\n\nstorybook#\n\nWARNING\n\nDeprecated:该配置已过时,只适用于 StorybookV6,详情请看使用Storybook。\n\n\nstorybook.webpack#\n\n * 类型:object | Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpack 来修改 Storybook Preview-iframe 的 webpack 配置。使用方式可以参考\nModern.js Builder 的 tools.webpack 配置。\n\n\n\n配置 Manager App#\n\n对于 Storybook Manager App 部分的 webpack 配置,可以通过增加 ./config/storybook/main.js\n文件进行配置。\n\n\n\n\nstorybook.webpackChain#\n\n * 类型:Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpackChain 来修改 Storybook Preview-iframe 的 webpack\n配置。使用方式可以参考 Modern.js Builder 的 tools.webpackChain 配置。","routePath":"/module-tools/api/config/dev","lang":"zh","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":43},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":118},{"text":"配置 Manager App","id":"配置-manager-app","depth":4,"charIndex":314},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":417}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":52,"title":"plugins","content":"#\n\n本章介绍注册 Modern.js Module 插件的配置。\n\n * 类型:ModuleToolsPlugin[]\n * 默认值:undefined\n\n\n插件执行顺序#\n\n默认情况下,自定义插件会按照 plugins 数组的顺序依次执行,Modern.js Module 内置插件的执行时机早于自定义插件。\n\n当插件内部使用了控制顺序的相关字段,比如 pre、post 时,会基于声明的字段对执行顺序进行调整,详见 插件之间的关系。\n\n\n开发插件#\n\n关于如何编写插件,可以查看「插件编写指南」。\n\n\n示例#\n\n\n使用 npm 上的插件#\n\n使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。\n\n\n\n使用本地插件#\n\n使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。\n\n\n\n\n插件配置项#\n\n如果插件提供了一些自定义的配置项,你可以通过插件函数的参数传入配置。\n\n","routePath":"/module-tools/api/config/plugins","lang":"zh","toc":[{"text":"插件执行顺序","id":"插件执行顺序","depth":2,"charIndex":79},{"text":"开发插件","id":"开发插件","depth":2,"charIndex":221},{"text":"示例","id":"示例","depth":2,"charIndex":253},{"text":"使用 npm 上的插件","id":"使用-npm-上的插件","depth":3,"charIndex":259},{"text":"使用本地插件","id":"使用本地插件","depth":4,"charIndex":316},{"text":"插件配置项","id":"插件配置项","depth":3,"charIndex":364}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":53,"title":"testing","content":"#\n\n本章描述了测试相关的配置。\n\nTIP\n\n需要先通过 pnpm run new 启用 单元测试 功能。\n\n\njest#\n\n * 类型: object | Function\n * 默认值:{}\n\n对应 Jest 的配置,当为 object 类型时,可以配置 Jest 所支持的所有底层配置 。\n\n\n\n值为 Function 类型时,默认配置作为第一个参数传入,需要返回新的 Jest 配置对象。\n\n\n\n\ntransformer#\n\n * 类型:'babel-jest' | 'ts-jest'\n * 默认值:'babel-jest'\n\n配置执行测试的时候对于源码的编译工具: babel-jest 或 ts-jest。默认使用 babel-jest。\n\nINFO\n\nbabel-jest 也可以编译 TS 文件,但不会类型报错,如果你需要跑测试的时候对 TS 类型进行校验,那么请使用 ts-jest。","routePath":"/module-tools/api/config/testing","lang":"zh","toc":[{"text":"jest","id":"jest","depth":2,"charIndex":55},{"text":"transformer","id":"transformer","depth":2,"charIndex":202}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":54,"title":"概览","content":"#","routePath":"/module-tools/api/","lang":"zh","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"概览","sidebar_position":1},"version":""},{"id":55,"title":"Plugin Hooks","content":"#\n\n本章介绍关于 Modern.js Module 支持的生命周期钩子。\n\n目前主要包含以下几类生命周期钩子:\n\n * 配置钩子:用于处理用户配置。\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n这里详细解释了 Hook 模型\n\n\n配置钩子#\n\n\nresolveModuleUserConfig#\n\n用于修改用户配置。\n\n类型:AsyncWaterfall\n\n\n\n\n构建钩子#\n\n在执行 build 命令的时候,会按照顺序触发以下 Hooks:\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\n执行整体构建流程之前触发。\n\n类型:ParallelWorkflow\n\n\n\n参数类型:\n\n\n\n> BuildConfig 类型参考 API 配置\n\n\nbeforeBuildTask#\n\n根据构建配置,Modern.js Module 会将整体构建分成多个子构建任务。该 Hook 将会在每一个构建子任务之前触发。\n\n类型:AsyncWaterfall\n\n\n\n\nafterBuildTask#\n\n类型:ParallelWorkflow,每一个构建子任务结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nafterBuild#\n\n类型:ParallelWorkflow,整体构建流程结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nbuildPlatform 钩子#\n\nmodule-tools 还提供了 build --platform 命令来执行特定的构建任务。\n\n例如在安装了 Doc 插件后,就可以执行 build --platform 或者 build --platform doc 来执行 doc 的构建任务。因为\ndoc 插件基于 buildPlatform Hooks 实现了该功能。\n\n在执行 build --platform 后会按照以下顺序触发 Hooks:\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\n获取在执行 build --platform 命令时候需要运行的任务信息。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。beforeBuildPlatform 会在执行整体的构建任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。buildPlatform 会在每个构建任务执行之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。afterBuildPlatform 会在整体 platform\n构建任务结束后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n调试钩子#\n\n在执行 dev 命令的时候,会按照顺序触发以下 Hooks:\n\n * registerDev: 在获取调试功能信息的时候触发。\n * beforeDev: 开始执行调试整体流程之前触发。\n * beforeDevMenu: 出现调试列表/菜单之前触发。\n * afterDevMenu: 选择调试列表/菜单选项后触发。\n * beforeDevTask: 执行调试任务之前触发。\n * afterDev: 执行 dev 整体流程最后触发。\n\n\nregisterDev#\n\n注册调试工具相关的数据。主要包含:\n\n * 调试工具的名称\n * 显示在菜单列表中的项目名称以及对应的值。\n * dev 子命令的定义。\n * 是否在运行调试任务之前执行源码构建\n * 执行调试任务的函数。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDev#\n\n在收集完所有调试工具元数据后,执行 dev 任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu 在出现调试列表/菜单之前触发。接收 inquirer question 作为参数。默认值为:\n\n\n\nafterDevMenu 选择调试列表/菜单选项后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDevTask#\n\n执行调试任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterDev#\n\n在中断调试任务进程时触发。\n\n","routePath":"/module-tools/api/plugin-api/plugin-hooks","lang":"zh","toc":[{"text":"配置钩子","id":"配置钩子","depth":2,"charIndex":209},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"构建钩子","id":"构建钩子","depth":2,"charIndex":276},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform 钩子","id":"buildplatform-钩子","depth":2,"charIndex":713},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"调试钩子","id":"调试钩子","depth":2,"charIndex":1459},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":56,"title":"","content":"","routePath":"/module-tools/components/faq-build-exception","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":57,"title":"","content":"","routePath":"/module-tools/components/faq-build-other","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":58,"title":"","content":"","routePath":"/module-tools/components/faq-build-product","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":59,"title":"","content":"","routePath":"/module-tools/components/faq-storybook","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":60,"title":"","content":"","routePath":"/module-tools/components/faq-test","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":61,"title":"","content":"","routePath":"/module-tools/components/publish-emo","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":62,"title":"","content":"在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。","routePath":"/module-tools/components/register-esbuild-plugin","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":63,"title":"","content":"","routePath":"/module-tools/components/release-module-doc","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":64,"title":"处理静态资源","content":"#\n\nModern.js Module 会对代码中使用的静态资源进行处理。如果需要配置,则可以使用 buildConfig.asset API。\n\n\n默认行为#\n\n默认情况下,Modern.js Module 会处理以下静态资源:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\n对于静态文件的处理,Modern.js Module 目前默认支持的功能有:\n\n * 输出静态资源至 ./assets。\n * 对于不超过 10kb 的文件会内联到代码中。\n\n\n示例#\n\n让我们看下面的例子:\n\n * 项目源代码:\n\n\n\n * 如果 bg.png 的大小小于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n * 如果 bg.png 的大小大于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n当你想要修改默认行为的时候,可以使用以下 API:\n\n * asset.path:修改静态资源文件输出路径。\n * asset.limit:修改内联静态资源文件的阈值。","routePath":"/module-tools/guide/advance/asset","lang":"zh","toc":[{"text":"默认行为","id":"默认行为","depth":2,"charIndex":74},{"text":"示例","id":"示例","depth":2,"charIndex":355}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":65,"title":"构建 umd 产物","content":"#\n\numd 全称为 Universal Module Definition,这种格式的 JS 文件可以运行在多个运行环境:\n\n * 浏览器环境:基于 AMD 规范进行模块加载\n * Node.js 环境:基于 CommonJS 进行模块加载\n * 其他情况:将模块挂载在全局对象上。\n\n因此我们可以通过下面的方式,将项目的构建产物指定为 umd 产物:\n\n\n\n\numd 产物的第三方依赖处理#\n\n在 「如何处理第三方依赖」 章节中,我们知道可以通过 autoExternals 和 externals API 来控制项目是否对第三方依赖打包。 因此在构建\numd 产物的过程中,我们也可以这样使用:\n\n\n示例#\n\n * 如果项目依赖了 react:\n\n\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时产物中不会将 react 代码打包到产物中:\n\n\n\n通过上面的例子我们知道,当使用 autoExternal 和 externals API 后:\n\n * 在 Node.js 环境下,可以通过 require('react') 获取 react 依赖。\n * 在 浏览器环境下,可以通过 global.react 获取 react 依赖。\n\n\n三方依赖的全局变量名称#\n\n然而在浏览器环境下,获取第三方依赖的时候,全局变量名称不一定与依赖名称完全相同,此时就要使用 buildConfig.umdGlobals API。\n\n还是使用之前的例子,当 react 依赖以 windows.React 或者 global.React 全局变量的形式存在于浏览器环境下,那么此时:\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时我们会看到这样的产物代码:\n\n\n\n此时项目就可以运行在浏览器中,并使用存在于全局对象上的 React 变量了。\n\n\n更改项目的全局变量名称#\n\n当我们将下面的代码打包成 umd 产物并运行在浏览器的时候,我们可以通过 window.index 来使用该模块。\n\n\n\n默认情况下,以源码文件名称作为该模块在浏览器里全局变量的名称。对于上面的例子,其产物内容如下:\n\n\n\n如果需要修改它,则需要使用 buildConfig.umdModuleName API。\n\n当使用该 API 后:\n\n\n\n此时构建产物的内容为:\n\n","routePath":"/module-tools/guide/advance/build-umd","lang":"zh","toc":[{"text":"umd 产物的第三方依赖处理","id":"umd-产物的第三方依赖处理","depth":2,"charIndex":181},{"text":"示例","id":"示例","depth":3,"charIndex":302},{"text":"三方依赖的全局变量名称","id":"三方依赖的全局变量名称","depth":3,"charIndex":556},{"text":"更改项目的全局变量名称","id":"更改项目的全局变量名称","depth":2,"charIndex":836}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":66,"title":"使用 Copy 工具","content":"#\n\nModern.js Module 提供了 Copy 工具用于将已经存在的单个文件或整个目录复制到产物目录中。接下来我们学习如何使用它。\n\n\n了解 Copy API#\n\n我们可以通过 buildConfig.copy API 来使用 Copy 工具,它包含以下两个主要配置:\n\n * patterns\n * options\n\n\nAPI 详解#\n\ncopy.patterns 用于寻找复制的文件以及配置输出的路径。\n\n其中 patterns.from 用于指定要复制的文件或者目录。它接收 Glob 形式字符串或具体路径。Glob 形式字符串是指 fast-glob\npattern-syntax。因此我们可以按照如下两种方式使用它:\n\n\n\npatterns.context 一般和 patterns.from 配合使用,默认情况下它的值与 buildConfig.sourceDir\n相同,因此我们可以按照如下方式指定 src/data.json 文件为要复制的文件:\n\n> 默认情况下,buildConfig.sourceDir 为 src\n\n\n\n当指定的文件不在源码目录的时候,可以修改 context 配置。例如指定项目目录下的 temp/index.html 为要复制的文件:\n\n\n\npatterns.to 用于指定复制文件的输出路径,默认情况下它的值为 buildConfig.outDir对应的值。因此我们按照如下方式将\nsrc/index.html 复制到 dist 目录下:\n\n\n\n当我们配置了 patterns.to 的时候:\n\n * 如果是相对路径,则该路径会相对于 buildConfig.outDir 计算出复制文件输出的绝对路径。\n * 如果是绝对路径,则会直接使用该值。\n\n最后 patterns.globOptions 用于配置寻找复制文件 globby 对象,其配置可参考:\n\n * globby.options\n\n\n不同场景使用示例#\n\n\n将文件复制文件#\n\n\n\n\n将文件复制到目录#\n\n\n\n\n从目录复制到目录#\n\n\n\n\n从目录到文件#\n\n\n\n\n使用 Glob#\n\n","routePath":"/module-tools/guide/advance/copy","lang":"zh","toc":[{"text":"了解 Copy API","id":"了解-copy-api","depth":2,"charIndex":72},{"text":"API 详解","id":"api-详解","depth":2,"charIndex":165},{"text":"不同场景使用示例","id":"不同场景使用示例","depth":2,"charIndex":826},{"text":"将文件复制文件","id":"将文件复制文件","depth":3,"charIndex":838},{"text":"将文件复制到目录","id":"将文件复制到目录","depth":3,"charIndex":851},{"text":"从目录复制到目录","id":"从目录复制到目录","depth":3,"charIndex":865},{"text":"从目录到文件","id":"从目录到文件","depth":3,"charIndex":879},{"text":"使用 Glob","id":"使用-glob","depth":3,"charIndex":891}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":67,"title":"处理三方依赖","content":"#\n\n一般来说,项目所需要的第三方依赖可以通过包管理器的 install 命令安装,在安装第三方依赖成功后,这些第三方依赖一般会出现在项目 package.json\n的 dependencies 和 devDependencies 下。\n\n\n\n\"dependencies\" 下的依赖通常来说是这个包运行所需的依赖, \"devDependencies\" 则代表着开发依赖。\n\n除了 \"dependencies\" 以外,\"peerDependencies\" 也可以声明在生产环境下运行所需要的依赖,此时会和它的宿主共享一份依赖。\n\n\n第三方依赖的默认处理#\n\n在 Modern.js Module 里,默认情况下不会对 \"dependencies\" 以及 \"peerDependencies\"\n下的第三方依赖进行打包处理。\n\n这是因为在安装 npm 包时,其 \"dependencies\" 也会被安装。不打包 \"dependencies\",可以减小包产物的体积。\n\n如果需要打包某些依赖,建议将它们从 \"dependencies\" 挪到 \"devDependencies\" ,这相当于对依赖进行 prebundle\n,可以减小依赖安装的体积。\n\n\n示例#\n\n如果项目依赖了 react:\n\n\n\n当源码中使用了 react 依赖:\n\n\n\n此时产物中不会包含 react 的代码:\n\n\n\n如果想要修改默认的处理方式,可以通过下面的 API 进行修改:\n\n * buildConfig.autoExternal\n\n\n排除指定第三方依赖#\n\n在上面我们提到了 buildConfig.autoExternal API 的用途,同时 buildConfig.externals\n可以实现对三方依赖更细微的处理。\n\n例如当我们需要仅对某些依赖不进行打包处理的时候,可以按照如下方式进行配置:\n\n> 一般这种情况,可能是某些依赖不适合进行打包处理。如果遇到这种情况,则可以按照下面的方式进行处理。\n\n","routePath":"/module-tools/guide/advance/external-dependency","lang":"zh","toc":[{"text":"第三方依赖的默认处理","id":"第三方依赖的默认处理","depth":2,"charIndex":264},{"text":"示例","id":"示例","depth":3,"charIndex":521},{"text":"排除指定第三方依赖","id":"排除指定第三方依赖","depth":2,"charIndex":652}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":68,"title":"深入理解构建","content":"#\n\n在 \"基础使用\" 的部分,我们已经知道可以通过 buildConfig 配置对项目的输出产物进行修改。buildConfig\n不仅描述了产物的一些特性,同时还为构建产物提供了一些功能。\n\nTIP\n\n如果你还不了解 buildConfig 的作用,请先阅读 修改输出产物。\n\n而在本章里我们将要深入理解某些构建配置的作用以及了解执行 modern build 命令的时候发生了什么。\n\n\nbundle / bundleless#\n\n那么首先我们来了解一下 bundle 和 bundleless。\n\n所谓 bundle 是指对构建产物进行打包,构建产物可能是一个文件,也有可能是基于一定的代码拆分策略得到的多个文件。\n\n而 bundleless 则是指对每个源文件单独进行编译构建,但是并不将它们打包在一起。每一个产物文件都可以找到与之相对应的源码文件。bundleless\n构建的过程,也可以理解为仅对源文件进行代码转换的过程。\n\n它们有各自的好处:\n\n * bundle 可以减少构建产物的体积,也可以对依赖预打包,减小安装依赖的体积。提前对库进行打包,可以加快应用项目构建的速度。\n * bundleless 则是可以保持原有的文件结构,更有利于调试和 tree shaking。\n\nWARNING\n\nbundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 type 字段, 例如 import type { A } from\n'./types,背景参考 esbuild 文档。\n\n在 buildConfig 中可以通过 buildConfig.buildType 来指定当前构建任务是 bundle 还是 bundleless。\n\n\ninput / sourceDir#\n\nbuildConfig.input 用于指定读取源码的文件路径或者目录路径,其默认值在 bundle 和 bundleless 构建过程中有所不同:\n\n * 当 buildType: 'bundle' 的时候,input 默认值为 src/index.(j|t)sx?\n * 当 buildType: 'bundleless' 的时候,input 默认值为 ['src']\n\n从默认值上我们可以知道:使用 bundle 模式构建时一般指定一个或多个文件作为构建的入口,而使用 bundleless\n构建则是指定一个目录,将目录下所有文件作为入口。\n\nsourceDir 用于指定源码目录,它只与以下两个内容有关系:\n\n * 类型文件生成\n * 指定构建过程中的 outbase\n\n因此我们可以得到其最佳实践:\n\n * 在 bundle 构建过程中,只能指定 input 。\n * 一般情况下,bundleless 只需要指定 sourceDir(此时 input 会与 sourceDir 保持一致)。\n\n如果我们想要在 bundleless 里只对一部分文件进行转换,例如只需要转换 src/runtime 目录的文件,此时需要配置 input:\n\n\n\n\n使用 swc#\n\n在部分场景下,esbuild 不足以满足我们的需求,此时我们会使用 swc 来做代码转换。\n\n从 2.36.0 版本开始,涉及到以下功能时,Modern.js Module 默认会使用 swc ,但不这意味着不使用 esbuild 了,其余功能还是使用\nesbuild:\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\n事实上,我们在 2.16.0 版本开始全量使用 swc 进行代码转换。不过 swc 同样也存在一些限制,为此我们添加了 sourceType 配置,当源码格式为\n'commonjs' 时关闭 swc, 但这种方式并不符合用户直觉,另外,swc 格式化输出的 cjs 模式没有给每个导出名称添加注释,这在 node\n中使用可能会带来一些问题。 因为我们废弃了此行为,回到了最初的设计 - 只在需要的场景下使用 swc 作为补充。\n\n\n使用 Hook 介入构建流程#\n\nModern.js Module 提供了 Hook 机制,允许我们在构建流程的不同阶段注入自定义逻辑。 Modern.js Module Hook 使用了\ntapable 实现,扩展了 esbuild 的插件机制,若 esbuild plugins 已经满足了你的需求,建议直接使用它。 下面展开说明其用法:\n\n\nHook 类型#\n\nAsyncSeriesBailHook#\n\n串行执行的 hooks,如果某个 tapped function 返回非 undefined 结果,则后续其他的 tapped function 停止执行。\n\nAsyncSeriesWaterFallHooks#\n\n串行执行的 hooks,其结果会传递给下一个 tapped function\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * 在 esbuild onLoad callbacks 触发,根据模块路径来获取模块内容\n * 输入参数\n\n\n\n * 返回参数\n\n\n\n * 例子\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onLoad callbacks 触发, 将 load 阶段获取的模块内容进行转换\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onEnd callbacks 触发, 类似于 transform hook,但是作用在 esbuild 生成的产物\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\n\n类型文件生成#\n\nbuildConfig.dts 配置主要用于类型文件的生成。\n\n\n关闭类型生成#\n\n默认情况下类型生成功能是开启的,如果需要关闭的话,可以按照如下配置:\n\n\n\nTIP\n\n关闭类型文件后,一般来说构建速度会有所提升。\n\n\n打包类型文件#\n\n在 buildType: 'bundleless' 的时候,类型文件的生成是使用项目的 tsc 命令来完成生产。\n\nModern.js Module 同时还支持对类型文件进行打包,不过使用该功能的时候需要注意:\n\n * 对类型文件进行打包不会开启类型检查。\n * 一些第三方依赖存在错误的语法会导致打包过程失败。因此对于这种情况,需要手动通过 buildConfig.externals\n 将这类第三方包排除,或者直接关闭dts.respectExternal从而不打包任何三方包类型。\n * 对于第三方依赖的类型文件指向的是一个 .ts 文件的情况,目前无法处理。比如第三方依赖的 package.json 中存在这样的内容: {\"types\":\n \"./src/index.ts\"。\n\n对于上述问题,我们推荐的处理方式是首先使用 tsc 生成 d.ts 文件,然后将 index.d.ts 作为入口进行打包处理,并且关闭\ndts.respectExternal。在之后的演进我们也会逐渐向这种处理方式靠拢。\n\n\n别名转换#\n\n在 bundleless 构建过程中,如果源代码中出现了别名,例如:\n\n\n\n使用 tsc 生成的产物类型文件也会包含这些别名。不过 Modern.js Module 会对 tsc 生成的类型文件里的别名进行转换处理。\n\n\n一些示例#\n\n\n\n\n\n\n构建过程#\n\n当执行 modern build 命令的时候,会发生\n\n * 根据 buildConfig.outDir 清理产物目录。\n * 编译 js/ts 源代码生成 bundle / bundleless 的 JS 构建产物。\n * 使用 tsc 生成 bundle / bundleless 的类型文件。\n * 处理 copy 任务。\n\n\n构建报错#\n\n当发生构建报错的时候,基于以上了解到的信息,可以很容易的明白在终端出现的报错内容:\n\njs 或者 ts 构建的报错:\n\n\n\n类型文件生成过程的报错:\n\n\n\n对于 js/ts 构建错误,我们可以从报错信息中知道:\n\n * 报错的 buildType\n * 报错的 format\n * 报错的 target\n * 其他具体报错信息\n\n\n调试模式#\n\n从 2.36.0 版本开始,为了便于排查问题,Modern.js Module 提供了调试模式,你可以在执行构建时添加 DEBUG=module\n环境变量来开启调试模式。\n\n\n\n调试模式下,你会看到 Shell 中输出更详细的构建日志,这主要以流程日志为主:\n\n\n\n另外,Module 还提供了调试内部工作流程的能力。你可以通过设置环境变量 DEBUG=module:* 来开启更详细的调试日志:\n\n目前只支持了 DEBUG=module:resolve,可以查看 Module 内部模块解析的详细日志:\n\n","routePath":"/module-tools/guide/advance/in-depth-about-build","lang":"zh","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"使用 swc","id":"使用-swc","depth":2,"charIndex":1281},{"text":"使用 Hook 介入构建流程","id":"使用-hook-介入构建流程","depth":2,"charIndex":1762},{"text":"Hook 类型","id":"hook-类型","depth":3,"charIndex":1936},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":1946},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":2048},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":2117},{"text":"load","id":"load","depth":4,"charIndex":2128},{"text":"transform","id":"transform","depth":4,"charIndex":2236},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":2358},{"text":"类型文件生成","id":"类型文件生成","depth":2,"charIndex":2500},{"text":"关闭类型生成","id":"关闭类型生成","depth":3,"charIndex":2542},{"text":"打包类型文件","id":"打包类型文件","depth":3,"charIndex":2619},{"text":"别名转换","id":"别名转换","depth":3,"charIndex":3090},{"text":"一些示例","id":"一些示例","depth":3,"charIndex":3208},{"text":"构建过程","id":"构建过程","depth":2,"charIndex":3220},{"text":"构建报错","id":"构建报错","depth":2,"charIndex":3394},{"text":"调试模式","id":"调试模式","depth":2,"charIndex":3567}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":69,"title":"深入理解 dev 命令","content":"#\n\nModern.js Module 提供的 dev 命令主要用于代码的调试。\n\n\n命令运行的整体流程#\n\n 1. 当执行 dev 命令的时候,Modern.js Module 开始寻找是否存在可以执行的调试工具或者任务。调试工具或者任务就是类似 doc 这样的\n Modern.js Module 调试工具插件。\n 2. 当发现存在一个调试工具的时候,则会立即执行它。\n 3. 当发现多个调试工具的时候,则显示调试工具列表菜单。可以通过选择某个调试工具对应的名称选项启动它。\n 4. 当没有发现调试工具的时候,则告诉用户没有可用的调试工具。\n\n我们除了可以执行 dev 命令以外,也可以通过 dev [调试工具名称] 的方式来直接启动调试工具或者任务。\n\n\n扩展 dev 命令#\n\n如果需要扩展 dev 命令或者说提供自己的 Modern.js Module 调试工具插件,那么你需要先了解以下内容:\n\n * 开发插件\n * 调试工具插件 API\n\n一般来说,实现一个什么都不做的调试工具,其实现代码以及相关配置如下:\n\n\n\n如果需要使用该调试工具插件,则需要在配置文件中增加它:\n\n\n\n此时我们执行 dev 或者 dev do-nothing 命令的时候,就可以执行它了。在执行后,它会先执行监听模式的源码构建任务,并紧接着打印日志信息。\n\n对于目前官方支持的调试工具和第三方支持的调试工具,可以在插件列表中查看。","routePath":"/module-tools/guide/advance/in-depth-about-dev-command","lang":"zh","toc":[{"text":"命令运行的整体流程","id":"命令运行的整体流程","depth":2,"charIndex":42},{"text":"扩展 dev 命令","id":"扩展-dev-命令","depth":2,"charIndex":333}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":70,"title":"开始之前","content":"#\n\n\n环境准备#\n\n为了使用 Modern.js Module,首先需要 NodeJS,我们推荐最新的长期维护版本,并确保 Node 版本大于等于 16.0.0。因为非稳定的\nNodeJS 时常有一些 Bug,你可以使用 nvm-windows 和 nvm(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS\n版本,这些版本可能会用于不同的项目。\n\n\n初识 npm#\n\n当 NodeJS 被安装后,你不仅可以在命令行中访问 node 可执行程序,同时你也可以执行 npm 命令。\n\nnpm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript\n的工具。\n\n如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到「npm 包管理器」部分。\n\n\nnpm 包类型项目#\n\n那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 npm init 命令的时候,它会在当前目录下面创建一个文件名为 package.json\n的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 package.json\n文件中找到:\n\n\n\n此时这个包含了初始化后的 package.json 文件的项目就是一个 npm 包类型的项目,你可以执行 npm publish 命令将这个项目发布到 npm\nRegistry。\n\nnpm Registry 是一个 npm 包存储的地方,开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm\nRegistry 使用其他开发者发布的 npm 包。\n\n优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。\n\n\n使用第三方 npm 包#\n\n当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情\n—— npm 依赖的软件包类型:\n\n * \"dependencies\":一种是你的应用程序在生产环境中需要的软件包。\n * \"devDependencies\":另一种是仅在本地开发和测试中需要的软件包。\n \n > 软件包可以理解为是第三方的 npm 包。\n\n你可以通过执行 npm install npm-package-name 或者 npm add npm-package-name\n的方式来安装在生产环境中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在 \"dependencies\"\n里,并执行 npm install 命令:\n\n\n\n同理,你也可以执行 npm install npm-package-name --save-dev 或 npm add npm-package-name\n--save-dev 的方式来安装仅在本地开发和测试中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在\n\"devDependencies\" 里,并执行 npm install 命令:\n\n\n\n在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 \"dependencies\" 还是\n\"devDependencies\" 中。\n\nTIP\n\n一般来说,需要在源代码中使用到的包都属于 dependencies 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为\ndevDependencies 依赖。\n\n\n还需要了解的 npm 零碎知识#\n\n\nnpm 包的程序入口#\n\n在 package.json 中存在一个 \"main\" 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。\n\n例如你的包名为 foo,并且用户安装了它,然后执行 require(\"foo\") 代码,那么 foo 这个 npm 包的 \"main\"\n字段对应的文件将会被导出。\n\n推荐在你的 npm 包里一定要设置 \"main\" 字段。如果没有设置 \"main\",则默认入口为包的根目录下的 index.js 文件。\n\n除了需要设置 \"main\" 属性以外,一般还会设置 \"module\" 属性。它与 \"main\" 属性的用途类似,它主要是用于在 webpack\n场景下使用。webpack 在大多数情况下,会以 \"module\" -> \"main\" 这个顺序读取 npm 包的入口(文件)。\n\n> 想要了解关于 webpack 如何做这件事,可以查看这个链接。\n\n\n\"scripts\"#\n\npackage.json 文件的 \"scripts\" 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。\n\n这些都可以通过运行 npm run-script 或简称 npm run 来执行。\n\n名称匹配的前置命令和后置命令也会被运行(例如 premyscript、myscript、postmyscript)。\n\n\n\n当执行 npm run myscripts 的时候,premyscripts 对应的脚本会在它之前执行,postmyscripts 对应的脚本会在它之后执行。\n\n来自依赖的脚本命令可以用 npm explore -- npm run 运行。\n\n还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。\n\nnpm install#\n\n当你运行 npm install -g 时,以下脚本会运行。\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\n如果你的软件包根目录有一个 binding.gyp 文件,而你没有定义 install 或 preinstall 脚本,那么 npm 将以 node-gyp\nrebuild 作为默认的 install 命令,使用 node-gyp 进行编译。\n\nnpm publish#\n\n当发布项目的时候,执行该命令会触发以下脚本:\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\n当以 --dry-run 模式运行的时候,prepare 对应的脚本将不会执行。\n\n\npeerDependencies#\n\n在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm\n项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm\n项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。\n\n关于更多 peerDependencies 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:\n\n * npm 对 peerDependencies 的解释\n * pnpm vs npm VS Yarn\n\n\nnpm 包管理器#\n\n除了 npm 这种标准的包管理器以外,目前主流的还有 pnpm 和 Yarn,它们都是不错的 npm cli 替代品。\n\n推荐使用 pnpm 来管理项目依赖,可以通过下面的方式安装它:\n\n\n\n\nModern.js Module 配置文件#\n\n通过 @modern-js/create 创建的项目目录下提供了 Modern.js Module 的配置文件 ——\nmodern.config.(j|t)s。但 modern.config 配置文件不是必须存在的。\n\n默认情况下,生成的配置文件的内容如下:\n\n\n\n我们推荐使用 defineConfig 函数,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:\n\n","routePath":"/module-tools/guide/basic/before-getting-started","lang":"zh","toc":[{"text":"环境准备","id":"环境准备","depth":2,"charIndex":3},{"text":"初识 npm","id":"初识-npm","depth":2,"charIndex":188},{"text":"npm 包类型项目","id":"npm-包类型项目","depth":2,"charIndex":391},{"text":"使用第三方 npm 包","id":"使用第三方-npm-包","depth":2,"charIndex":818},{"text":"还需要了解的 npm 零碎知识","id":"还需要了解的-npm-零碎知识","depth":2,"charIndex":1602},{"text":"npm 包的程序入口","id":"npm-包的程序入口","depth":3,"charIndex":1621},{"text":"\"scripts\"","id":"scripts","depth":3,"charIndex":2042},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":2825},{"text":"npm 包管理器","id":"npm-包管理器","depth":2,"charIndex":3139},{"text":"Modern.js Module 配置文件","id":"modernjs-module-配置文件","depth":2,"charIndex":3247}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":71,"title":"CLI 命令","content":"#\n\nModern.js Module 项目可以使用的 CLI 命令如下:\n\n\nmodern build#\n\n\n\nModern.js Module 支持 platform 构建模式,可以用于执行其他工具的构建任务,目前官方支持的有 Rspress。例如,可以通过执行\nmodern build --platform 命令启动 doc 构建任务生成 doc 产物。\n\n\nmodern new#\n\n\n\nmodern new 命令用于启动微生成器功能,它可以为项目启用默认没有提供的功能。\n\n目前可以开启的功能有:\n\n * Test 测试\n * Storybook V7\n * Tailwind CSS 支持\n * Modern.js Runtime API\n\n关于这些功能,可以通过「使用微生成器」 章节了解更多。\n\n\nmodern dev#\n\n\n\nModern.js Module 提供了使用调试工具的能力,可以通过 modern dev\n命令来启动。不过要注意的是,默认情况下是没有提供调试相关的插件,因此此时执行 modern dev 会提示: \"No dev tools found\navailable\"。\n\n目前官方支持的调试工具有 Rspress,因此在你执行 modern new 命令开启它后,就可以执行 modern dev 或者 modern dev doc\n执行它。\n\n\nmodern test#\n\n\n\n需要先执行 modern new 开启测试功能,然后才可以执行 modern test 命令。 modern test 命令会自动将\ntests/*.test.(js|ts|jsx|tsx) 文件当做测试用例运行。\n\n\nmodern lint#\n\n\n\n运行 ESLint 检查代码语法情况。通常情况下,我们只需要在 git commit 阶段通过 lint-staged 检查本次提交修改的部分代码。\n\n * --no-fix 参数设置后可以关闭自动修复 lint 错误代码的能力。\n\n\nmodern change#\n\n\n\nmodern change 命令用于生成 changesets 需要的 Markdown 文件。\n\n\nmodern pre#\n\n\n\n可以使用 modern pre 命令在正式发布前预发布一个版本。\n\n\nmodern bump#\n\n\n\n按照 changesets 生成的变更记录的 Markdown 文件修改 package.json 中的版本号, 同时生成 CHANGELOG.md 文件。\n\n\nmodern release#\n\n\n\nmodern release 命令可以将模块发布到 npm Registry 上。\n\n * --tag 参数可以指定发布时具体的 dist tags。\n\n\nmodern gen-release-note#\n\n\n\n根据当前仓库的 changeset 信息自动生成 Release Note。\n\nTIP\n\n需要在 bump 命令之前执行。\n\n\nmodern upgrade#\n\n\n\nmodern upgrade 命令,用于升级项目 Modern.js 相关依赖至最新版本。\n\n在项目根目录下执行命令 npx modern upgrade,会默认将当前执行命令项目的 package.json 中的 Modern.js\n相关依赖更新至最新版本。","routePath":"/module-tools/guide/basic/command-preview","lang":"zh","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern test`","id":"modern-test","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":72,"title":"修改输出产物","content":"#\n\n\n默认输出产物#\n\n当你在初始化的项目里使用 modern build 命令的时候,Modern.js Module 会根据当前配置内容,生成相应的构建产物。\n\n模板创建的默认配置内容如下:\n\n\n\n默认生成产物具有以下特点:\n\n * 会生成 CommonJS 和 ESM 两份产物。\n * 代码语法支持到 ES6 ,更高级的语法将会被转换。\n * 所有的代码经过打包变成了一个文件,即进行了 bundle 处理。\n * 产物输出根目录为项目下的 dist 目录,类型文件输出的目录为 dist/types。\n\n看到这里你可能会有以下疑问:\n\n 1. buildPreset 是什么?\n 2. 产物的这些特点是由什么决定的?\n\n接下来,我们首先来了解一下 buildPreset。\n\n\n构建预设#\n\nbuildPreset 代表着提前准备好的一组或者多组构建相关的配置,只需要使用 buildPreset\n对应的预设值,就可以省去麻烦且复杂的配置工作,得到符合预期的产物。\n\nModern.js Module 主要内置了两套构建预设,包括:\n\n * npm-component: 用于构建组件库。\n * npm-library: 用于打包其他库类型的项目,如工具库。\n\n同时,还提供一些变体,例如 npm-library-with-umd 和 npm-library-es5,顾名思义,分别对应带有 umd 产物和支持到 es5\n语法的库预设。 详细配置可以查看其API。\n\n除此之外,我们也可以完全自定义构建配置:\n\n\n构建配置#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项。在最开始提到的关于“构建产物的特点”,其实都是 buildConfig\n所支持的属性。目前所支持的属性覆盖了大部分模块类型项目在构建产物时的需求,buildConfig\n不仅包含一些产物所具备的属性,也包含了构建产物所需要的一些特性功能。接下来从分类的角度简单罗列一下:\n\n构建产物的基本属性包括:\n\n * 产物是否被打包:对应的 API 是 buildConfig.buildType。\n * 产物对于语法的支持:对应的 API 是 buildConfig.target。\n * 产物格式:对应的 API 是 buildConfig.format。\n * 产物类型文件如何处理,对应的 API 是 buildConfig.dts。\n * 产物的 sourceMap 如何处理:对应的 API 是 buildConfig.sourceMap。\n * 产物对应的输入(或者是源文件):对应的 API 是 buildConfig.input。\n * 产物输出的目录:对应的 API 是 buildConfig.outDir。\n * 构建的源码目录:对应的 API 是 buildConfig.sourceDir。\n\n构建产物所需的常用功能包括:\n\n * 别名:对应的 API 是 buildConfig.alias。\n * 静态资源处理:对应的 API 是 buildConfig.asset。\n * 第三方依赖处理:对应的 API 有:\n * buildConfig.autoExternal。\n * buildConfig.externals。\n * 拷贝:对应的 API 是 buildConfig.copy。\n * 全局变量替换:对应的 API 是 buildConfig.define。\n * 指定 JSX 编译方式,对应的 API 是 buildConfig.jsx。\n\n一些高级属性或者使用频率不高的功能:\n\n * 产物代码压缩:对应的 API 是 buildConfig.minify。\n * 代码分割:buildConfig.spitting\n * 指定构建产物用于 NodeJS 环境还是浏览器环境:对应的 API 是 buildConfig.platform。\n * umd 产物相关:\n * 指定 umd 产物外部导入的全局变量:对应的 API 是 buildConfig.umdGlobals。\n * 指定 umd 产物的模块名:对应的 API 是 buildConfig.umdModuleName。\n\n除了以上分类以外,关于这些 API 的常见问题和最佳实践可以通过下面的链接来了解:\n\n * 关于 bundle 和 bundleless\n * 关于 input 和 sourceDir。\n * 关于类型描述文件。\n * 如何使用 define\n * 如何处理第三方依赖\n * 如何使用拷贝\n * 如何构建 umd 产物\n * 如何使用静态资源\n\n\n结合配置与预设#\n\n了解 buildPreset 和 buildConfig 之后,我们可以将二者进行结合使用。\n\n在实际项目中,我们可以先使用 buildPreset 来快速获取一套默认构建配置。如果需要自定义,可以使用 buildConfig 进行覆盖和扩展。\n\n扩展的逻辑如下:\n\n * 当 buildConfig 是数组时,会在原来的预设基础上添加新的配置项。\n\n\n\n这会在原本预设的基础上,额外生成一份 IIFE 格式、支持到 ES2020 语法的产物,输出目录为项目下的 dist/global 目录。\n\n * 当 buildConfig 是对象时,会将对象中的配置项覆盖到预设中。\n\n\n\n这会使得每一项构建任务都会生成 sourceMap 文件。","routePath":"/module-tools/guide/basic/modify-output-product","lang":"zh","toc":[{"text":"默认输出产物","id":"默认输出产物","depth":2,"charIndex":3},{"text":"构建预设","id":"构建预设","depth":2,"charIndex":344},{"text":"构建配置","id":"构建配置","depth":2,"charIndex":662},{"text":"结合配置与预设","id":"结合配置与预设","depth":2,"charIndex":1950}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":73,"title":"版本管理与发布","content":"#\n\n一个 npm 类型的模块项目发布流程包含了两个阶段:\n\n * 第一阶段是在开发期间,开发者需要提供变更文件,该文件记录了在发布期间需要的变更内容;\n * 第二阶段是在发布期间,需要收集所有的变更文件来更新版本、更新发布日志,并发布新的包到 npm Registry 上。\n\nModern.js Module 提供了一套版本管理与发布的方案,这适用于单包场景。对于 monorepo 里的 npm 包你需要遵循各类 monorepo\n解决方案提供的策略。\n\n\n跟踪变更#\n\n当项目发生变化的时候需要将变化的内容记录下来。项目发生的变化一般是指:\n\n * 新功能\n * 修复问题\n * 配置文件修改\n * ...\n\n当这些任务一旦开发完成后,需要通过以下命令来对当前的变化进行记录:\n\n * modern change\n\n执行 modern change 命令后会向开发者提出几个问题,并根据开发者的回答生成变更记录。变更记录文件包含了版本变化的类型和其描述,该文件会被提交到\ngit 仓库中。\n\n\n\n当执行成功后,生成的包含变更记录的 Markdown 文件会保存在项目的 .changeset 目录下面。其内容类似下面这样:\n\n\n\n\n版本更新#\n\n当需要更新项目版本的时候,执行以下命令:\n\n * modern bump\n\n执行 modern bump 将会基于 .changeset/ 目录下记录了变更的 Markdown 文件内容来修改 package.json\n中的版本号,同时生成 CHANGELOG.md 文件。而当版本更新完成后,这些记录变更的 Markdown 文件也会被删除,也可说这些 Markdown\n文件被“消耗”掉了。\n\n\n\n\n发布#\n\n发布项目可以执行以下命令:\n\n * modern release\n\nmodern release 命令可以将项目发布到 npm Registry。\n\n此时发布的是 latest 版本,也可以说是正式版本。如果想要修改 dist-tag,可以通过 modern release --tag 命令来指定。例如:\n\n\n\n但是如果希望将当前项目的版本号也修改为预发布的版本号,则需要使用 modern pre 命令。\n\n> 所谓 dist-tag,可以理解:为当前发布的版本打标签。一般来说,默认发布的版本对应的 dist-tag 为 latest,因此可以把 latest\n> 认为是正式版本的 dist-tag。\n\n\n预发布#\n\n当需要在正式发布之前进行预发布,则需要执行以下命令:\n\n * modern pre\n\n首先 modern pre enter 进入预发布模式, 可以与发布项目的时候使用 modern release --tag 命令指定的 tag 一致。\n\n\n\n接着可以使用 modern bump 命令更新具体的版本号,此时不会真正的“消耗”记录变更的 Markdown 文件:\n\n\n\n然后可以看到 package.json 中更新的版本号会类似这样:0.1.2-next.0。\n\n最后,如果不需要再进行预发布,则一定要执行 modern pre exit 命令,这样可以退出预发布状态,并且当再次执行 modern bump\n命令的时候,就可以发布正式的版本。","routePath":"/module-tools/guide/basic/publish-your-project","lang":"zh","toc":[{"text":"跟踪变更","id":"跟踪变更","depth":2,"charIndex":231},{"text":"版本更新","id":"版本更新","depth":2,"charIndex":519},{"text":"发布","id":"发布","depth":2,"charIndex":728},{"text":"预发布","id":"预发布","depth":2,"charIndex":1040}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":74,"title":"使用微生成器","content":"#\n\nModern.js Module 提供了微生成器工具,它可以为当前项目:\n\n * 新增目录和文件\n * 修改 package.json\n * 执行命令\n\n因此通过这些能力,微生成器可以为项目开启额外的特性功能。\n\n可以通过 modern new 启动微生成器。目前 Modern.js Module 支持的微生成器功能有:\n\n\n开发模块文档#\n\n当我们想要为模块编写文档的时候,可以启用模块文档功能。会在项目目录下创建 docs 目录以及相关文件,在 package.json 中新增\n\"@modern-js/plugin-rspress\" 依赖。 使用 modern dev 和 modern build --platform\n来调试和构建你的文档站点。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n\n\n\nStorybook 调试#\n\n当我们想要对组件或者普通模块进行调试的时候,可以启用 Storybook 调试功能。启动该功能后,会在项目目录下创建 stories 目录以及\n.storybook 目录,在 package.json 中新增 \"@modern-js/storybook\" 依赖。使用 storybook dev 和\nstorybook build 来调试和构建。\n\n\nTailwind CSS 支持#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\n如果你想要在项目使用 Tailwind CSS,可以参考 「使用 Tailwind CSS」。\n\n\nModern.js Runtime API 支持#\n\nModern.js 提供了 Runtime API 能力,这些 API 只能在 Modern.js 的应用项目环境中使用。如果你需要开发一个 Modern.js\n应用环境中使用的组件,那么你可以开启该特性,微生成器会增加 \"@modern-js/runtime\"依赖。\n\n另外,Storybook 调试工具也会通过检测项目的依赖确定项目是否需要使用 Runtime API,并且提供与 Modern.js 应用项目一样的\nRuntime API 运行环境。\n\n:::tip 在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n","routePath":"/module-tools/guide/basic/use-micro-generator","lang":"zh","toc":[{"text":"开发模块文档","id":"开发模块文档","depth":2,"charIndex":166},{"text":"Storybook 调试","id":"storybook-调试","depth":2,"charIndex":370},{"text":"Tailwind CSS 支持","id":"tailwind-css-支持","depth":2,"charIndex":561},{"text":"Modern.js Runtime API 支持","id":"modernjs-runtime-api-支持","depth":2,"charIndex":709}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":75,"title":"开发模块文档","content":"#\n\n本章介绍如何为模块项目快速搭建一个静态文档站点。\n\n\n开始之前#\n\n\n为什么我们需要为模块搭建一个文档站点#\n\n 1. 文档站点可以帮助我们更好地组织文档的结构。\n 2. 文档站点具有更好的表现形式,例如可以在页面中执行函数,渲染组件等。\n 3. 可以更好地利用 AI 搜索的能力。\n\n\n前置准备#\n\n 1. 通过微生成器开启文档功能。\n 2. 阅读Rspress 介绍。\n\n完成准备工作之后,接下来我们会基于 Rspress 为模块项目搭建一个文档站点。\n\n\n站点基本结构#\n\n站点整体布局由三部分组成:导航栏、侧边栏以及正文部分,其中正文还包括了 TOC(Table of contents found at the beginning\nof a book or document)。\n\nRspress 使用的是文件系统路由,模块文档基于此实现了侧边栏的自动生成。 例如,如果你有以下的文件结构:\n\n\n\n那么 foo/bar.md 的路由路径会是 /foo/bar,foo.md 的路由路径会是 /foo,index.md 的路由路径会是 /。\n\n具体映射规则如下:\n\n文件路径 路由路径\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\n与上述文件路径和路由路径依次对应的侧边栏如下所示:\n\n\n配置侧边栏#\n\n如上图所示,模块文档已经为文件系统路由自动生成了侧边栏,其中侧边栏每一栏的文本是由文件的一级标题或者目录名决定。 如果你需要自定义侧边栏,请使用\n_meta.json 或者直接配置 sidebar。\n\nINFO\n\n如果你的文档目录结构是符合国际化的,例如:\n\n\n\n你需要按照国际化章节,同时配置 lang 和 locales,否则模块自动生成的侧边栏不会处理 zh 和 en 这两个目录。\n\n\n编写文档#\n\n接下来我们可以专注于文档内容的编写了。除了最基本的编写 markdown 以外,你可能还需要了解以下进阶内容:\n\n * 使用 MDX\n * 使用静态资源\n\n\n组件预览#\n\n模块文档为组件库提供了预览能力,jsx和tsx的代码块里的内容将会被解析为 React 组件。\n\n\n示例#\n\n假设我们的项目名是demo,并导出了一个 Button 组件。\n\n 1. 首先新增 docs/Button.mdx 文件:\n\n\n\n 2. 在tsconfig.json里配置别名,将包名指向当前项目目录,使得文档开发者和用户使用组件方式一致:\n\n\n\n 3. 在 .gitignore 文件下添加 doc_build/,文档产物将会生成在此目录下:\n\n\n\n恭喜你,已经完成了一个组件文档的编写,执行pnpm run dev看看效果吧,记得先构建一下组件库,确保组件产物存在。\n\n\n移动端预览#\n\n同时,我们也支持了移动端预览的方式,即使用 iframe 渲染移动端组件,并可以通过 iframePosition 设置 iframe\n的位置,支持扫码预览以及新页面打开。\n\n\n\nTIP\n\n如果只想要改变某一个 jsx 和 tsx 代码块的预览方式,可以使用不同的修饰符进行标识:\n\n\n\n\n使用外部 demo#\n\n如果我们的 demo 非常复杂,那么建议单独编写 demo,然后在 MDX 中使用 code 标签:\n\n\n\n这同样支持单独设置代码块的预览方式,例如:\n\n\n\n\n使用内置组件#\n\n插件内部实现了一部分内置组件,以便于你可以更轻松地开发模块文档。\n\n\nAPI#\n\n展示模块的 API 内容\n\n解析文件#\n\n在使用 API 组件之前,首先我们需要指定解析的文件:\n\n\n\n内容生成#\n\n接下来我们了解一下根据解析的文件会生成什么样的 markdown 内容。\n\n内容可以通过 react-docgen-typescript 或者 documentation 两个不同的工具生成:\n\n * react-docgen-typescript针对于组件库场景,仅会解析 props 生成表格。\n\n\n\n上面是一个标准写法,其中 ButtonProps 将被提取至表格中, Button 作为表格的标题。如果使用默认导出,文件名将作为表格标题。\n\n需要注意的是,export 导出事先定义的特性将不会被解析。\n\n\n\n生成的内容如下:\n\n\n\nWARNING\n\n如果 Props 里使用了 React 的类型,你需要在 tsconfig.json 里添加 types ,否则会解析不到 React 命名空间下的类型。\n\n\n\n更好的方式是直接引用类型,例如\n\n\n\n * documentation适用于工具库场景,用来解析 JSDoc 注释。\n\n\n\n上面是一个带有 JSDoc 注释的 greet 函数。生成的内容如下:\n\n\n\n组件使用#\n\n接下来,你便可以在文档里使用我们的内置 API 组件了,将key值传入moduleName属性里\n\n\n\n\nOverview#\n\n展示模块列表,可以放在首页用来展示所有模块。\n\nOverview 组件只有一个 list 属性,接收一个对象数组,下面是对象的属性\n\n属性 说明 类型 默认值\nicon 图标 React.ReactNode \ntext 文本(必填) string \nlink 链接(必填) string \narrow 是否展示箭头 boolean false\n\n\n插件配置#\n\n\napiParseTool#\n\nAPI 解析工具\n\n * 类型:'react-docgen-typescript' | 'documentation'\n * 默认值:'react-docgen-typescript'\n\n\ndoc#\n\n文档框架配置\n\n\nentries#\n\n自动生成文档的模块名称及相对路径\n\n * 类型:Entries | ToolEntries\n * 默认值:{}\n\n\n\nEntries 同时支持针对不同的文件使用不同的解析工具:\n\n\n\n\niframePosition#\n\niframe 所处页面位置\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nfollow时,每一个代码块都会有一个 iframe 展示其渲染视图。 fixed时,iframe 将会固定在页面右侧,展示当前页面所有代码块的视图。\n\n\nparseToolOptions#\n\nAPI 解析工具的参数\n\n * 类型:ParseToolOptions\n * 默认值:{}\n\n\n\n\npreviewMode#\n\n代码块预览方式。\n\n * 类型:'internal' | 'iframe'\n * 默认值: 'internal'\n\ninternal时,代码块内容将会直接渲染在页面中,反之将会通过 iframe 加载。\n\n\ndeprecated: languages#\n\nWARNING\n\n从 2.44.0 版本开始,请参考 国际化 章节来实现多语言。\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\n从 2.44.0 版本开始,内部实现了嗅探机制,请直接使用 _meta.json 或者直接配置 sidebar 来实现自定义侧边栏。\n\n\n命令行#\n\n * modern dev: 启动文档站本地开发。\n * modern build --platform: 构建生产环境产物。\n\n\n进阶指南#\n\n以上已经介绍完了开发模块文档的基本内容,但是这对于开发一个完整的文档站是不够的。查看Rspress以深入了解我们的文档框架。 你可以通过 doc\n配置来修改文档框架配置。\n\n","routePath":"/module-tools/guide/basic/use-module-doc","lang":"zh","toc":[{"text":"开始之前","id":"开始之前","depth":2,"charIndex":29},{"text":"为什么我们需要为模块搭建一个文档站点","id":"为什么我们需要为模块搭建一个文档站点","depth":3,"charIndex":37},{"text":"前置准备","id":"前置准备","depth":3,"charIndex":146},{"text":"站点基本结构","id":"站点基本结构","depth":2,"charIndex":233},{"text":"配置侧边栏","id":"配置侧边栏","depth":3,"charIndex":625},{"text":"编写文档","id":"编写文档","depth":2,"charIndex":830},{"text":"组件预览","id":"组件预览","depth":2,"charIndex":916},{"text":"示例","id":"示例","depth":3,"charIndex":973},{"text":"移动端预览","id":"移动端预览","depth":3,"charIndex":1216},{"text":"使用外部 demo","id":"使用外部-demo","depth":3,"charIndex":1369},{"text":"使用内置组件","id":"使用内置组件","depth":2,"charIndex":1461},{"text":"API","id":"api","depth":3,"charIndex":1505},{"text":"解析文件","id":"解析文件","depth":4,"charIndex":1525},{"text":"内容生成","id":"内容生成","depth":4,"charIndex":1563},{"text":"组件使用","id":"组件使用","depth":4,"charIndex":2032},{"text":"Overview","id":"overview","depth":3,"charIndex":2092},{"text":"插件配置","id":"插件配置","depth":2,"charIndex":2360},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":2368},{"text":"doc","id":"doc","depth":3,"charIndex":2478},{"text":"entries","id":"entries","depth":3,"charIndex":2493},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":2596},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":2749},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":2818},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":2936},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":3003},{"text":"命令行","id":"命令行","depth":2,"charIndex":3112},{"text":"进阶指南","id":"进阶指南","depth":2,"charIndex":3184}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":76,"title":"使用 Storybook","content":"#\n\nStorybook 是一个专门用于组件调试的工具,它围绕着组件开发提供了:\n\n * 丰富多样的调试能力\n * 可与一些测试工具结合使用\n * 可重复使用的文档内容\n * 可分享能力\n * 工作流程自动化\n\n在使用 Storybook 时,难免会遇到各种配置问题,需要手动配置 Babel 插件,手动配置 Webpack 去支持 less,sass 等。\nModern.js 集成了 Storybook,这对于我们开发 Storybook 项目来说极大地简化了配置工作。\n\n\nV7 (推荐)#\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建配置文件夹 .storybook,以及默认配置文件 .storybook/main.ts\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @storybook/addon-essential 和 @modern-js/storybook,以及创建\n storybook 相关脚本。\n\n\n开启产物调试#\n\n事实上,Modern.js Module 是基于 esbuild 实现的,而 Storybook 使用 Webpack\n作为默认构建工具,二者的配置无法完全兼容, 所以这里我们推荐先对组件进行构建,然后在 stories 里引入组件产物。\n\n引入组件产物的方式非常简单,假设你的模块导出了一个 Button 组件,那么在 stories 里可以这样使用:\n\n\n\n如果想要更新组件,则可以在启动 Storybook 前启动监听模式的构建:\n\n\n\nINFO\n\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:\n\n对于 pnpm 的项目,可以按照下面的内容对 package.json 进行修改:\n\n\n\n> 关于 pnpm 的 publishConfig 的使用,可以阅读下面这个链接。\n\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在开发阶段和发布阶段对 package.json 的 types 的值进行修改。\n\n\n开启 Rspack 构建#\n\nRspack 构建速度非常快,只需要如下配置即可使用 Rspack 作为构建工具。\n\n\n\n注意上面配置中,更改了 reactDocgen 配置,因为 Rspack 目前还不支持\n@storybook/react-docgen-typescript-plugin。\n\n\n配置#\n\n在 .storybook/main.js 中包含一些独有的配置。\n\nbundler#\n\n * 类型: 'webpack' | 'rspack'\n * 默认值: webpack\n\n指定底层打包工具使用 Webpack 还是 Rspack。\n\n\n\nbuilderConfig#\n\n * 类型: BuilderConfig\n * 默认值: undefined\n\nModern.js 的 Storybook 构建能力由 Rsbuild 提供,可通过 builderConfig 修改 Rsbuild 构建配置。\n\n\n\n\n命令行#\n\n@modern-js/storybook 代理了部分 storybook cli 的命令。\n\nstorybook dev#\n\n启动 Storybook,查看详情\n\nstorybook build#\n\n对 Storybook 进行生产环境构建,查看详情\n\n\n配置文件#\n\n配置文件中除了 Rsbuild 配置还包含一个额外的字段,builderPlugins,方便使用 Rsbuild 插件,例如启用 SWC 编译。\n\n\n\n\n从 V6 迁移至 V7#\n\n我们对于两个版本的支持方式不同,因此如果你是从 V6 迁移至 V7 的用户,我们希望你也按上述方式使用 V7,同时做以下调整:\n\n * 配置文件:将原来 root/config/storybook/main.(j|t)s 里的自定义配置(如果有)迁移到新的\n root/.storybook/main.(j|t)s。\n * 依赖:升级 @storybook/addon-* 系列依赖(如果有)到 7 版本,并删除 @modern-js/plugin-storybook 依赖。\n * 命令: 将原来 edenx dev storybook 和 edenx build --platform 命令删除,如果习惯了原来的 pnpm run\n dev 的调用方式,可以 将其替换成 storybook dev -p 6006 和 storybook build。\n * modern.config.(j|t)s : 删除 @modern-js/plugin-storybook 插件的注册。\n\n\nV6 (legacy)#\n\n从 2.40.0 版本开始,@modern-js/plugin-storybook将停止迭代。建议使用 V7 版本。 如果你的\n@modern-js/module-tools 版本低于 2.40.0,可以按照以下方式使用 Storybook V6:\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @modern-js/plugin-storybook,以及添加 pnpm dev storybook\n 等相关脚本。\n\n\n配置 Storybook#\n\nStorybook 官方通过一个名为 .storybook 的文件夹来进行项目配置,其中包含各种配置文件。在 Modern.js Module 中,可以在项目的\nconfig/storybook 目录下增加 Storybook 配置文件。\n\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\n\n * Configure Storybook\n\n不过这在模块项目里使用时存在一些限制:\n\n * 不能修改 Story 文件存放的位置,即无法在 main.js 文件里修改 stories 配置。\n * 不能修改 Webpack 和 Babel 相关的配置,即无法在 main.js 文件里修改 webpackFinal 和 babel 配置。\n\n\n构建 Storybook 产物#\n\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\n\n\n\n构建完成后,可以在 dist/storybook-static 目录看到构建产物文件。","routePath":"/module-tools/guide/basic/using-storybook","lang":"zh","toc":[{"text":"V7 (推荐)","id":"v7-推荐","depth":2,"charIndex":239},{"text":"开启 Storybook","id":"开启-storybook","depth":3,"charIndex":250},{"text":"开启产物调试","id":"开启产物调试","depth":3,"charIndex":492},{"text":"开启 Rspack 构建","id":"开启-rspack-构建","depth":3,"charIndex":946},{"text":"配置","id":"配置","depth":3,"charIndex":1095},{"text":"bundler","id":"bundler","depth":4,"charIndex":1134},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":1222},{"text":"命令行","id":"命令行","depth":3,"charIndex":1356},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":1409},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":1444},{"text":"配置文件","id":"配置文件","depth":3,"charIndex":1490},{"text":"从 V6 迁移至 V7","id":"从-v6-迁移至-v7","depth":2,"charIndex":1574},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":2037},{"text":"开启 Storybook","id":"开启-storybook-1","depth":3,"charIndex":2178},{"text":"配置 Storybook","id":"配置-storybook","depth":3,"charIndex":2358},{"text":"构建 Storybook 产物","id":"构建-storybook-产物","depth":3,"charIndex":2705}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":77,"title":"开发组件","content":"#\n\n本章将要介绍如何使用 Modern.js Module 开发组件项目。\n\n\n初始化项目#\n\n 1. 推荐使用 @modern-js/create 命令来初始化一个 npm 项目。\n\n\n\n 2. 初始化的目录结构如下:\n\n\n\n 3. 最后修改 ./src/index.ts 文件后缀和内容如下,就完成了组件项目的初始化。\n\n\n\n\n使用 Storybook 调试代码#\n\n请参考 「使用 Storybook」 来使用 Storybook 调试代码。\n\n\n开发样式#\n\n接下来我们可以给组件添加样式。\n\n目前支持开发样式的能力有:\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module 支持 PostCSS,并且内置了以下 PostCSS 插件:\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\n因此我们可以在项目中创建 .css 文件,并且可以直接在 css 文件中使用这些插件提供的语法支持和能力。\n\n * 源代码:\n\n\n\n * CSS 产物:\n\n\n\n\nLess#\n\nModern.js Module 支持使用 Less 开发样式。\n\n> 目前内置的 Less 版本为 v4.1.3\n\n * 源代码:\n\n\n\n * Less 产物:\n\n\n\n\nSass/Scss#\n\nModern.js Module 支持使用 Scss/Sass 开发样式。\n\n> 目前内置的 Sass 版本为 v1.54.4\n\n * 源代码:\n\n\n\n * Sass 产物:\n\n\n\n\nTailwind CSS#\n\n请参考 「使用 Tailwind CSS」 来了解相关用法。\n\n\nCSS Modules#\n\nModern.js Module 支持使用 CSS Module 开发样式。默认情况下会将以下文件识别为 CSS Module 文件:\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\n如果需要对 CSS Modules 进行配置,可以查看以下 API:\n\n * style.autoModules\n * style.modules\n\n下面是一个代码示例:\n\n\n\n\n\n\n配置构建产物#\n\n根据组件项目使用的多数场景,推荐使用 npm-component 构建预设。该预设得到的产物目录结构为:\n\n\n\n * ./dist/es: 包含了支持 es6 语法的 ES modules 格式的 bundleless 产物。\n * ./dist/lib: 包含了支持 es6 语法的 CommonJS 格式的 bundleless 产物。\n * ./dist/types: 包含了类型文件。\n\n如果对使用语法支持有要求,可以手动配置 buildPreset,并且支持在 npm-component 基础上增加后缀的方式修改支持的语法:\n\n\n\n如果对构建产物目录结构有特殊需求,则可以使用 buildConfig API,可以通过以下文档来了解使用方式:\n\n * 修改输出产物\n * 深入理解构建\n\n\n发布组件#\n\n推荐使用 Modern.js Module 提供的版本发布功能,可以参考 「版本管理与发布」。","routePath":"/module-tools/guide/best-practices/components","lang":"zh","toc":[{"text":"初始化项目","id":"初始化项目","depth":2,"charIndex":40},{"text":"使用 Storybook 调试代码","id":"使用-storybook-调试代码","depth":2,"charIndex":166},{"text":"开发样式","id":"开发样式","depth":2,"charIndex":227},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":335},{"text":"Less","id":"less","depth":3,"charIndex":587},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":680},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":784},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":832},{"text":"配置构建产物","id":"配置构建产物","depth":2,"charIndex":1071},{"text":"发布组件","id":"发布组件","depth":2,"charIndex":1431}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":78,"title":"使用 Tailwind CSS","content":"#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\nModern.js Module 支持使用 Tailwind CSS 开发组件样式。\n\n\n启用 Tailwind CSS#\n\n在 Modern.js Module 中使用 Tailwind CSS,你只需要按照以下步骤操作:\n\n 1. 在项目根目录下执行 pnpm run new,按照如下进行选择:\n\n\n\n成功开启后,你会看到 package.json 中新增了 tailwindcss 和 @modern-js/plugin-tailwindcss 依赖。\n\n 2. 在 modern.config.ts 中注册 Tailwind 插件:\n\n\n\n 3. 创建 index.css 文件,添加以下代码:\n\n\n\nINFO\n\n根据需求不同,你可以选择性地导入 Tailwind CSS 提供的 CSS 样式。请参考 @tailwind 文档 来了解 @tailwind 指令的详细用法。\n\n 4. 引用 index.css 文件,比如在入口的 src/index.jsx 文件添加如下代码:\n\n\n\n 5. 然后即可在各个组件中使用 Tailwind CSS 提供的 Utility Class 了:\n\n\n\n\n配置 Tailwind CSS#\n\n在 Modern.js Module 中,你有两种方式来配置 Tailwind CSS:\n\n 1. 使用 tailwind.config.{ts,js} 文件,该用法与 Tailwind CSS 的官方用法一致,请参考 \"Tailwind CSS -\n Configuration\" 来了解更多用法。\n\n\n\nTIP\n\n请升级 Modern.js Module 到 >= 2.33.0 版本,以支持自动读取 tailwind.config.{ts,js} 文件。\n\n 2. 使用 style.tailwindcss 配置项,这是旧版本的用法,我们更推荐使用 tailwind.config.{ts,js} 文件进行配置。\n\n\n\n如果你同时使用了 tailwind.config.{ts,js} 文件和 style.tailwindcss 选项,那么 style.tailwindcss\n定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n\n\nTailwind CSS 自动补全#\n\nTailwind CSS 官方提供了 Tailwind CSS IntelliSense 插件,用于在 VS Code 中自动补全 Tailwind CSS 的\nclass names、CSS functions 和 directives。\n\n你可以参考以下步骤来启动自动补全功能:\n\n 1. 在 VS Code 中安装 Tailwind CSS IntelliSense 插件。\n 2. 如果项目的根目录没有 tailwind.config.{ts,js} 文件,那么你需要创建该文件,并写入当前项目的 Tailwind CSS 配置,否则\n IDE 插件将无法正确生效。\n\n\n构建模式#\n\n在使用 Tailwind CSS 时,请注意构建产物在 bundle 和 bundleless 两种模式下会有很大区别。\n\nTIP\n\n关于 bundle 和 bundleless 的定义,可以查看 「深入理解构建」\n\n\nBundle 模式#\n\n在 Bundle 模式下,会生成一份单独的产物 CSS 文件,并且 JS 产物不会自动引用产物 CSS 文件。\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n\n如果你需要将样式注入 JS 产物中,可以开启 style.inject 选项。\n\n如果你没有开启 style.inject,那么也可以让用户手动引用产物 CSS 文件:\n\n\n\n\nBundleless 模式#\n\n在 Bundleless 模式下,默认会引用产物 CSS 文件,无须进行额外处理。\n\n * 产物代码:\n\n\n\n\n类名前缀#\n\n你可以通过 Tailwind CSS 提供的 prefix 选项来添加类名前缀,这样可以避免潜在的类名冲突问题(比如 App 和 Module 使用了不同版本的\nTailwind CSS)。\n\n例如,通过 prefix 选项添加 foo- 前缀:\n\n\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n用法介绍#\n\n下面是一些 Tailwind CSS 的用法示例。\n\n\nHTML 类名#\n\nTailwind CSS 支持在 HTML 标签上通过类名的方式增加样式。当使用 HTML 类名的时候,请注意必须要提前导入 Tailwind CSS 相应的\nCSS 样式。\n\n\n\n样式产物(此时是 bundle 构建):\n\n\n\n\n@apply#\n\nTailwind CSS 提供了 @apply 指令,可以通过它将 Tailwind CSS 提供的样式内联到我们编写的样式中。\n\n@apply 可以用于 CSS、Less、Sass 中。\n\n\n\n但是使用过程中,对于 Less 和 Sass 有些情况需要注意:\n\nSass#\n\n当将 Tailwind 与 Sass 一起使用时,@apply 后面存在 !important 的时候,需要使用插值来让 Sass 正确编译。\n\n * 不能正常工作:\n\n\n\n * 能够正常工作:\n\n\n\nLess#\n\n在与 Less 一起使用 Tailwind 时,你不能嵌套 Tailwind 的 @screen 指令。\n\n * 不能正常工作:\n\n\n\n * 相反,使用常规的媒体查询和 theme() 函数来引用你的屏幕尺寸,或者干脆不要嵌套你的 @screen 指令。\n\n\n\n\n\n\n关于 designSystem 配置#\n\ndesignSystem 是 Modern.js Module 中废弃的配置项。\n\n从 Modern.js Module v2.33.0 版本开始,你可以使用 Tailwind CSS 的 theme 配置项来代替\ndesignSystem,不再需要将 theme 配置拆分并设置到 designSystem 上。\n\n * 旧版本用法:\n\n\n\n * 当前版本用法:\n\n","routePath":"/module-tools/guide/best-practices/use-tailwindcss","lang":"zh","toc":[{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":2,"charIndex":127},{"text":"配置 Tailwind CSS","id":"配置-tailwind-css","depth":2,"charIndex":585},{"text":"Tailwind CSS 自动补全","id":"tailwind-css-自动补全","depth":2,"charIndex":1047},{"text":"构建模式","id":"构建模式","depth":2,"charIndex":1360},{"text":"Bundle 模式","id":"bundle-模式","depth":3,"charIndex":1477},{"text":"Bundleless 模式","id":"bundleless-模式","depth":3,"charIndex":1660},{"text":"类名前缀","id":"类名前缀","depth":2,"charIndex":1732},{"text":"用法介绍","id":"用法介绍","depth":2,"charIndex":1890},{"text":"HTML 类名","id":"html-类名","depth":3,"charIndex":1925},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":2192},{"text":"Less","id":"less","depth":4,"charIndex":2300},{"text":"关于 `designSystem` 配置","id":"关于-designsystem-配置","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":79,"title":"通用类问题","content":"#\n\n\nModern.js Module 和 Rsbuild 的关系?#\n\nModern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于解决 Web 应用构建场景。\n\n\nModern.js Module 是否可以使用 webpack plugin 或者 loader?#\n\nModern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。 这里可以发现更多 esbuild 社区插件\n\n如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 UMD Plugin 构建 UMD 产物。","routePath":"/module-tools/guide/faq/basic","lang":"zh","toc":[{"text":"Modern.js Module 和 Rsbuild 的关系?","id":"modernjs-module-和-rsbuild-的关系","depth":2,"charIndex":3},{"text":"Modern.js Module 是否可以使用 webpack plugin 或者 loader?","id":"modernjs-module-是否可以使用-webpack-plugin-或者-loader","depth":2,"charIndex":103}],"domain":"","frontmatter":{},"version":""},{"id":80,"title":"构建相关问题","content":"#\n\n这里只记录了一些常见问题和 bad case。\n\n如果是构建产物不符合预期的场景,尤其是配置了 buildPreset 的情况下, 请先了解 buildPreset 代表了哪些配置项,再根据所有的配置项逐个检查\n\n\n产物问题#\n\n\nClass Fields 的初始化处理#\n\nTypeSript 提供了 useDefineForClassFields 配置用于控制对于 public class fields 的转换处理。\n\n如果有一段代码:\n\n\n\n当 useDefineForClassFields 为 false 的时候,则编译后的代码会变为:\n\n\n\n当 useDefineForClassFields 为 true 的时候,则编译后的代码会变为:\n\n\n\n同时该配置的默认值会根据 tsconfig.json 的 target 配置而变化:当 target 是 ES2022 或者更高的时候,则\nuseDefineForClassFields 默认配置为 true,否则就是默认为 false。\n\n关于 TypeScript 这个配置的更多信息,可以参考下面的链接:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nModern.js Module 目前会根据下面的逻辑进行处理:\n\n 1. 首先根据当前项目的 tsconfig.json 的 useDefineForClassFields 配置确定在 Modern.js Module\n 内部如何处理。目前只会读取当前项目路径下的 tsconfig.json 文件的内容,暂时不支持根据 extends 配置来获取最终的 tsconfig\n 配置。\n 2. 如果没有检测 tsconfig.json 的 useDefineForClassFields 配置,则会根据 tsconfig.json 的\n target 配置来确定默认值。如果 target 大于 ES2022(包含 EsNext),则useDefineForClassFields默认为\n true,否则为 false。\n 3. 如果没有检测到 tsconfig.json 的 target,则按照 useDefineForClassFields的值 为 true 进行处理。\n\n\nbabel-plugin-lodash 将引入的 lodash 处理成 undefined#\n\n当使用类似下面的方式的时候,会出现这个问题:\n\n\n\n目前在 babel-plugin-lodash Github 上的相关 Issue:\n\n * #235\n\n这个问题的解决办法是移除 babel-plugin-lodash,因为此时不需要该插件进行按需引用,使用该插件会产生副作用。\n\n类似的情况在 babel-plugin-import 上也可能会出现。比如有类似如下的代码:\n\n\n\n此时 babel-plugin-import 也可能会导致 Comps 变为 undefined。因此也需要移除对应的 babel-plugin-import。\n\n\nCannot find module http#\n\n如果产物在浏览器运行时报了类似 Cannot find module 'http' 的错误,说明你的产物打包进了 node 模块。\n这可能会发生于你的依赖里有一些同时支持 browser 和 node 的三方包,例如 axios,此时只需要将 platform 设置为 browser 即可。\n如果一些三方包不支持 browser, 你可能需要手动注入 node polyfill。\n\n\n异常类问题#\n\n\nDynamic require of \"react\" is not supported#\n\n问题描述#\n\n当构建的产物配置中产物格式为 ES modules 的时候:\n\n\n\n如果导入了的第三方 npm 包的 cjs 产物,那么生成的产物可能会在 webpack 下有可能无法正常运行。\n\n\n\n解决办法#\n\n 1. 首先需要找到是哪个第三方包引起的问题。例如报错信息中指向了 react 这个包,那么就要寻找在哪个第三方包里存在 require('react')\n 这样的代码。比如 react-draggable ,这个包仅包含 cjs 产物,那么问题定位到 react-draggable 这个包。\n 2. 然后我们需要将这个包通过下面的配置进行排除,即不打包存在问题的第三方包。\n\n\n\n参考链接#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\n编译过程中,因为某个组件库的 less 文件报错:'Operation on an invalid type'#\n\n可能是因为该组件库依赖的 Less 版本是 v3,而 Modern.js Module 默认是 v4。v3 与 v4 在 math 配置上存在有 Break\nChange,可以查看这个链接 了解详情。\n\n因此,如果是在源码中使用了类似这样的组件库:\n\n在构建配置中使用了 buildPreset 的情况下,按照下面进行修改:\n\n\n\n或者使用了自定义的 buildConfig 的情况下,按照下面进行修改:\n\n\n\n如果是在 Storybook 中使用了类似这样的组件,则需要修改 Storybook 的调试配置:\n\n\n\n\nBundleless DTS failed#\n\n在不打包的场景下,是直接 tsc\n生成类型声明文件。通过终端打印的错误信息,你可以找到问题文件。对于源码文件,推荐将类型问题进行修复,这能够更好地使你的包得到复用。但如果遇到三方包的类型检查问题\n:\n\n 1. 开启 skipLibCheck 来跳过三方包的 d.ts 检查。\n 2. 如果三方包直接导出 ts 文件, skipLibCheck 将会失效,因为其只能跳过 d.ts 检查,因此你只能关闭 dts.abortOnError\n 来忽略这些错误。\n\n\nBundle DTS failed#\n\nModern.js Module 直接使用 rollup-plugin-dts 来打包你的类型描述文件。 它可能无法处理某些第三方依赖的类型文件。\n\n如果遇到 Modern.js Module 构建过程中出现 Bundle DTS failed\n的错误信息标题的时候,可以观察报错信息是来自某个第三方依赖。尝试设置 dts.respectExternal 为 false\n来关闭打包第三方依赖的类型文件的行为。\n\n\ndefineConfig 函数类型报错:如果没有引用 \"...\",则无法命名 \"default\" 的推断类型#\n\n检查项目的 tsconfig.json 文件中是否存在 include 配置,如果没有,则尝试增加下面的内容:\n\n\n\n\n其他#\n\n\nbundleless 如何跳过对 less / scss 文件的预处理#\n\nbundleless 是单文件编译的方式,只需要将你的 less / scss 文件从入口里移除并且将其拷贝到产物里即可。 注意我们还会把 js 引用 less\n/ scss 的 moduleId 进行改写,你可以通过 redirect 配置关闭它。\n\n下面是一个跳过 less 文件处理的例子,你会发现 src 里面所有的 less 文件都被拷贝到 dist 里并且保留了一致的相对路径。\n\n\n\n\n增加额外的编译能力#\n\nModern.js Module 基于 esbuild 实现,因此如果有特殊需求或者想要增加额外的编译能力,可以通过实现 esbuild 插件来解决。\n\nModern.js Module 提供了 esbuildOptions 配置允许修改 Modern.js Module 内部的 esbuild\n配置,因此可以通过该配置来增加自定义的 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\n\n支持生成 CSS Modules 的 TypeScript 声明文件#\n\n * 方案一:typed-css-modules\n * 方案二:postcss-modules-dts\n\n","routePath":"/module-tools/guide/faq/build","lang":"zh","toc":[{"text":"产物问题","id":"产物问题","depth":2,"charIndex":110},{"text":"Class Fields 的初始化处理","id":"class-fields-的初始化处理","depth":3,"charIndex":118},{"text":"babel-plugin-lodash 将引入的 lodash 处理成 `undefined`","id":"babel-plugin-lodash-将引入的-lodash-处理成-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module http","id":"cannot-find-module-http","depth":3,"charIndex":1337},{"text":"异常类问题","id":"异常类问题","depth":2,"charIndex":1557},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":1566},{"text":"问题描述","id":"问题描述","depth":4,"charIndex":1612},{"text":"解决办法","id":"解决办法","depth":4,"charIndex":1712},{"text":"参考链接","id":"参考链接","depth":4,"charIndex":1914},{"text":"编译过程中,因为某个组件库的 less 文件报错:`'Operation on an invalid type'`","id":"编译过程中因为某个组件库的-less-文件报错operation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":2336},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":2593},{"text":"`defineConfig` 函数类型报错:`如果没有引用 \"...\",则无法命名 \"default\" 的推断类型`","id":"defineconfig-函数类型报错如果没有引用-则无法命名-default-的推断类型","depth":3,"charIndex":-1},{"text":"其他","id":"其他","depth":2,"charIndex":2938},{"text":"bundleless 如何跳过对 less / scss 文件的预处理","id":"bundleless-如何跳过对-less--scss-文件的预处理","depth":3,"charIndex":2944},{"text":"增加额外的编译能力","id":"增加额外的编译能力","depth":3,"charIndex":3182},{"text":"支持生成 CSS Modules 的 TypeScript 声明文件","id":"支持生成-css-modules-的-typescript-声明文件","depth":3,"charIndex":3490}],"domain":"","frontmatter":{},"version":""},{"id":81,"title":"常见问题","content":"#\n\n这里是 Modern.js Module 常见问题分类列表:\n\n * 通用类问题\n * 构建相关问题\n * Storybook 相关问题\n * 测试相关问题","routePath":"/module-tools/guide/faq/","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":82,"title":"Storybook 相关问题","content":"#\n\n\n支持 Storybook v7#\n\nStorybook v7 目前已全面支持并已成为我们的推荐使用版本。\n\n\n使用 Storybook Addon 或者其他配置不生效#\n\nModern.js Module 目前使用的 Storybook 版本是 v6,如果使用了 v7 版本的 Addon 可能会出现插件不生效的情况。\n\n除了 Addon 以外,其他配置也可能会有区别。比如修改 preview.js 配置文件的话,Storybook v6 与 v7 的写法也不相同:\n\n * v6:文档链接\n * v7:文档链接\n\n\nCannot find module 'react-dom/package.json#\n\n在执行 Storybook 调试的时候,出现下面的报错提示:\n\n\n\n解决办法:在项目中安装 react-dom 依赖。\n\n\n\n\n报错后,看不到具体报错信息#\n\n解决办法:\n\n 1. 找到 @storybook/core-server/dist/cjs/dev-server.js\n 2. 找到 var _await$Promise$all = await Promise.all([preview, manager 这附近的代码。\n 3. 修改成:\n\n\n\n\nCouldn't find any stories is your Storybook#\n\n\n\n当在预览区域看到类似这样的报错提示的时候,首先可以打开一下浏览器的控制台,应该会有些报错信息。可以先根据报错信息来推断是不是编写代码里出现的问题导致\nStorybook 无法正常运行。修复后,再次刷新查看是否正常。\n\n\nStorybook 添加 Proxy 功能#\n\nStorybook 没有提供相关方案,不过 Storybook Issue 中有找到相关的解决办法。在 Modern.js Module 中,你可以:\n\n 1. 添加 config/storybook/middleware.js 文件,并初始化下面的内容:\n\n\n\n 2. 添加 http-proxy-middleware 依赖\n 3. 添加代理路由相关配置\n\n\n\n相关 issue 链接:#11551。","routePath":"/module-tools/guide/faq/storybook","lang":"zh","toc":[{"text":"支持 Storybook v7","id":"支持-storybook-v7","depth":2,"charIndex":3},{"text":"使用 Storybook Addon 或者其他配置不生效","id":"使用-storybook-addon-或者其他配置不生效","depth":2,"charIndex":58},{"text":"Cannot find module 'react-dom/package.json","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":263},{"text":"报错后,看不到具体报错信息","id":"报错后看不到具体报错信息","depth":2,"charIndex":372},{"text":"Couldn't find any stories is your Storybook","id":"couldnt-find-any-stories-is-your-storybook","depth":2,"charIndex":537},{"text":"Storybook 添加 Proxy 功能","id":"storybook-添加-proxy-功能","depth":2,"charIndex":695}],"domain":"","frontmatter":{},"version":""},{"id":83,"title":"测试相关问题","content":"#\n\n\n执行 test 命令报错 TypeError: Cannot read property 'testEnvironmentOptions' of\nundefined#\n\n\n\n问题原因多是存在多个版本的 jest-environment-jsdom 依赖,可以检查 Monorepo 中其他项目是否有\njest-environment-jsdom 依赖,并通过 Monorepo 提供的 overrides 能力统一依赖版本。","routePath":"/module-tools/guide/faq/test","lang":"zh","toc":[{"text":"执行 `test` 命令报错 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`","id":"执行-test-命令报错-typeerror-cannot-read-property-testenvironmentoptions-of-undefined","depth":2,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":84,"title":"快速开始","content":"#\n\n\n三分钟快速上手#\n\n想要实际体验 Modern.js Module?首先你需要安装 Node.js LTS,并确保 Node 版本大于等于 16.0.0。我们推荐使用\nNode.js 18 的 LTS 版本。\n\n\n创建新项目#\n\n如果你想要创建一个完整的 Modern.js Module 项目,可以执行以下命令:\n\n\n\nINFO\n\n执行 npx @modern-js/create -h 查看更多命令行参数\n\n接着在问题交互中,按照如下选择:\n\n\n\n> 项目名称为 package.json 中的 \"name\" 字段值。\n\n接着就会开始初始化项目的流程。在项目目录和文件生成以及依赖安装完毕后,此时就创建了一个完整的 Modern.js Module 项目。\n\n我们可以直接执行 pnpm build 命令启动项目的构建,执行 pnpm build --watch 命令开启构建的观察模式。\n\n\n接入已有项目#\n\n在你的项目里安装以下依赖:\n\n * \"@modern-js/module-tools\"\n\n * \"typescript\"(如果不是 TypeScript 项目,则省略)\n\n> 对于使用 pnpm 或者 Yarn 包管理器的项目,只需要替换 npm 就可以了。推荐使用 pnpm。\n\n接着在项目的根目录下创建 modern.config.(t|j)s 文件:\n\n\n\n最后在项目的 package.json 文件里增加命令 \"build\": \"modern build\":\n\n\n\n如果你的项目存在 src/index.(js|jsx) 文件或者同时存在 src/index.(ts|tsx) 和 tsconfig.json\n文件,那么恭喜你可以运行直接运行 npm run build 来使用 Modern.js Module 构建你的项目了。\n\n\n核心 npm 包#\n\n@modern-js/module-tools 是 Modern.js Module 的核心 npm 包,主要提供以下能力:\n\n * 提供 modern dev, modern build 等常用的 CLI 命令。\n * 集成 Modern.js Core,提供配置解析、插件加载等能力。\n * 集成 esbuild 和 SWC,提供构建能力。\n * 集成一些最为常用的插件,比如 plugin-lint、plugin-changeset 等。\n\n@modern-js/module-tools 是基于 Modern.js 的插件体系实现的,本质上是一个插件,因此你需要在配置文件的 plugins\n字段中注册 moduleTools:\n\n\n\n\n查看官方示例#\n\n如果你想要看看使用了 Modern.js Module 的完整项目,可以执行以下命令:\n\n\n\n\n让我们开始吧#\n\n选择适合你的教程:\n\n * 我是初学者,需要学习 Modern.js Module 的基础使用。\n * 我已经初步掌握了 Modern.js Module 的使用,可以学习 Modern.js Module 的进阶指南。\n * 我需要扩展项目能力,需要学习如何开发 Modern.js Module 的插件。","routePath":"/module-tools/guide/intro/getting-started","lang":"zh","toc":[{"text":"三分钟快速上手","id":"三分钟快速上手","depth":2,"charIndex":3},{"text":"创建新项目","id":"创建新项目","depth":3,"charIndex":110},{"text":"接入已有项目","id":"接入已有项目","depth":3,"charIndex":402},{"text":"核心 npm 包","id":"核心-npm-包","depth":3,"charIndex":784},{"text":"查看官方示例","id":"查看官方示例","depth":3,"charIndex":1118},{"text":"让我们开始吧","id":"让我们开始吧","depth":2,"charIndex":1175}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":85,"title":"欢迎使用","content":"#\n\nModern.js Module 是 Modern.js\n的模块工程解决方案,同时也是核心依赖。它可以让开发者更轻松地构建、调试、发布模块类型的项目。模块类型的项目大多数情况可以认为是 npm\n包类型的项目,它可能是一个组件、组件库或者工具库项目。\n\n如果你正打算开发一个 npm 包类型的项目,那么你就来对地方了!Modern.js 提供了专业的模块工程解决方案。它带来了:\n\n * 简单的项目初始化:仅需执行 npx @modern-js/create project-dir\n 命令,然后进行几个交互问题,就可以创建一个完整的模块类型项目。创建的项目还支持选择 pnpm、Yarn 两种包管理器。\n * 代码格式化:在模块工程项目中,你可以执行 modern lint 来对代码进行格式化。同时初始化的模块工程项目里包含了 Modern.js 的\n ESLint 规则集,可以满足大部分场景下的需求。\n * 全面的构建能力和更快的构建速度:Modern.js Module 基于 esbuild 和 SWC\n 提供了高性能的构建能力,并且为不同构建模块的场景提供了丰富的配置。\n * Storybook 调试工具:Modern.js Module 为调试模块项目提供了 Storybook 调试工具。在安装了 Modern.js\n Module 的 Storybook 插件后,你可以使用 storybook dev 命令来启动它。你不仅可以使用 Storybook\n 对组件进行调试,也可以使用在其他类型的模块上。\n * 集成 Jest 的测试能力:在需要对模块测试的时候,可以使用 Modern.js Module 的 modern test 命令。Modern.js\n Module 不仅集成了 Jest,同时也提供了配置 Jest 的 API。\n * 基于 Changesets 实现的版本管理:当需要对项目记录变更内容的时候,可以使用 modern change 命令生成包含变更内容的 Markdown\n 文件;当需要对项目进行版本升级的时候,可以使用 modern bump 命令通过 Markdown 文件分析并升级版本;当需要发布项目的时候,可以使用\n modern release 命令对项目进行发布。Modern.js Module 基于 Changesets 实现了这些命令。\n * 可扩展性的插件机制:想要为项目集成其他的调试工具?又或者是想要在构建过程中做一些额外处理?Modern.js Module\n 提供了插件机制和插件钩子,插件钩子覆盖了 dev 命令和 build 命令两个流程。你可以通过它们为项目进行能力的扩展。\n * 还有更多:Modern.js Module\n 在未来还会不断地在构建、调试功能上进行优化。如果在模块项目构建上存在需要解决的重要问题,又或者是某个主流的模块项目调试工具、模式出现的时候,那么它们很可能\n 成为 Modern.js Module 将要支持功能。","routePath":"/module-tools/guide/intro/welcome","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":86,"title":"为什么需要 Modern.js Module","content":"#\n\n大家可能都经历过:从零开始开发一个组件库或者工具库的过程中,我们不仅要考虑项目本身的代码逻辑如何编写,还要考虑项目的构建、调试、测试、代码格式化等等和代码逻辑无\n关的事情。\n\n比如说,当我们考虑构建模块项目的代码是使用什么构建工具的时候,在之前我们可能会考虑使用 webpack 还是 Rollup,然而现在的话,也许还会考虑是使用\nesbuild 还是 SWC。\n\n无论选择哪个构建工具,这对于没有熟练掌握这些构建工具使用方式的开发者来说,是需要一定的成本去学习的。即使想要快速使用,也会需要花费大量的时间和精力。\n\n而除了构建这件事情以外,像为项目提供调试工具、支持测试能力、增加代码格式校验等等,对于一个新手来说都有可能需要花费很长的时间和精力了解或者掌握它们,并且真正的服\n务于当前的项目中。\n\n而为了保证代码质量以及项目的完整性,我们往往是需要做这些与代码逻辑实现无关的事情。然而这些事情很有可能会影响整体的项目开发进度,降低开发者的开发体验,会让开发者\n感觉模块项目的开发门槛很高。\n\n如果说每次开发一个模块类型的项目都需要经历一遍这些工作准备的话,那么基本上刚开始开发的时间会大部分花费在这些与代码实现无关的事情上。如果能够提供一个模块工程解决\n方案,它能够帮助开发者解决项目工程上的事情,让开发者可以更专注于代码的实现上,那么这将会大大提升模块类型项目的开发体验。\n\n\n\nModern.js 为了让开发模块类型的项目更简单、解决上述提到的问题,提供了模块工程解决方案,并且通过 Modern.js Module\n提供了主要的功能。Modern.js Module 可以理解为是一个专门用于模块类型项目开发的工具。","routePath":"/module-tools/guide/intro/why-module-engineering-solution","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":88,"title":"快速开始","content":"#\n\nModern.js Module 不仅提供了丰富的功能,同时也支持通过插件的方式为当前项目扩展能力。\n\n我们可以通过下面的例子来快速了解如何编写一个 Modern.js Module 插件:\n\n 1. 首先我们在初始化的项目下创建 ./plugins/example.ts 文件。\n\n\n\n 2. 接着在 example.ts 文件中增加插件的代码。\n\n\n\n 3. 然后我们通过 plugins API,将刚刚写好的插件进行注册。\n\n\n\n 4. 最后运行 modern build,就可以看到:\n\n\n\n通过上面这个例子,我们了解到了下面几件事:\n\n * 推荐的插件目录结构\n * 插件的初始化代码\n * 插件的注册\n\n除了以上内容以外,我们还需要了解:\n\n * 插件对象、类型定义与推荐配置项\n * setup 函数、api 对象参数、生命周期钩子","routePath":"/module-tools/plugins/guide/getting-started","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":89,"title":"插件对象","content":"#\n\nModern.js Module 的插件是一个对象,对象包含以下属性:\n\n * name:插件的名称,唯一标识符。\n * setup:插件初始化函数,只会执行一次。setup 函数可以返回一个 Hooks 对象,Modern.js Module 会在特定的时机执行 Hooks\n 对象上定义的 Hook 对应的函数。\n\n例如在下面的插件代码示例中,在项目开始执行构建任务之前会触发 beforeBuild 函数的执行,并打印 build start 的 log 内容。\n\n\n\n\n\n\n插件类型定义#\n\n使用 TypeScript 时,可以引入内置的 CliPlugin 和 ModuleTools 类型,为插件提供正确的类型推导:\n\n\n\n\n插件配置项#\n\n建议将插件写成函数的形式,使插件能通过函数入参来接收配置项:\n\n","routePath":"/module-tools/plugins/guide/plugin-object","lang":"zh","toc":[{"text":"插件类型定义","id":"插件类型定义","depth":2,"charIndex":245},{"text":"插件配置项","id":"插件配置项","depth":2,"charIndex":323}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":90,"title":"Setup 函数","content":"#\n\n在「插件对象」 部分我们知道插件对象包含了一个 setup 函数,该函数不仅包含了一个 api 对象参数,同时还可以返回一个 Hooks 对象。\n\n\n插件 API 对象#\n\n插件的 setup 函数会提供一个 api 对象参数,你可以调用该对象上提供的一些方法来获取到配置、项目上下文等信息。\n\n\n\n\napi.useAppContext#\n\n用于获取项目上下文信息。\n\n\n\nINFO\n\n通过实际的类型文件,我们可以看到还存在一些其他字段,不过目前对于 Modern.js Module 有意义的字段只有以上内容,api 对象其他的方法也是如此。\n\n\napi.useResolvedConfigContext#\n\n用于获取解析之后的最终配置。\n\nINFO\n\n如果需要获取构建相关的最终配置,需要使用 beforeBuild Hook。\n\n\n\n\napi.useHookRunners#\n\n用于获取 Hooks 的执行器,并触发特定的 Hook 执行。\n\n\n\n\n异步 setup#\n\nCLI 插件的 setup 可以是一个异步函数,在初始化过程中执行异步逻辑。\n\n\n\n注意,只有当前插件的 setup 异步函数执行完毕,才会继续执行下一个插件的 setup 函数。因此,你需要避免在 setup\n函数中进行耗时过长的异步操作,防止影响 CLI 启动性能。\n\n\n生命周期钩子#\n\n我们知道 setup 函数会返回一个 Hooks 对象,所谓 Hooks 对象也可以理解是具有 Modern.js Module 生命周期钩子的对象。\n\n目前主要包含两类钩子:\n\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n关于生命周期钩子的完整列表参考 API 文档。","routePath":"/module-tools/plugins/guide/setup-function","lang":"zh","toc":[{"text":"插件 API 对象","id":"插件-api-对象","depth":2,"charIndex":77},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"异步 setup","id":"异步-setup","depth":2,"charIndex":430},{"text":"生命周期钩子","id":"生命周期钩子","depth":2,"charIndex":579}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":91,"title":"总览","content":"#\n\n\n官方插件#\n\n * @modern-js/plugin-module-import:使用 SWC 提供与 babel-plugin-import 一样的能力。\n * @modern-js/plugin-module-banner:为每个 JS 和 CSS 文件的顶部和底部添加自定义内容,例如版权信息。\n * @modern-js/plugin-module-node-polyfill:会自动注入 Node 核心模块在浏览器端的 polyfills。\n * @modern-js/plugin-module-polyfill:为你的代码中使用到的不支持的功能注入 polyfill。\n * @modern-js/plugin-module-babel:使用 Babel 转换你的代码。\n * @modern-js/plugin-module-vue:提供对 Vue 3 组件构建的支持。","routePath":"/module-tools/plugins/official-list/overview","lang":"zh","toc":[{"text":"官方插件","id":"官方插件","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":92,"title":"Babel 插件","content":"#\n\nTIP\n\n通常情况下,我们无需使用 Babel 转换我们的代码,此插件仅作为一种降级方式。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时需要打包 A,B 两个文件,并只需要在打包 A 时使用 babel:\n\n\n\n\n配置#\n\nSee Babel options\n\n下面是一个配置了@babel/preset-env的例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-babel","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":50},{"text":"安装","id":"安装","depth":3,"charIndex":58},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":64},{"text":"配置","id":"配置","depth":2,"charIndex":172}],"domain":"","frontmatter":{},"version":""},{"id":93,"title":"Banner 插件","content":"#\n\n提供为每个 JS 和 CSS 文件的顶部和底部注入内容的能力。\n\nTIP\n\n从 @modern-js/module-tools 2.36.0 版本开始,该插件功能内置在 Modern.js Module 中,由 banner 和\nfooter 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\nTIP\n\n注意:CSS 的注释不支持 //comment 这样的写法。详见「CSS 注释」\n\n\n示例#\n\n\n在 JS 文件顶部增加版权信息#\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nbanner#\n\n在顶部增加内容。\n\n * banner.js:在 JS 文件顶部增加内容。\n * banner.css:在 CSS 文件顶部增加内容。\n\n\nfooter#\n\n在底部增加内容。\n\n * footer.js:在 JS 文件底部增加内容。\n * footer.css:在 CSS 文件底部增加内容。","routePath":"/module-tools/plugins/official-list/plugin-banner","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":132},{"text":"安装","id":"安装","depth":3,"charIndex":140},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":146},{"text":"示例","id":"示例","depth":2,"charIndex":240},{"text":"在 JS 文件顶部增加版权信息","id":"在-js-文件顶部增加版权信息","depth":3,"charIndex":246},{"text":"配置","id":"配置","depth":2,"charIndex":267},{"text":"banner","id":"banner","depth":3,"charIndex":283},{"text":"footer","id":"footer","depth":3,"charIndex":362}],"domain":"","frontmatter":{},"version":""},{"id":94,"title":"Import 插件","content":"#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现。\n\nTIP\n\n从 @modern-js/module-tools 2.16.0 版本开始,该插件功能内置在 Modern.js Module 中,由\ntransformImport 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n这样我们就可以在 Modern.js Module 中使用自动导入的能力了。\n\n\n配置#\n\n * 类型:\n\n\n\n\npluginImport#\n\n * 类型:object[]\n\n其中数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n\n注意事项#\n\nSWC (Speedy Web Compiler) 是基于 Rust 语言编写的,而该插件是基于 SWC,移植自\nbabel-plugin-import,配置选项保持了一致。\n\n一些配置可以传入函数,例如 customName,customStyleName 等, 但在 Modern.js Module\n里,我们不建议在此配置项里使用函数。 因为我们会在 esbuild 的插件里调用 SWC,然后再当 Rust 通过 Node-API\n调用这些配置函数时,会出现死锁现象。\n\n简单的函数逻辑其实可以通过模版语言来代替,下面是一个 customName 使用模板的示例:\n\n\n\n添加以下配置:\n\n\n\n其中的 {{ member }} 会被替换为相应的引入成员,转换后:\n\n\n\n可以看出配置 customName: \"foo/es/{{ member }}\" 的效果等同于配置 customName: (member) =>\n`foo/es/${member}` 。\n\n这里使用到的模版是 handlebars,模版配置中还内置了一些有用的辅助工具,还是以上面的导入语句为例,配置成:\n\n\n\n会转换成下面的结果:\n\n\n\n除了 kebabCase 以外还有 camelCase,snakeCase,upperCase,lowerCase 可以使用。","routePath":"/module-tools/plugins/official-list/plugin-import","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":144},{"text":"安装","id":"安装","depth":3,"charIndex":152},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":158},{"text":"配置","id":"配置","depth":2,"charIndex":245},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":261},{"text":"注意事项","id":"注意事项","depth":2,"charIndex":357}],"domain":"","frontmatter":{},"version":""},{"id":95,"title":"Node Polyfill 插件","content":"#\n\nNode Polyfill 介绍\n\n通常情况下,我们不会在浏览器端使用 Node 模块。但在当前代码需要同时在 Node 端和浏览器端运行时,用到一些 Node 模块是有可能的。Node\nPolyfill 为这些 Node 模块提供了浏览器版本的 polyfills。\n\n通过使用 Node Polyfill 插件,会自动注入 Node 核心模块在浏览器端的 polyfills,让你可以在浏览器端放心使用这些模块。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nexclude#\n\n排除要注入的 Node Polyfill。\n\n\n\n\noverrides#\n\n覆盖内置的 Node Polyfill。\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\n当你在代码中使用以上全局变量时,对应 polyfill 会被自动注入。\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\n当你通过 require 或 import 等语法在代码中引用以上模块时,对应 polyfill 会被注入。\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\n目前浏览器端没有以上模块的 polyfill,因此当你引用以上模块时,会自动 fallback 为一个空对象。\n\n","routePath":"/module-tools/plugins/official-list/plugin-node-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":213},{"text":"安装","id":"安装","depth":3,"charIndex":221},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":227},{"text":"配置","id":"配置","depth":2,"charIndex":274},{"text":"exclude","id":"exclude","depth":3,"charIndex":290},{"text":"overrides","id":"overrides","depth":3,"charIndex":326},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":363},{"text":"Globals","id":"globals","depth":3,"charIndex":381},{"text":"Modules","id":"modules","depth":3,"charIndex":464},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":860}],"domain":"","frontmatter":{},"version":""},{"id":96,"title":"Polyfill 插件","content":"#\n\nTIP\n\n通常情况下,我们不需要为 npm 包注入 polyfill,这一步应该在 Web\n应用的框架侧完成,但是在某些场景,为了让我们的库能够直接运行在低版本浏览器里,我们需要注入 polyfill。\n\n请注意,此插件并不会转化你的代码语法,只会为你的代码中使用到的不支持的功能注入 polyfill,把它们作为普通函数导入而不是污染全局。你需要安装\ncore-js-pure 依赖\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时具有多份构建配置,并只需要在 bundle 构建时注入 polyfill:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\ntargets#\n\n参考 Babel target.\n\n下面是一个例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":197},{"text":"安装","id":"安装","depth":3,"charIndex":205},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":211},{"text":"配置","id":"配置","depth":2,"charIndex":322},{"text":"targets","id":"targets","depth":3,"charIndex":338}],"domain":"","frontmatter":{},"version":""},{"id":97,"title":"Vue 插件","content":"#\n\nVue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 esbuild-plugin-vue3 和 @vue/babel-plugin-jsx。\n\nWARNING\n\n请注意,此插件仍有一些用法限制:\n\n 1. 目前此插件的实现是直接集成社区插件,因此不支持在 sfc 里写 jsx/tsx。\n 2. 如果要为组件生成 d.ts,请使用官方推荐方式 vue-tsc。\n 3. 仅支持打包场景,推荐将 input 设置为 ['src/**/*.vue'] 或者 ['src/index.ts']。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\n传递给 @vue/babel-plugin-jsx 的选项,请查阅 @vue/babel-plugin-jsx 文档 来了解具体用法。","routePath":"/module-tools/plugins/official-list/plugin-vue","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":256},{"text":"安装","id":"安装","depth":3,"charIndex":264},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":270},{"text":"配置","id":"配置","depth":2,"charIndex":317},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":323}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file +[{"id":49,"title":"buildConfig","content":"#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项,它包含了构建的所有配置。\n\n * 类型:object | object[]\n\nTIP\n\n在开始使用 buildConfig 之前,请先阅读以下文档来了解其作用:\n\n * 修改输出产物\n * 深入理解构建\n\n\nalias#\n\n * 类型:Record | Function\n * 默认值:{'@': 'src',}\n\nTIP\n\n对于 TypeScript 项目,只需要在 tsconfig.json 中配置 compilerOptions.paths, Modern.js Module\n会自动识别 tsconfig.json 里的别名,因此不需要额外配置 alias 字段。\n\n\n\n以上配置完成后,如果在代码中引用 @common/Foo.tsx, 则会映射到 /src/common/Foo.tsx 路径上。\n\nalias 的值定义为函数时,可以接受预设的 alias 对象,并对其进行修改。\n\n\n\n也可以在函数中返回一个新对象作为最终结果,新对象会覆盖预设的 alias 对象。\n\n\n\n\nasset#\n\n包含静态资源相关的配置。\n\n\nasset.name#\n\n静态资源输出文件名。\n\n * 类型: string | ((assetPath) => name)\n * 默认值: [name].[hash].[ext]\n\n当 asset.name 为 string 类型时,会自动对 [name]、[ext]、[hash] 进行替换,分别替换为文件名、拓展名、文件 hash。\n如果想要更高的自由度,可以把 asset.name 作为方法使用,返回值即为文件名。此时,该方法接收一个参数 assetPath,对应资源路径。\n\n\n\n\nasset.limit#\n\n用于设置静态资源被自动内联为 base64 的体积阈值。\n\nModern.js Module 在进行打包时,默认会内联体积小于 10KB 的图片、字体、媒体等资源,将它们通过 Base64\n编码,并内联到产物中,不再会发送独立的 HTTP 请求。\n\n你可以通过修改 limit 参数来调整这个阈值。\n\n * 类型: number\n * 默认值: 10 * 1024\n\n例如,将 limit 设置为 0 来避免资源内联:\n\n\n\n\nasset.path#\n\n静态资源输出路径,会基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: assets\n\n\nasset.publicPath#\n\n打包时给未内联资源的 CDN 前缀。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n此时,所有静态资源都会添加 https://xxx/ 前缀。\n\n\nasset.svgr#\n\n打包时将 SVG 作为一个 React 组件处理,options 参考 svgr,另外还支持了 include 和 exclude\n两个配置项,用于匹配需要处理的 SVG 文件。\n\n * 类型: boolean | object\n * 默认值: false\n\n开启 svgr 功能后,可以使用默认导出的方式将 SVG 当做组件使用。\n\n\n\n当开启功能后,可以新建一个类型描述文件,并在 modern-app-env.d.ts 文件中增加,修改使用 SVG 的类型:\n\n\n\n\n\n\nasset.svgr.include#\n\n设定匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: /\\.svg$/\n\n\nasset.svgr.exclude#\n\n设定不匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: undefined\n\n\nasset.svgr.exportType#\n\n用于配置使用 SVGR 时 SVG 的导出形式。\n\n * 类型: 'named' | 'default'\n * 默认值: default\n\n当此选项设置为 'named' 时,你可以使用以下语法导入组件:\n\n\n\n命名导出默认为 ReactComponent,并可以通过 asset.svgr.namedExport 进行自定义。\n\n\nautoExtension#\n\n根据 format 和 type 自动添加产物里 js 文件和类型描述文件的后缀。\n\n * 类型:boolean\n * 默认值:false\n * 版本:>=2.38.0\n\n关闭时,js 产物后缀为 .js,类型描述文件后缀为 d.ts。\n\n开启后,当 type 为 module 时,node 默认将 .js 作为 esm 加载,因此当我们要输出 cjs 产物时,js 产物后缀为\n.cjs,类型描述文件后缀为 d.cts; 反之,如果缺少 type 字段或者 type 为 commonjs 时, node 默认将 .js 文件作为 cjs\n加载,因此当我们要输出 esm 产物时,js 产物后缀为 .mjs,类型描述文件后缀为 d.mts。\n\nWARNING\n\n在 bundleless 模式下使用时,我们会有一步额外的操作,那就是处理每个文件里的 import/export 语句。我们会给相对路径加上 js\n文件后缀,可能是 .mjs 或者 .cjs,这取决于你的包配置,此行为可以通过 redirect.autoExtension关闭。\n\n注意 noUselessIndex 规则会破坏此行为,你需要禁用此规则 如果你需要在 bundleless 使用此配置,请补齐 index,例如 utils\n是一个文件夹, 你需要将 改写为\n\n\n\n\nautoExternal#\n\n自动外置项目的 \"dependencies\" 和 \"peerDependencies\",不会将其打包到最终的 bundle 产物中。\n\n * 类型: boolean | object\n * 默认值: true\n\n当我们希望关闭对于第三方依赖的默认处理行为时候,可以通过以下方式来实现:\n\n\n\n这样对于 \"dependencies\" 和 \"peerDependencies\" 下面的依赖都会进行打包处理。如果只想要关闭其中某个下面的依赖处理,则可以使用\nbuildConfig.autoExternal 的对象形式:\n\n\n\n\nautoExternal.dependencies#\n\n是否需要外置项目的 \"dependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nautoExternal.peerDependencies#\n\n是否需要外置项目的 \"peerDependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nbanner#\n\n提供为每个 JS , CSS 和 DTS 文件的顶部和底部注入内容的能力。\n\n\n\n * 类型: BannerAndFooter\n * 默认值: {}\n * 版本: >=2.36.0\n\n例如你想为 JS 和 CSS 文件添加版权信息:\n\n\n\n\nbuildType#\n\n构建类型,bundle 会打包你的代码,bundleless 只做代码的转换。\n\n * 类型: 'bundle' | 'bundleless'\n * 默认值: 'bundle'\n\n\ncopy#\n\n将文件或目录拷贝到指定位置。\n\n * 类型: object\n\n\n\n\ncopy.patterns#\n\n * 类型: CopyPattern[]\n * 默认值: []\n\n\n\n\ncopy.options#\n\n * 类型:\n\n\n\n * 默认值: { concurrency: 100, enableCopySync: false }\n\n * concurrency: 指定并行执行多少个复制任务。\n\n * enableCopySync: 使用 fs.copySync,默认情况下 fs.copy。\n\n\ndefine#\n\n定义全局变量,注入到代码中\n\n * 类型: Record\n * 默认值: {}\n\n由于 define 功能是由全局文本替换实现的,所以需要保证全局变量值为字符串,更为安全的做法是将每个全局变量的值转化为字符串,如下所示:\n\nINFO\n\n框架内部会自动进行 JSON 序列化处理,因此不需要手动执行序列化。\n\n如果不需要自动序列化,可以通过配置 esbuildOptions 定义 alias 来实现。\n\n\n\n不过要注意:如果项目是一个 TypeScript 项目,那么你可能需要在项目源代码目录下的 .d.ts 文件里增加以下内容:\n\n> 如果不存在 d.ts 文件,则可以手动创建。\n\n\n\n我们也可以进行环境变量替换:\n\n\n\n通过上面的配置,我们就可以将下面这段代码:\n\n\n\n在执行 VERSION=1.0.0 modern build 的时候,转换为:\n\n\n\nTIP\n\n为了防止全局替换替换过度,建议使用时遵循以下两个原则:\n\n * 全局常量使用大写\n * 自定义全局常量前缀后缀,确保独一无二\n\n\ndts#\n\n类型文件生成的相关配置,默认情况会生成。\n\n * 类型: false | object\n * 默认值:\n\n\n\n\ndts.abortOnError#\n\n用于控制在出现类型错误的时候,是否允许构建成功。\n\n * 类型:boolean\n * 默认值:true\n\n默认情况下,在出现类型错误的时候会导致构建失败。将 abortOnError 设置为 false 后,即使代码中出现了类型问题,构建依然会成功:\n\n\n\nWARNING\n\n当关闭该配置后,无法保证类型文件能正常生成,且不保证内容正确。在 buildType: 'bundle' 时,即打包模式下,类型文件一定不会生成。\n\n\ndts.distPath#\n\n类型文件的输出路径,基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: ./\n\n比如输出到 outDir 下面的 types 目录:\n\n\n\n\ndts.enableTscBuild#\n\n开启 tsc '--build' 选项。当使用 project reference 时, 可以使用 '--build'\n选项以实现项目之间的协同工作以加快构建速度。\n\n此选项要求版本 > 2.43.0, 事实上,我们在 2.42.0 版本曾试验性地开启此选项,但其带来的许多问题使我们不得不动态开启。\n\n\n\n * 类型: boolean\n * 默认值: false\n * 版本: >2.43.0\n\n\n\n\ndts.only#\n\n是否在构建时只生成类型文件,不生成 JavaScript 产物文件。\n\n * 类型: boolean\n * 默认值: false\n\n\n\n\ndts.respectExternal#\n\n当设为 false 时,不会打包任何三方包类型,设为 true 时,会根据 externals 来决定是否需要打包三方类型。\n\n在对类型文件进行打包时,构建工具还未对 export\n进行分析,因此当你引用的任何一个三方包出现类型错误时,都可能会中断当前的构建流程,这会导致构建流程不可控,因此我们可以通过这个配置来避免该问题。\n\n * 类型: boolean\n * 默认值: true\n\n\n\n\ndts.tsconfigPath#\n\n废弃,使用 tsconfig 配置替代。\n\n指定用于生成类型文件的 tsconfig 文件路径。\n\n\n\n\nesbuildOptions#\n\n用于修改底层的 esbuild 配置。\n\n * 类型: Function\n * 默认值: c => c\n\n例如,我们需要修改生成文件的后缀:\n\n\n\n例如,注册一个 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\nTIP\n\n我们在原本 esbuild 构建的基础上做了许多扩展,因此使用此配置需要注意以下几点:\n\n 1. 优先使用 Modern.js Module 提供的配置,例如 esbuild 并不支持 target: 'es5',但我们内部使用 SWC\n 支持了此场景,此时通过 esbuildOptions 设置target: 'es5'会报错。\n 2. 目前我们内部使用 enhanced-resolve 替代了 esbuild 的 resolve 解析算法,所以修改 esbuild resolve\n 相关配置无效,计划在未来会切换回来。\n\n\nexternalHelpers#\n\n默认情况下,输出的 JS 代码可能会依赖一些辅助函数来支持目标环境或者输出格式,这些辅助函数会被内联在需要它的文件中。\n\n使用此配置,将会使用 SWC 对代码进行转换,将内联的辅助函数转换为从外部模块 @swc/helpers 导入这些辅助函数。\n\n * 类型:boolean\n * 默认值:false\n\n下面是使用该配置前后的产物变化比较。\n\n开启前:\n\n\n\n开启后:\n\n\n\n\nexternals#\n\n用于在打包时排除一些外部依赖,避免将这些依赖打包到最终的 bundle 中。\n\n * 类型:\n\n\n\n * 默认值: []\n * 构建类型:仅支持 buildType: 'bundle'\n * 示例:\n\n\n\n\nfooter#\n\n同 banner 配置,用于在输出文件末尾添加注释。\n\n\nformat#\n\n用于设置 JavaScript 产物输出的格式,其中 iife 和 umd 只在 buildType 为 bundle 时生效。\n\n * 类型:'esm' | 'cjs' | 'iife' | 'umd'\n * 默认值:cjs\n\n\nformat: esm#\n\nesm 代表 \"ECMAScript 模块\",它需要运行环境支持 import 和 export 语法。\n\n * 示例:\n\n\n\n\nformat: cjs#\n\ncjs 代表 \"CommonJS\",它需要运行环境支持 exports、require 和 module 语法,通常为 Node.js 环境。\n\n * 示例:\n\n\n\n\nformat: iife#\n\niife 代表 \"立即调用函数表达式\",它将代码包裹在函数表达式中,确保代码中的任何变量不会意外地与全局范围中的变量冲突,通常在浏览器环境中运行。\n\n * 示例:\n\n\n\n\nformat: umd#\n\numd 代表 \"Universal Module Definition\",用于在不同环境(浏览器、Node.js 等)中运行。umd\n格式的模块可以在多种环境下使用,既可以作为全局变量访问,也可以通过模块加载器(如 RequireJS)进行模块化加载。\n\n * 示例:\n\n\n\n\nhooks#\n\n构建生命周期钩子,允许在构建流程的特定阶段注入自定义逻辑。\n\n * 类型:\n\n\n\n * 默认值:[]\n\n我们可以在 apply 方法里拿到 compiler 实例,修改其属性,以及在不同阶段执行自定义逻辑,对于 Hook 的详细介绍, 参考使用 Hook\n介入构建流程。\n\n\n\n\ninput#\n\n指定构建的入口文件,数组形式可以指定目录。\n\n * 类型:\n\n\n\n * 默认值:bundle 模式下默认为 ['src/index.ts'],bundleless 模式下默认为 ['src']\n\n数组用法:\n\n在 bundle 模式下,下面的配置会以 src/index.ts 和 src/index2.ts 为入口分别进行构建。bundle 模式不支持配置 input\n为目录。\n\n\n\n在 bundleless 模式下,下面的配置会同时处理 src/a 目录下的文件和 src/index.ts 文件。\n\n\n\n在 bundleless 模式下,数组模式还支持使用 ! 来过滤部分文件:\n\n\n\n上面的配置将打包 src 目录下的文件,同时会过滤以 spec.ts 为后缀的文件。这在测试文件与源码文件在同一个根目录下的情况会很有用。\n\n对象用法:\n\n当在 bundle 模式下需要修改产物的输出文件名称的时候,可以使用对象形式进行配置。\n\n对象的 Key 是产物的文件名称,Value 是源码的文件路径。\n\n\n\n\njsx#\n\n指定 JSX 的编译方式,默认支持 React 17 及更高版本,自动注入 JSX 运行时代码。\n\n * 类型: automatic | transform | preserve\n * 默认值: automatic\n\n如果你需要支持 React 16,则可以设置 jsx 为 transform:\n\n\n\nTIP\n\n如果你不需要转换 JSX ,可以设置 jsx 为 preserve, 但此时请不要使用 swc 做代码转换。 关于 JSX Transform\n的更多说明,可以参考以下链接:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\n这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。\n\n * 类型:boolean\n * 默认值:false\n * 构建类型:仅支持 buildType: 'bundle'\n\n开启 metafile 生成:\n\n\n\n在执行 build 构建后,产物目录下会生成 metafile-[xxx].json 文件,你可以通过 esbuild analyze 和\nbundle-buddy 等工具进行可视化分析。\n\n\nminify#\n\n使用 esbuild 或者 terser 压缩代码,也可以传入 terserOptions。\n\n * 类型: 'terser' | 'esbuild' | false | object\n * 默认值: false\n\n\n\n\noutDir#\n\n指定构建的输出目录。\n\n * 类型: string\n * 默认值: ./dist\n\n\n\n\nplatform#\n\n默认生成用于 Node.js 环境下的代码,你也可以指定为 browser,会生成用于浏览器环境的代码。 查看esbuild.platform了解更多。\n\n * 类型: 'browser' | 'node'\n * 默认值: 'node'\n\n\n\n\nredirect#\n\n在 buildType: 'bundleless' 构建模式下,会对引用路径进行重定向,确保指向了正确的产物,例如:\n\n * import './index.less' 会被改写成 import './index.css'\n * 会被改写成 (依实际情况而定)\n * 会被改写成 (如果生成了 utils.mjs,视实际情况而定)\n\n在某些场景下,你可能不需要这些功能,那么可以通过此配置关闭它,关闭后,其引用路径将不会发生改变。\n\n\n\n\nresolve#\n\n自定义模块解析选项\n\n\nresolve.mainFields#\n\npackage.json 中,在解析包的入口点时尝试的字段列表。\n\n * 类型:string[]\n * 默认值:取决于platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * 版本:>=2.36.0\n\n例如,我们想要先加载 js:source 字段:\n\n\n\nWARNING\n\nresolve.mainFields 比 package.json 中 exports 字段的优先级低,如果一个入口点从 exports\n成功解析,resolve.mainFields 将被忽略。\n\n\nresolve.jsExtentions#\n\n支持隐式文件扩展名\n\n * 类型: string[]\n * 默认值: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * 版本:>=2.36.0\n\n对于 css 文件,请不要使用隐式文件扩展名,目前 Module 仅支持 ['.less', '.css', '.sass', '.scss'] 后缀。\n\nNode 的解析算法不会将 .mjs 和 cjs 视为隐式文件扩展名,因此这里默认也不会,但是可以通过更改此配置来包含:\n\n\n\n\nshims#\n\n在构建 cjs / esm 产物时注入一些垫片代码。\n\n例如 __dirname 只能在 commonjs 里使用,开启此选项后,当产物格式为 esm 时,会将 __dirname 编译为\npath.dirname(fileURLToPath(import.meta.url))。\n\n详细代码见 shims, 需要注意的是 esm shims 只会在 platform 为 node 时注入,因为用到了 url 模块。\n\n * 类型: boolean\n * 默认值: false\n * 版本:>=2.38.0\n\n\n\n\nsideEffects#\n\n配置模块的副作用\n\n * 类型: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * 默认值: undefined\n\n通常情况下,我们通过 package.json 的 \"sideEffects\" 字段来配置模块的副作用,但是在某些情况下,三方包的 package.json\n是不可靠的。 例如我们引用了一个三方包的样式文件。\n\n\n\n但是这个三方包的 package.json 里并没有将样式文件配置到 \"sideEffects\" 里。\n\n\n\n同时你又设置了 style.inject 为 true,在控制台可以看到类似的警告信息:\n\n\n\n这时候就可以使用这个配置项,手动配置模块的\"sideEffects\",配置支持正则和函数形式。\n\n\n\nTIP\n\n添加此配置后,打包时将不会再读取 package.json 里的 \"sideEffects\" 字段。\n\n\nsourceDir#\n\n指定构建的源码目录,默认为 src,用于在 bundleless 构建时基于源码目录结构生成对应的产物目录。 等同于esbuild.outbase。\n\n * 类型: string\n * 默认值: src\n\n\nsourceMap#\n\n控制 sourceMap 如何生成。\n\n * 类型: boolean | 'inline' | 'external'\n * 默认值: false\n\n\nsourceType#\n\nWARNING\n\n已废弃,此配置不会产生任何影响。\n\n设置源码的格式。默认情况下,会将源码作为 EsModule 进行处理。当源码使用的是 CommonJS 的时候,需要设置 commonjs。\n\n * 类型:'commonjs' | 'module'\n * 默认值:'module'\n\n\nsplitting#\n\n是否开启代码分割。 仅支持 format: 'esm' 和 format: 'cjs',查看esbuild.splitting了解更多。\n\n * 类型: boolean\n * 默认值: false\n\n\nstyle#\n\n配置样式相关的配置。\n\n\nstyle.less#\n\nless 相关配置。\n\n\nstyle.less.lessOptions#\n\n详细配置参考 less。\n\n * 类型: object\n * 默认值: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\n在入口文件起始添加 Less 代码。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n\nstyle.less.implementation#\n\n配置 Less 使用的实现库,在不指定的情况下,使用的内置版本是 4.1.3。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置 object 类型时,可以指定 Less 的实现库。\n\n\n\nstring 类型时,指定 Less 的实现库的路径\n\n\n\n\nsass#\n\nSass 相关配置。\n\n\nstyle.sass.sassOptions#\n\n详细配置参考 node-sass\n\n * 类型: object\n * 默认值: {}\n\n\nstyle.sass.additionalData#\n\n在入口文件起始添加 Sass 代码。\n\n * 类型: string | Function\n * 默认值: undefined\n\n\n\n\nstyle.sass.implementation#\n\n配置 Sass 使用的实现库,在不指定的情况下,使用的内置版本是 1.5.4。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置为 object 类型时,可以指定 Sass 的实现库。\n\n\n\nstring 类型时,指定 Sass 的实现库的路径\n\n\n\n\nstyle.postcss#\n\n用于配置 PostCSS 的选项,传入的值会与默认配置通过 Object.assign 合并。注意 Object.assign 是浅拷贝,因此会完全覆盖内置的\nplugins 数组。\n\n详细配置请查看 PostCSS。\n\n * 类型:\n\n\n\n * 默认值:\n\n\n\n * 示例:\n\n\n\n\nstyle.inject#\n\n配置打包模式下是否将 CSS 样式插入到 JavaScript 代码中。\n\n * 类型: boolean\n * 默认值: false\n\n将 inject 设置为 true 来开启此功能:\n\n\n\n开启后,你会看到源码中引用的 CSS 代码被包含在了打包后的 JS 产物中。\n\n例如,你在源码里写了 import './index.scss',那么在产物中你会看到以下代码:\n\n\n\nTIP\n\n开启 inject 后,你需要注意以下几点:\n\n * CSS 文件中的 @import 不会被处理。如果你的 CSS 文件中有 @import ,那么你需要在 JS 文件中手动引入 CSS\n 文件(less,scss 文件不需要,因为它们会有预处理)。\n * 需要考虑 sideEffects 的影响。默认情况下,我们的构建器会认为 CSS 是有副作用的,如果你的项目中或者三方包的 package.json\n 设置了 sideEffects 字段并且没有包含此 CSS 文件,那么你将会得到一个警告:\n\n\n\n此时可以通过配置 sideEffects 来解决。\n\n\nstyle.autoModules#\n\n根据文件名自动启用 CSS Modules。\n\n * 类型: boolean | RegExp\n * 默认值: true\n\ntrue : 为以 .module.css .module.less .module.scss .module.sass 文件名结尾的样式文件启用 CSS\nModules。\n\nfalse : 禁用 CSS Modules.\n\nRegExp : 为匹配正则条件的所有文件启用 CSS Modules.\n\n\nstyle.modules#\n\nCSS Modules 配置。\n\n * 类型: object\n * 默认值: {}\n\n一个常用的配置是 localsConvention,它可以改变 CSS Modules 的类名生成规则。\n\n\n\n对于以下样式:\n\n\n\n你可以使用 styles.boxTitle 来访问。\n\n详细配置查看 postcss-modules\n\n\nstyle.tailwindcss#\n\n用于修改 Tailwind CSS 的配置项。\n\n * 类型: object | Function\n * 默认值:\n\n\n\n\n启用 Tailwind CSS#\n\n在使用 style.tailwindcss 之前,你需要启用 Modern.js Module 的 Tailwind CSS 插件。\n\n请阅读「使用 Tailwind CSS」 章节来了解开启方式。\n\n\n类型#\n\n值为 object 类型时,与默认配置通过 Object.assign 合并。\n\n值为 Function 类型时,函数返回的对象与默认配置通过 Object.assign 合并。\n\n其他的使用方式和 Tailwind CSS 一致: 快速传送门。\n\n\n注意事项#\n\n注意:\n\n * 如果你同时使用了 tailwind.config.{ts,js} 文件和 tools.tailwindcss 选项,那么\n tools.tailwindcss 定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n * 如果你同时使用了 designSystem 配置项,那么 Tailwind CSS 的 theme 配置将会被 designSystem 的值所覆盖。\n\n其他配置的使用方式与 Tailwind CSS 官方用法一致,请参考 tailwindcss - Configuration。\n\n\ntarget#\n\ntarget 用于为生成的 JavaScript 代码设置目标环境。它让 Modern.js Module 将目标环境无法识别的 JavaScript\n语法转换为在这些环境中可用的低版本 JavaScript 语法。\n\n * 类型:\n\n\n\n * 默认值: 'es6'\n\n例如,将代码编译到 es5 语法:\n\n\n\n\ntransformImport#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现,使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:object[]\n * 默认值:[]\n\n数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n参考「Import 插件——注意事项」\n\n\ntransformLodash#\n\n是否模块化 lodash 的导入,删除未使用的 lodash 模块,从而减少 lodash 代码体积。这项优化基于 babel-plugin-lodash 和\nswc-plugin-lodash 实现。 使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:boolean\n * 默认值:false\n\n当开启此选项时,Modern.js Module 会自动将 lodash 的代码引用指向子路径。\n\n比如:\n\n\n\n转换后的代码:\n\n\n\n\ntsconfig#\n\nTypeScript 配置文件的路径。\n\n * 类型: string\n * 默认值: tsconfig.json\n * 版本: >=2.36.0\n\n\n\n\numdGlobals#\n\n指定 UMD 产物外部导入的全局变量。\n\n * 类型: Record\n * 默认值: {}\n\n\n\n此时,react 和 react-dom 会被看做是外部导入的全局变量,不会被打包进 UMD 产物中,而是通过 global.React 和\nglobal.ReactDOM 的方式进行访问。\n\n\numdModuleName#\n\n指定 UMD 产物的模块名。\n\n * 类型: string | Function\n * 默认值: name => name\n\n\n\n此时 UMD 产物会去挂载到 global.myLib 上。\n\nTIP\n * 需要遵守 UMD 规范,UMD 产物的模块名不能和全局变量名冲突。\n * 模块名会被转换为驼峰命名,如 my-lib 会被转换为 myLib,可参考toIdentifier。\n\n同时函数形式可以接收一个参数,为当前打包文件的输出路径\n\n","routePath":"/module-tools/api/config/build-config","lang":"zh","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":141},{"text":"asset","id":"asset","depth":2,"charIndex":483},{"text":"asset.name","id":"assetname","depth":2,"charIndex":506},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":753},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":981},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":1052},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":1159},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":1411},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":1510},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":1611},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":1802},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":2393},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":2670},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":2758},{"text":"banner","id":"banner","depth":2,"charIndex":2854},{"text":"buildType","id":"buildtype","depth":2,"charIndex":2984},{"text":"copy","id":"copy","depth":2,"charIndex":3087},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":3128},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":3180},{"text":"define","id":"define","depth":2,"charIndex":3341},{"text":"dts","id":"dts","depth":2,"charIndex":3802},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":3864},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":4097},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":4196},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":4419},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":4499},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":4718},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":4790},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":5293},{"text":"externals","id":"externals","depth":2,"charIndex":5501},{"text":"footer","id":"footer","depth":2,"charIndex":5617},{"text":"format","id":"format","depth":2,"charIndex":5655},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":5780},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":5859},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":5957},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":6058},{"text":"hooks","id":"hooks","depth":2,"charIndex":6211},{"text":"input","id":"input","depth":2,"charIndex":6359},{"text":"jsx","id":"jsx","depth":2,"charIndex":6824},{"text":"metafile","id":"metafile","depth":2,"charIndex":7147},{"text":"minify","id":"minify","depth":2,"charIndex":7385},{"text":"outDir","id":"outdir","depth":2,"charIndex":7505},{"text":"platform","id":"platform","depth":2,"charIndex":7559},{"text":"redirect","id":"redirect","depth":2,"charIndex":7693},{"text":"resolve","id":"resolve","depth":2,"charIndex":7924},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":7946},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":8263},{"text":"shims","id":"shims","depth":2,"charIndex":8520},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":8787},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":9229},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":9345},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":9432},{"text":"splitting","id":"splitting","depth":2,"charIndex":9590},{"text":"style","id":"style","depth":2,"charIndex":9703},{"text":"style.less","id":"styleless","depth":2,"charIndex":9724},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":9750},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":9841},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":9925},{"text":"sass","id":"sass","depth":2,"charIndex":10100},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":10120},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":10190},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":10285},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":10461},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":10620},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":11116},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":11350},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":11529},{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":3,"charIndex":11611},{"text":"类型","id":"类型","depth":3,"charIndex":11731},{"text":"注意事项","id":"注意事项","depth":3,"charIndex":11862},{"text":"target","id":"target","depth":2,"charIndex":12152},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":12318},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":12514},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":12756},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":12844},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":13004}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":50,"title":"buildPreset","content":"#\n\n构建的预设字符串或者预设函数。提供开箱即用的构建配置。\n\n * 类型:string | Function\n\n * 默认值: undefined\n\n\nnpm-library#\n\n在类 NPM 包管理器下使用的 Library 通用模式,包含 esm 和 cjs 两种 Bundle 产物,并且包含一份类型文件。\n\nINFO\n\n关于类 NPM 包管理器\n\n * npm\n * yarn\n * pnpm\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-library-with-umd#\n\n在类 NPM 包管理器下使用,并且 Library 支持类似 unpkg 的模式。在预设 'npm-library' 的基础上,额外提供 umd 产物。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component#\n\n在类 NPM 包管理器下使用的 组件(库)通用模式。包含 esm 和 cjs 两种 Bundleless 产物(便于 Tree shaking\n优化),以及包含一份类型文件。\n\n对于源码中包含的样式文件,产物中提供样式的编译产物和样式的源文件。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component-with-umd#\n\n在类 NPM 包管理器下使用的组件(库),同时支持类 unpkg 的模式。 在预设 'npm-component' 的基础上,额外提供 umd 产物。\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\n当想要使用支持其他 ECMAScript 版本的 buildPreset 预设的时候,可以直接在\n'npm-library'、'npm-library-with-umd'、'npm-component'、'npm-component-with-umd'\n这些预设值后面增加想要支持的版本。\n\n例如希望 'npm-library' 预设支持 'es2017',则可以按照如下方式配置:\n\n\n\n\nstring / function#\n\nbuildPreset 除了支持基本的字符串形式,还支持函数形式,可以通过 preset 或者 extendPreset\n参数获取我们提供的预设值,然后进行修改。\n\n以下是两个分别使用 preset 和 extendPreset 的例子:\n\n\n\nextendPreset 里会使用 lodash.merge 进行配置合并\n\n","routePath":"/module-tools/api/config/build-preset","lang":"zh","toc":[{"text":"`npm-library`","id":"npm-library","depth":2,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":2,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":2,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":2,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":2,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":835}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":51,"title":"dev","content":"#\n\n本章节描述了 Modern.js Module 关于调试工具相关的所有配置。\n\n\nstorybook#\n\nWARNING\n\nDeprecated:该配置已过时,只适用于 StorybookV6,详情请看使用Storybook。\n\n\nstorybook.webpack#\n\n * 类型:object | Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpack 来修改 Storybook Preview-iframe 的 webpack 配置。使用方式可以参考\nModern.js Builder 的 tools.webpack 配置。\n\n\n\n配置 Manager App#\n\n对于 Storybook Manager App 部分的 webpack 配置,可以通过增加 ./config/storybook/main.js\n文件进行配置。\n\n\n\n\nstorybook.webpackChain#\n\n * 类型:Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpackChain 来修改 Storybook Preview-iframe 的 webpack\n配置。使用方式可以参考 Modern.js Builder 的 tools.webpackChain 配置。","routePath":"/module-tools/api/config/dev","lang":"zh","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":43},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":118},{"text":"配置 Manager App","id":"配置-manager-app","depth":4,"charIndex":314},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":417}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":52,"title":"plugins","content":"#\n\n本章介绍注册 Modern.js Module 插件的配置。\n\n * 类型:ModuleToolsPlugin[]\n * 默认值:undefined\n\n\n插件执行顺序#\n\n默认情况下,自定义插件会按照 plugins 数组的顺序依次执行,Modern.js Module 内置插件的执行时机早于自定义插件。\n\n当插件内部使用了控制顺序的相关字段,比如 pre、post 时,会基于声明的字段对执行顺序进行调整,详见 插件之间的关系。\n\n\n开发插件#\n\n关于如何编写插件,可以查看「插件编写指南」。\n\n\n示例#\n\n\n使用 npm 上的插件#\n\n使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。\n\n\n\n使用本地插件#\n\n使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。\n\n\n\n\n插件配置项#\n\n如果插件提供了一些自定义的配置项,你可以通过插件函数的参数传入配置。\n\n","routePath":"/module-tools/api/config/plugins","lang":"zh","toc":[{"text":"插件执行顺序","id":"插件执行顺序","depth":2,"charIndex":79},{"text":"开发插件","id":"开发插件","depth":2,"charIndex":221},{"text":"示例","id":"示例","depth":2,"charIndex":253},{"text":"使用 npm 上的插件","id":"使用-npm-上的插件","depth":3,"charIndex":259},{"text":"使用本地插件","id":"使用本地插件","depth":4,"charIndex":316},{"text":"插件配置项","id":"插件配置项","depth":3,"charIndex":364}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":53,"title":"testing","content":"#\n\n本章描述了测试相关的配置。\n\nTIP\n\n需要先通过 pnpm run new 启用 单元测试 功能。\n\n\njest#\n\n * 类型: object | Function\n * 默认值:{}\n\n对应 Jest 的配置,当为 object 类型时,可以配置 Jest 所支持的所有底层配置 。\n\n\n\n值为 Function 类型时,默认配置作为第一个参数传入,需要返回新的 Jest 配置对象。\n\n\n\n\ntransformer#\n\n * 类型:'babel-jest' | 'ts-jest'\n * 默认值:'babel-jest'\n\n配置执行测试的时候对于源码的编译工具: babel-jest 或 ts-jest。默认使用 babel-jest。\n\nINFO\n\nbabel-jest 也可以编译 TS 文件,但不会类型报错,如果你需要跑测试的时候对 TS 类型进行校验,那么请使用 ts-jest。","routePath":"/module-tools/api/config/testing","lang":"zh","toc":[{"text":"jest","id":"jest","depth":2,"charIndex":55},{"text":"transformer","id":"transformer","depth":2,"charIndex":202}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":54,"title":"概览","content":"#","routePath":"/module-tools/api/","lang":"zh","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"概览","sidebar_position":1},"version":""},{"id":55,"title":"Plugin Hooks","content":"#\n\n本章介绍关于 Modern.js Module 支持的生命周期钩子。\n\n目前主要包含以下几类生命周期钩子:\n\n * 配置钩子:用于处理用户配置。\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n这里详细解释了 Hook 模型\n\n\n配置钩子#\n\n\nresolveModuleUserConfig#\n\n用于修改用户配置。\n\n类型:AsyncWaterfall\n\n\n\n\n构建钩子#\n\n在执行 build 命令的时候,会按照顺序触发以下 Hooks:\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\n执行整体构建流程之前触发。\n\n类型:ParallelWorkflow\n\n\n\n参数类型:\n\n\n\n> BuildConfig 类型参考 API 配置\n\n\nbeforeBuildTask#\n\n根据构建配置,Modern.js Module 会将整体构建分成多个子构建任务。该 Hook 将会在每一个构建子任务之前触发。\n\n类型:AsyncWaterfall\n\n\n\n\nafterBuildTask#\n\n类型:ParallelWorkflow,每一个构建子任务结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nafterBuild#\n\n类型:ParallelWorkflow,整体构建流程结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nbuildPlatform 钩子#\n\nmodule-tools 还提供了 build --platform 命令来执行特定的构建任务。\n\n例如在安装了 Doc 插件后,就可以执行 build --platform 或者 build --platform doc 来执行 doc 的构建任务。因为\ndoc 插件基于 buildPlatform Hooks 实现了该功能。\n\n在执行 build --platform 后会按照以下顺序触发 Hooks:\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\n获取在执行 build --platform 命令时候需要运行的任务信息。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。beforeBuildPlatform 会在执行整体的构建任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。buildPlatform 会在每个构建任务执行之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。afterBuildPlatform 会在整体 platform\n构建任务结束后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n调试钩子#\n\n在执行 dev 命令的时候,会按照顺序触发以下 Hooks:\n\n * registerDev: 在获取调试功能信息的时候触发。\n * beforeDev: 开始执行调试整体流程之前触发。\n * beforeDevMenu: 出现调试列表/菜单之前触发。\n * afterDevMenu: 选择调试列表/菜单选项后触发。\n * beforeDevTask: 执行调试任务之前触发。\n * afterDev: 执行 dev 整体流程最后触发。\n\n\nregisterDev#\n\n注册调试工具相关的数据。主要包含:\n\n * 调试工具的名称\n * 显示在菜单列表中的项目名称以及对应的值。\n * dev 子命令的定义。\n * 是否在运行调试任务之前执行源码构建\n * 执行调试任务的函数。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDev#\n\n在收集完所有调试工具元数据后,执行 dev 任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu 在出现调试列表/菜单之前触发。接收 inquirer question 作为参数。默认值为:\n\n\n\nafterDevMenu 选择调试列表/菜单选项后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDevTask#\n\n执行调试任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterDev#\n\n在中断调试任务进程时触发。\n\n","routePath":"/module-tools/api/plugin-api/plugin-hooks","lang":"zh","toc":[{"text":"配置钩子","id":"配置钩子","depth":2,"charIndex":209},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"构建钩子","id":"构建钩子","depth":2,"charIndex":276},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform 钩子","id":"buildplatform-钩子","depth":2,"charIndex":713},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"调试钩子","id":"调试钩子","depth":2,"charIndex":1459},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":56,"title":"","content":"","routePath":"/module-tools/components/faq-build-exception","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":57,"title":"","content":"","routePath":"/module-tools/components/faq-build-other","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":58,"title":"","content":"","routePath":"/module-tools/components/faq-build-product","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":59,"title":"","content":"","routePath":"/module-tools/components/faq-storybook","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":60,"title":"","content":"","routePath":"/module-tools/components/faq-test","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":61,"title":"","content":"","routePath":"/module-tools/components/publish-emo","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":62,"title":"","content":"在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。","routePath":"/module-tools/components/register-esbuild-plugin","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":63,"title":"","content":"","routePath":"/module-tools/components/release-module-doc","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":64,"title":"处理静态资源","content":"#\n\nModern.js Module 会对代码中使用的静态资源进行处理。如果需要配置,则可以使用 buildConfig.asset API。\n\n\n默认行为#\n\n默认情况下,Modern.js Module 会处理以下静态资源:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\n对于静态文件的处理,Modern.js Module 目前默认支持的功能有:\n\n * 输出静态资源至 ./assets。\n * 对于不超过 10kb 的文件会内联到代码中。\n\n\n示例#\n\n让我们看下面的例子:\n\n * 项目源代码:\n\n\n\n * 如果 bg.png 的大小小于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n * 如果 bg.png 的大小大于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n当你想要修改默认行为的时候,可以使用以下 API:\n\n * asset.path:修改静态资源文件输出路径。\n * asset.limit:修改内联静态资源文件的阈值。","routePath":"/module-tools/guide/advance/asset","lang":"zh","toc":[{"text":"默认行为","id":"默认行为","depth":2,"charIndex":74},{"text":"示例","id":"示例","depth":2,"charIndex":355}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":65,"title":"构建 umd 产物","content":"#\n\numd 全称为 Universal Module Definition,这种格式的 JS 文件可以运行在多个运行环境:\n\n * 浏览器环境:基于 AMD 规范进行模块加载\n * Node.js 环境:基于 CommonJS 进行模块加载\n * 其他情况:将模块挂载在全局对象上。\n\n因此我们可以通过下面的方式,将项目的构建产物指定为 umd 产物:\n\n\n\n\numd 产物的第三方依赖处理#\n\n在 「如何处理第三方依赖」 章节中,我们知道可以通过 autoExternals 和 externals API 来控制项目是否对第三方依赖打包。 因此在构建\numd 产物的过程中,我们也可以这样使用:\n\n\n示例#\n\n * 如果项目依赖了 react:\n\n\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时产物中不会将 react 代码打包到产物中:\n\n\n\n通过上面的例子我们知道,当使用 autoExternal 和 externals API 后:\n\n * 在 Node.js 环境下,可以通过 require('react') 获取 react 依赖。\n * 在 浏览器环境下,可以通过 global.react 获取 react 依赖。\n\n\n三方依赖的全局变量名称#\n\n然而在浏览器环境下,获取第三方依赖的时候,全局变量名称不一定与依赖名称完全相同,此时就要使用 buildConfig.umdGlobals API。\n\n还是使用之前的例子,当 react 依赖以 windows.React 或者 global.React 全局变量的形式存在于浏览器环境下,那么此时:\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时我们会看到这样的产物代码:\n\n\n\n此时项目就可以运行在浏览器中,并使用存在于全局对象上的 React 变量了。\n\n\n更改项目的全局变量名称#\n\n当我们将下面的代码打包成 umd 产物并运行在浏览器的时候,我们可以通过 window.index 来使用该模块。\n\n\n\n默认情况下,以源码文件名称作为该模块在浏览器里全局变量的名称。对于上面的例子,其产物内容如下:\n\n\n\n如果需要修改它,则需要使用 buildConfig.umdModuleName API。\n\n当使用该 API 后:\n\n\n\n此时构建产物的内容为:\n\n","routePath":"/module-tools/guide/advance/build-umd","lang":"zh","toc":[{"text":"umd 产物的第三方依赖处理","id":"umd-产物的第三方依赖处理","depth":2,"charIndex":181},{"text":"示例","id":"示例","depth":3,"charIndex":302},{"text":"三方依赖的全局变量名称","id":"三方依赖的全局变量名称","depth":3,"charIndex":556},{"text":"更改项目的全局变量名称","id":"更改项目的全局变量名称","depth":2,"charIndex":836}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":66,"title":"使用 Copy 工具","content":"#\n\nModern.js Module 提供了 Copy 工具用于将已经存在的单个文件或整个目录复制到产物目录中。接下来我们学习如何使用它。\n\n\n了解 Copy API#\n\n我们可以通过 buildConfig.copy API 来使用 Copy 工具,它包含以下两个主要配置:\n\n * patterns\n * options\n\n\nAPI 详解#\n\ncopy.patterns 用于寻找复制的文件以及配置输出的路径。\n\n其中 patterns.from 用于指定要复制的文件或者目录。它接收 Glob 形式字符串或具体路径。Glob 形式字符串是指 fast-glob\npattern-syntax。因此我们可以按照如下两种方式使用它:\n\n\n\npatterns.context 一般和 patterns.from 配合使用,默认情况下它的值与 buildConfig.sourceDir\n相同,因此我们可以按照如下方式指定 src/data.json 文件为要复制的文件:\n\n> 默认情况下,buildConfig.sourceDir 为 src\n\n\n\n当指定的文件不在源码目录的时候,可以修改 context 配置。例如指定项目目录下的 temp/index.html 为要复制的文件:\n\n\n\npatterns.to 用于指定复制文件的输出路径,默认情况下它的值为 buildConfig.outDir对应的值。因此我们按照如下方式将\nsrc/index.html 复制到 dist 目录下:\n\n\n\n当我们配置了 patterns.to 的时候:\n\n * 如果是相对路径,则该路径会相对于 buildConfig.outDir 计算出复制文件输出的绝对路径。\n * 如果是绝对路径,则会直接使用该值。\n\n最后 patterns.globOptions 用于配置寻找复制文件 globby 对象,其配置可参考:\n\n * globby.options\n\n\n不同场景使用示例#\n\n\n将文件复制文件#\n\n\n\n\n将文件复制到目录#\n\n\n\n\n从目录复制到目录#\n\n\n\n\n从目录到文件#\n\n\n\n\n使用 Glob#\n\n","routePath":"/module-tools/guide/advance/copy","lang":"zh","toc":[{"text":"了解 Copy API","id":"了解-copy-api","depth":2,"charIndex":72},{"text":"API 详解","id":"api-详解","depth":2,"charIndex":165},{"text":"不同场景使用示例","id":"不同场景使用示例","depth":2,"charIndex":826},{"text":"将文件复制文件","id":"将文件复制文件","depth":3,"charIndex":838},{"text":"将文件复制到目录","id":"将文件复制到目录","depth":3,"charIndex":851},{"text":"从目录复制到目录","id":"从目录复制到目录","depth":3,"charIndex":865},{"text":"从目录到文件","id":"从目录到文件","depth":3,"charIndex":879},{"text":"使用 Glob","id":"使用-glob","depth":3,"charIndex":891}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":67,"title":"处理三方依赖","content":"#\n\n一般来说,项目所需要的第三方依赖可以通过包管理器的 install 命令安装,在安装第三方依赖成功后,这些第三方依赖一般会出现在项目 package.json\n的 dependencies 和 devDependencies 下。\n\n\n\n\"dependencies\" 下的依赖通常来说是这个包运行所需的依赖, \"devDependencies\" 则代表着开发依赖。\n\n除了 \"dependencies\" 以外,\"peerDependencies\" 也可以声明在生产环境下运行所需要的依赖,此时会和它的宿主共享一份依赖。\n\n\n第三方依赖的默认处理#\n\n在 Modern.js Module 里,默认情况下不会对 \"dependencies\" 以及 \"peerDependencies\"\n下的第三方依赖进行打包处理。\n\n这是因为在安装 npm 包时,其 \"dependencies\" 也会被安装。不打包 \"dependencies\",可以减小包产物的体积。\n\n如果需要打包某些依赖,建议将它们从 \"dependencies\" 挪到 \"devDependencies\" ,这相当于对依赖进行 prebundle\n,可以减小依赖安装的体积。\n\n\n示例#\n\n如果项目依赖了 react:\n\n\n\n当源码中使用了 react 依赖:\n\n\n\n此时产物中不会包含 react 的代码:\n\n\n\n如果想要修改默认的处理方式,可以通过下面的 API 进行修改:\n\n * buildConfig.autoExternal\n\n\n排除指定第三方依赖#\n\n在上面我们提到了 buildConfig.autoExternal API 的用途,同时 buildConfig.externals\n可以实现对三方依赖更细微的处理。\n\n例如当我们需要仅对某些依赖不进行打包处理的时候,可以按照如下方式进行配置:\n\n> 一般这种情况,可能是某些依赖不适合进行打包处理。如果遇到这种情况,则可以按照下面的方式进行处理。\n\n","routePath":"/module-tools/guide/advance/external-dependency","lang":"zh","toc":[{"text":"第三方依赖的默认处理","id":"第三方依赖的默认处理","depth":2,"charIndex":264},{"text":"示例","id":"示例","depth":3,"charIndex":521},{"text":"排除指定第三方依赖","id":"排除指定第三方依赖","depth":2,"charIndex":652}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":68,"title":"深入理解构建","content":"#\n\n在 \"基础使用\" 的部分,我们已经知道可以通过 buildConfig 配置对项目的输出产物进行修改。buildConfig\n不仅描述了产物的一些特性,同时还为构建产物提供了一些功能。\n\nTIP\n\n如果你还不了解 buildConfig 的作用,请先阅读 修改输出产物。\n\n而在本章里我们将要深入理解某些构建配置的作用以及了解执行 modern build 命令的时候发生了什么。\n\n\nbundle / bundleless#\n\n那么首先我们来了解一下 bundle 和 bundleless。\n\n所谓 bundle 是指对构建产物进行打包,构建产物可能是一个文件,也有可能是基于一定的代码拆分策略得到的多个文件。\n\n而 bundleless 则是指对每个源文件单独进行编译构建,但是并不将它们打包在一起。每一个产物文件都可以找到与之相对应的源码文件。bundleless\n构建的过程,也可以理解为仅对源文件进行代码转换的过程。\n\n它们有各自的好处:\n\n * bundle 可以减少构建产物的体积,也可以对依赖预打包,减小安装依赖的体积。提前对库进行打包,可以加快应用项目构建的速度。\n * bundleless 则是可以保持原有的文件结构,更有利于调试和 tree shaking。\n\nWARNING\n\nbundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 type 字段, 例如 import type { A } from\n'./types,背景参考 esbuild 文档。\n\n在 buildConfig 中可以通过 buildConfig.buildType 来指定当前构建任务是 bundle 还是 bundleless。\n\n\ninput / sourceDir#\n\nbuildConfig.input 用于指定读取源码的文件路径或者目录路径,其默认值在 bundle 和 bundleless 构建过程中有所不同:\n\n * 当 buildType: 'bundle' 的时候,input 默认值为 src/index.(j|t)sx?\n * 当 buildType: 'bundleless' 的时候,input 默认值为 ['src']\n\n从默认值上我们可以知道:使用 bundle 模式构建时一般指定一个或多个文件作为构建的入口,而使用 bundleless\n构建则是指定一个目录,将目录下所有文件作为入口。\n\nsourceDir 用于指定源码目录,它只与以下两个内容有关系:\n\n * 类型文件生成\n * 指定构建过程中的 outbase\n\n因此我们可以得到其最佳实践:\n\n * 在 bundle 构建过程中,只能指定 input 。\n * 一般情况下,bundleless 只需要指定 sourceDir(此时 input 会与 sourceDir 保持一致)。\n\n如果我们想要在 bundleless 里只对一部分文件进行转换,例如只需要转换 src/runtime 目录的文件,此时需要配置 input:\n\n\n\n\n使用 swc#\n\n在部分场景下,esbuild 不足以满足我们的需求,此时我们会使用 swc 来做代码转换。\n\n从 2.36.0 版本开始,涉及到以下功能时,Modern.js Module 默认会使用 swc ,但不这意味着不使用 esbuild 了,其余功能还是使用\nesbuild:\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\n事实上,我们在 2.16.0 版本开始全量使用 swc 进行代码转换。不过 swc 同样也存在一些限制,为此我们添加了 sourceType 配置,当源码格式为\n'commonjs' 时关闭 swc, 但这种方式并不符合用户直觉,另外,swc 格式化输出的 cjs 模式没有给每个导出名称添加注释,这在 node\n中使用可能会带来一些问题。 因为我们废弃了此行为,回到了最初的设计 - 只在需要的场景下使用 swc 作为补充。\n\n\n使用 Hook 介入构建流程#\n\nModern.js Module 提供了 Hook 机制,允许我们在构建流程的不同阶段注入自定义逻辑。 Modern.js Module Hook 使用了\ntapable 实现,扩展了 esbuild 的插件机制,若 esbuild plugins 已经满足了你的需求,建议直接使用它。 下面展开说明其用法:\n\n\nHook 类型#\n\nAsyncSeriesBailHook#\n\n串行执行的 hooks,如果某个 tapped function 返回非 undefined 结果,则后续其他的 tapped function 停止执行。\n\nAsyncSeriesWaterFallHooks#\n\n串行执行的 hooks,其结果会传递给下一个 tapped function\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * 在 esbuild onLoad callbacks 触发,根据模块路径来获取模块内容\n * 输入参数\n\n\n\n * 返回参数\n\n\n\n * 例子\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onLoad callbacks 触发, 将 load 阶段获取的模块内容进行转换\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onEnd callbacks 触发, 类似于 transform hook,但是作用在 esbuild 生成的产物\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\n\n类型文件生成#\n\nbuildConfig.dts 配置主要用于类型文件的生成。\n\n\n关闭类型生成#\n\n默认情况下类型生成功能是开启的,如果需要关闭的话,可以按照如下配置:\n\n\n\nTIP\n\n关闭类型文件后,一般来说构建速度会有所提升。\n\n\n打包类型文件#\n\n在 buildType: 'bundleless' 的时候,类型文件的生成是使用项目的 tsc 命令来完成生产。\n\nModern.js Module 同时还支持对类型文件进行打包,不过使用该功能的时候需要注意:\n\n * 对类型文件进行打包不会开启类型检查。\n * 一些第三方依赖存在错误的语法会导致打包过程失败。因此对于这种情况,需要手动通过 buildConfig.externals\n 将这类第三方包排除,或者直接关闭dts.respectExternal从而不打包任何三方包类型。\n * 对于第三方依赖的类型文件指向的是一个 .ts 文件的情况,目前无法处理。比如第三方依赖的 package.json 中存在这样的内容: {\"types\":\n \"./src/index.ts\"。\n\n对于上述问题,我们推荐的处理方式是首先使用 tsc 生成 d.ts 文件,然后将 index.d.ts 作为入口进行打包处理,并且关闭\ndts.respectExternal。在之后的演进我们也会逐渐向这种处理方式靠拢。\n\n\n别名转换#\n\n在 bundleless 构建过程中,如果源代码中出现了别名,例如:\n\n\n\n使用 tsc 生成的产物类型文件也会包含这些别名。不过 Modern.js Module 会对 tsc 生成的类型文件里的别名进行转换处理。\n\n\n一些示例#\n\n\n\n\n\n\n构建过程#\n\n当执行 modern build 命令的时候,会发生\n\n * 根据 buildConfig.outDir 清理产物目录。\n * 编译 js/ts 源代码生成 bundle / bundleless 的 JS 构建产物。\n * 使用 tsc 生成 bundle / bundleless 的类型文件。\n * 处理 copy 任务。\n\n\n构建报错#\n\n当发生构建报错的时候,基于以上了解到的信息,可以很容易的明白在终端出现的报错内容:\n\njs 或者 ts 构建的报错:\n\n\n\n类型文件生成过程的报错:\n\n\n\n对于 js/ts 构建错误,我们可以从报错信息中知道:\n\n * 报错的 buildType\n * 报错的 format\n * 报错的 target\n * 其他具体报错信息\n\n\n调试模式#\n\n从 2.36.0 版本开始,为了便于排查问题,Modern.js Module 提供了调试模式,你可以在执行构建时添加 DEBUG=module\n环境变量来开启调试模式。\n\n\n\n调试模式下,你会看到 Shell 中输出更详细的构建日志,这主要以流程日志为主:\n\n\n\n另外,Module 还提供了调试内部工作流程的能力。你可以通过设置环境变量 DEBUG=module:* 来开启更详细的调试日志:\n\n目前只支持了 DEBUG=module:resolve,可以查看 Module 内部模块解析的详细日志:\n\n","routePath":"/module-tools/guide/advance/in-depth-about-build","lang":"zh","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"使用 swc","id":"使用-swc","depth":2,"charIndex":1281},{"text":"使用 Hook 介入构建流程","id":"使用-hook-介入构建流程","depth":2,"charIndex":1762},{"text":"Hook 类型","id":"hook-类型","depth":3,"charIndex":1936},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":1946},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":2048},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":2117},{"text":"load","id":"load","depth":4,"charIndex":2128},{"text":"transform","id":"transform","depth":4,"charIndex":2236},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":2358},{"text":"类型文件生成","id":"类型文件生成","depth":2,"charIndex":2500},{"text":"关闭类型生成","id":"关闭类型生成","depth":3,"charIndex":2542},{"text":"打包类型文件","id":"打包类型文件","depth":3,"charIndex":2619},{"text":"别名转换","id":"别名转换","depth":3,"charIndex":3090},{"text":"一些示例","id":"一些示例","depth":3,"charIndex":3208},{"text":"构建过程","id":"构建过程","depth":2,"charIndex":3220},{"text":"构建报错","id":"构建报错","depth":2,"charIndex":3394},{"text":"调试模式","id":"调试模式","depth":2,"charIndex":3567}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":69,"title":"深入理解 dev 命令","content":"#\n\nModern.js Module 提供的 dev 命令主要用于代码的调试。\n\n\n命令运行的整体流程#\n\n 1. 当执行 dev 命令的时候,Modern.js Module 开始寻找是否存在可以执行的调试工具或者任务。调试工具或者任务就是类似 doc 这样的\n Modern.js Module 调试工具插件。\n 2. 当发现存在一个调试工具的时候,则会立即执行它。\n 3. 当发现多个调试工具的时候,则显示调试工具列表菜单。可以通过选择某个调试工具对应的名称选项启动它。\n 4. 当没有发现调试工具的时候,则告诉用户没有可用的调试工具。\n\n我们除了可以执行 dev 命令以外,也可以通过 dev [调试工具名称] 的方式来直接启动调试工具或者任务。\n\n\n扩展 dev 命令#\n\n如果需要扩展 dev 命令或者说提供自己的 Modern.js Module 调试工具插件,那么你需要先了解以下内容:\n\n * 开发插件\n * 调试工具插件 API\n\n一般来说,实现一个什么都不做的调试工具,其实现代码以及相关配置如下:\n\n\n\n如果需要使用该调试工具插件,则需要在配置文件中增加它:\n\n\n\n此时我们执行 dev 或者 dev do-nothing 命令的时候,就可以执行它了。在执行后,它会先执行监听模式的源码构建任务,并紧接着打印日志信息。\n\n对于目前官方支持的调试工具和第三方支持的调试工具,可以在插件列表中查看。","routePath":"/module-tools/guide/advance/in-depth-about-dev-command","lang":"zh","toc":[{"text":"命令运行的整体流程","id":"命令运行的整体流程","depth":2,"charIndex":42},{"text":"扩展 dev 命令","id":"扩展-dev-命令","depth":2,"charIndex":333}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":70,"title":"开始之前","content":"#\n\n\n环境准备#\n\n为了使用 Modern.js Module,首先需要 NodeJS,我们推荐最新的长期维护版本,并确保 Node 版本大于等于 16.0.0。因为非稳定的\nNodeJS 时常有一些 Bug,你可以使用 nvm-windows 和 nvm(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS\n版本,这些版本可能会用于不同的项目。\n\n\n初识 npm#\n\n当 NodeJS 被安装后,你不仅可以在命令行中访问 node 可执行程序,同时你也可以执行 npm 命令。\n\nnpm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript\n的工具。\n\n如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到「npm 包管理器」部分。\n\n\nnpm 包类型项目#\n\n那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 npm init 命令的时候,它会在当前目录下面创建一个文件名为 package.json\n的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 package.json\n文件中找到:\n\n\n\n此时这个包含了初始化后的 package.json 文件的项目就是一个 npm 包类型的项目,你可以执行 npm publish 命令将这个项目发布到 npm\nRegistry。\n\nnpm Registry 是一个 npm 包存储的地方,开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm\nRegistry 使用其他开发者发布的 npm 包。\n\n优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。\n\n\n使用第三方 npm 包#\n\n当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情\n—— npm 依赖的软件包类型:\n\n * \"dependencies\":一种是你的应用程序在生产环境中需要的软件包。\n * \"devDependencies\":另一种是仅在本地开发和测试中需要的软件包。\n \n > 软件包可以理解为是第三方的 npm 包。\n\n你可以通过执行 npm install npm-package-name 或者 npm add npm-package-name\n的方式来安装在生产环境中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在 \"dependencies\"\n里,并执行 npm install 命令:\n\n\n\n同理,你也可以执行 npm install npm-package-name --save-dev 或 npm add npm-package-name\n--save-dev 的方式来安装仅在本地开发和测试中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在\n\"devDependencies\" 里,并执行 npm install 命令:\n\n\n\n在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 \"dependencies\" 还是\n\"devDependencies\" 中。\n\nTIP\n\n一般来说,需要在源代码中使用到的包都属于 dependencies 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为\ndevDependencies 依赖。\n\n\n还需要了解的 npm 零碎知识#\n\n\nnpm 包的程序入口#\n\n在 package.json 中存在一个 \"main\" 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。\n\n例如你的包名为 foo,并且用户安装了它,然后执行 require(\"foo\") 代码,那么 foo 这个 npm 包的 \"main\"\n字段对应的文件将会被导出。\n\n推荐在你的 npm 包里一定要设置 \"main\" 字段。如果没有设置 \"main\",则默认入口为包的根目录下的 index.js 文件。\n\n除了需要设置 \"main\" 属性以外,一般还会设置 \"module\" 属性。它与 \"main\" 属性的用途类似,它主要是用于在 webpack\n场景下使用。webpack 在大多数情况下,会以 \"module\" -> \"main\" 这个顺序读取 npm 包的入口(文件)。\n\n> 想要了解关于 webpack 如何做这件事,可以查看这个链接。\n\n\n\"scripts\"#\n\npackage.json 文件的 \"scripts\" 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。\n\n这些都可以通过运行 npm run-script 或简称 npm run 来执行。\n\n名称匹配的前置命令和后置命令也会被运行(例如 premyscript、myscript、postmyscript)。\n\n\n\n当执行 npm run myscripts 的时候,premyscripts 对应的脚本会在它之前执行,postmyscripts 对应的脚本会在它之后执行。\n\n来自依赖的脚本命令可以用 npm explore -- npm run 运行。\n\n还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。\n\nnpm install#\n\n当你运行 npm install -g 时,以下脚本会运行。\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\n如果你的软件包根目录有一个 binding.gyp 文件,而你没有定义 install 或 preinstall 脚本,那么 npm 将以 node-gyp\nrebuild 作为默认的 install 命令,使用 node-gyp 进行编译。\n\nnpm publish#\n\n当发布项目的时候,执行该命令会触发以下脚本:\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\n当以 --dry-run 模式运行的时候,prepare 对应的脚本将不会执行。\n\n\npeerDependencies#\n\n在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm\n项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm\n项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。\n\n关于更多 peerDependencies 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:\n\n * npm 对 peerDependencies 的解释\n * pnpm vs npm VS Yarn\n\n\nnpm 包管理器#\n\n除了 npm 这种标准的包管理器以外,目前主流的还有 pnpm 和 Yarn,它们都是不错的 npm cli 替代品。\n\n推荐使用 pnpm 来管理项目依赖,可以通过下面的方式安装它:\n\n\n\n\nModern.js Module 配置文件#\n\n通过 @modern-js/create 创建的项目目录下提供了 Modern.js Module 的配置文件 ——\nmodern.config.(j|t)s。但 modern.config 配置文件不是必须存在的。\n\n默认情况下,生成的配置文件的内容如下:\n\n\n\n我们推荐使用 defineConfig 函数,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:\n\n","routePath":"/module-tools/guide/basic/before-getting-started","lang":"zh","toc":[{"text":"环境准备","id":"环境准备","depth":2,"charIndex":3},{"text":"初识 npm","id":"初识-npm","depth":2,"charIndex":188},{"text":"npm 包类型项目","id":"npm-包类型项目","depth":2,"charIndex":391},{"text":"使用第三方 npm 包","id":"使用第三方-npm-包","depth":2,"charIndex":818},{"text":"还需要了解的 npm 零碎知识","id":"还需要了解的-npm-零碎知识","depth":2,"charIndex":1602},{"text":"npm 包的程序入口","id":"npm-包的程序入口","depth":3,"charIndex":1621},{"text":"\"scripts\"","id":"scripts","depth":3,"charIndex":2042},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":2825},{"text":"npm 包管理器","id":"npm-包管理器","depth":2,"charIndex":3139},{"text":"Modern.js Module 配置文件","id":"modernjs-module-配置文件","depth":2,"charIndex":3247}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":71,"title":"CLI 命令","content":"#\n\nModern.js Module 项目可以使用的 CLI 命令如下:\n\n\nmodern build#\n\n\n\nModern.js Module 支持 platform 构建模式,可以用于执行其他工具的构建任务,目前官方支持的有 Rspress。例如,可以通过执行\nmodern build --platform 命令启动 doc 构建任务生成 doc 产物。\n\n\nmodern new#\n\n\n\nmodern new 命令用于启动微生成器功能,它可以为项目启用默认没有提供的功能。\n\n目前可以开启的功能有:\n\n * Test 测试\n * Storybook V7\n * Tailwind CSS 支持\n * Modern.js Runtime API\n\n关于这些功能,可以通过「使用微生成器」 章节了解更多。\n\n\nmodern dev#\n\n\n\nModern.js Module 提供了使用调试工具的能力,可以通过 modern dev\n命令来启动。不过要注意的是,默认情况下是没有提供调试相关的插件,因此此时执行 modern dev 会提示: \"No dev tools found\navailable\"。\n\n目前官方支持的调试工具有 Rspress,因此在你执行 modern new 命令开启它后,就可以执行 modern dev 或者 modern dev doc\n执行它。\n\n\nmodern test#\n\n\n\n需要先执行 modern new 开启测试功能,然后才可以执行 modern test 命令。 modern test 命令会自动将\ntests/*.test.(js|ts|jsx|tsx) 文件当做测试用例运行。\n\n\nmodern lint#\n\n\n\n运行 ESLint 检查代码语法情况。通常情况下,我们只需要在 git commit 阶段通过 lint-staged 检查本次提交修改的部分代码。\n\n * --no-fix 参数设置后可以关闭自动修复 lint 错误代码的能力。\n\n\nmodern change#\n\n\n\nmodern change 命令用于生成 changesets 需要的 Markdown 文件。\n\n\nmodern pre#\n\n\n\n可以使用 modern pre 命令在正式发布前预发布一个版本。\n\n\nmodern bump#\n\n\n\n按照 changesets 生成的变更记录的 Markdown 文件修改 package.json 中的版本号, 同时生成 CHANGELOG.md 文件。\n\n\nmodern release#\n\n\n\nmodern release 命令可以将模块发布到 npm Registry 上。\n\n * --tag 参数可以指定发布时具体的 dist tags。\n\n\nmodern gen-release-note#\n\n\n\n根据当前仓库的 changeset 信息自动生成 Release Note。\n\nTIP\n\n需要在 bump 命令之前执行。\n\n\nmodern upgrade#\n\n\n\nmodern upgrade 命令,用于升级项目 Modern.js 相关依赖至最新版本。\n\n在项目根目录下执行命令 npx modern upgrade,会默认将当前执行命令项目的 package.json 中的 Modern.js\n相关依赖更新至最新版本。","routePath":"/module-tools/guide/basic/command-preview","lang":"zh","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern test`","id":"modern-test","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":72,"title":"修改输出产物","content":"#\n\n\n默认输出产物#\n\n当你在初始化的项目里使用 modern build 命令的时候,Modern.js Module 会根据当前配置内容,生成相应的构建产物。\n\n模板创建的默认配置内容如下:\n\n\n\n默认生成产物具有以下特点:\n\n * 会生成 CommonJS 和 ESM 两份产物。\n * 代码语法支持到 ES6 ,更高级的语法将会被转换。\n * 所有的代码经过打包变成了一个文件,即进行了 bundle 处理。\n * 产物输出根目录为项目下的 dist 目录,类型文件输出的目录为 dist/types。\n\n看到这里你可能会有以下疑问:\n\n 1. buildPreset 是什么?\n 2. 产物的这些特点是由什么决定的?\n\n接下来,我们首先来了解一下 buildPreset。\n\n\n构建预设#\n\nbuildPreset 代表着提前准备好的一组或者多组构建相关的配置,只需要使用 buildPreset\n对应的预设值,就可以省去麻烦且复杂的配置工作,得到符合预期的产物。\n\nModern.js Module 主要内置了两套构建预设,包括:\n\n * npm-component: 用于构建组件库。\n * npm-library: 用于打包其他库类型的项目,如工具库。\n\n同时,还提供一些变体,例如 npm-library-with-umd 和 npm-library-es5,顾名思义,分别对应带有 umd 产物和支持到 es5\n语法的库预设。 详细配置可以查看其 API 。\n\n除此之外,我们也可以完全自定义构建配置:\n\n\n构建配置#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项。在最开始提到的关于“构建产物的特点”,其实都是 buildConfig\n所支持的属性。目前所支持的属性覆盖了大部分模块类型项目在构建产物时的需求,buildConfig\n不仅包含一些产物所具备的属性,也包含了构建产物所需要的一些特性功能。接下来从分类的角度简单罗列一下:\n\n构建产物的基本属性包括:\n\n * 产物是否被打包:对应的 API 是 buildConfig.buildType。\n * 产物对于语法的支持:对应的 API 是 buildConfig.target。\n * 产物格式:对应的 API 是 buildConfig.format。\n * 产物类型文件如何处理,对应的 API 是 buildConfig.dts。\n * 产物的 sourceMap 如何处理:对应的 API 是 buildConfig.sourceMap。\n * 产物对应的输入(或者是源文件):对应的 API 是 buildConfig.input。\n * 产物输出的目录:对应的 API 是 buildConfig.outDir。\n * 构建的源码目录:对应的 API 是 buildConfig.sourceDir。\n\n构建产物所需的常用功能包括:\n\n * 别名:对应的 API 是 buildConfig.alias。\n * 静态资源处理:对应的 API 是 buildConfig.asset。\n * 第三方依赖处理:对应的 API 有:\n * buildConfig.autoExternal。\n * buildConfig.externals。\n * 拷贝:对应的 API 是 buildConfig.copy。\n * 全局变量替换:对应的 API 是 buildConfig.define。\n * 指定 JSX 编译方式,对应的 API 是 buildConfig.jsx。\n\n一些高级属性或者使用频率不高的功能:\n\n * 产物代码压缩:对应的 API 是 buildConfig.minify。\n * 代码分割:buildConfig.spitting\n * 指定构建产物用于 NodeJS 环境还是浏览器环境:对应的 API 是 buildConfig.platform。\n * umd 产物相关:\n * 指定 umd 产物外部导入的全局变量:对应的 API 是 buildConfig.umdGlobals。\n * 指定 umd 产物的模块名:对应的 API 是 buildConfig.umdModuleName。\n\n除了以上分类以外,关于这些 API 的常见问题和最佳实践可以通过下面的链接来了解:\n\n * 关于 bundle 和 bundleless\n * 关于 input 和 sourceDir。\n * 关于类型描述文件。\n * 如何使用 define\n * 如何处理第三方依赖\n * 如何使用拷贝\n * 如何构建 umd 产物\n * 如何使用静态资源\n\n\n结合配置与预设#\n\n了解 buildPreset 和 buildConfig 之后,我们可以将二者进行结合使用。\n\n在实际项目中,我们可以先使用 buildPreset 来快速获取一套默认构建配置。如果需要自定义,可以使用 buildConfig 进行覆盖和扩展。\n\n扩展的逻辑如下:\n\n * 当 buildConfig 是数组时,会在原来的预设基础上添加新的配置项。\n\n\n\n这会在原本预设的基础上,额外生成一份 IIFE 格式、支持到 ES2020 语法的产物,输出目录为项目下的 dist/global 目录。\n\n * 当 buildConfig 是对象时,会将对象中的配置项覆盖到预设中。\n\n\n\n这会使得每一项构建任务都会生成 sourceMap 文件。","routePath":"/module-tools/guide/basic/modify-output-product","lang":"zh","toc":[{"text":"默认输出产物","id":"默认输出产物","depth":2,"charIndex":3},{"text":"构建预设","id":"构建预设","depth":2,"charIndex":344},{"text":"构建配置","id":"构建配置","depth":2,"charIndex":664},{"text":"结合配置与预设","id":"结合配置与预设","depth":2,"charIndex":1952}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":73,"title":"版本管理与发布","content":"#\n\n一个 npm 类型的模块项目发布流程包含了两个阶段:\n\n * 第一阶段是在开发期间,开发者需要提供变更文件,该文件记录了在发布期间需要的变更内容;\n * 第二阶段是在发布期间,需要收集所有的变更文件来更新版本、更新发布日志,并发布新的包到 npm Registry 上。\n\nModern.js Module 提供了一套版本管理与发布的方案,这适用于单包场景。对于 monorepo 里的 npm 包你需要遵循各类 monorepo\n解决方案提供的策略。\n\n\n跟踪变更#\n\n当项目发生变化的时候需要将变化的内容记录下来。项目发生的变化一般是指:\n\n * 新功能\n * 修复问题\n * 配置文件修改\n * ...\n\n当这些任务一旦开发完成后,需要通过以下命令来对当前的变化进行记录:\n\n * modern change\n\n执行 modern change 命令后会向开发者提出几个问题,并根据开发者的回答生成变更记录。变更记录文件包含了版本变化的类型和其描述,该文件会被提交到\ngit 仓库中。\n\n\n\n当执行成功后,生成的包含变更记录的 Markdown 文件会保存在项目的 .changeset 目录下面。其内容类似下面这样:\n\n\n\n\n版本更新#\n\n当需要更新项目版本的时候,执行以下命令:\n\n * modern bump\n\n执行 modern bump 将会基于 .changeset/ 目录下记录了变更的 Markdown 文件内容来修改 package.json\n中的版本号,同时生成 CHANGELOG.md 文件。而当版本更新完成后,这些记录变更的 Markdown 文件也会被删除,也可说这些 Markdown\n文件被“消耗”掉了。\n\n\n\n\n发布#\n\n发布项目可以执行以下命令:\n\n * modern release\n\nmodern release 命令可以将项目发布到 npm Registry。\n\n此时发布的是 latest 版本,也可以说是正式版本。如果想要修改 dist-tag,可以通过 modern release --tag 命令来指定。例如:\n\n\n\n但是如果希望将当前项目的版本号也修改为预发布的版本号,则需要使用 modern pre 命令。\n\n> 所谓 dist-tag,可以理解:为当前发布的版本打标签。一般来说,默认发布的版本对应的 dist-tag 为 latest,因此可以把 latest\n> 认为是正式版本的 dist-tag。\n\n\n预发布#\n\n当需要在正式发布之前进行预发布,则需要执行以下命令:\n\n * modern pre\n\n首先 modern pre enter 进入预发布模式, 可以与发布项目的时候使用 modern release --tag 命令指定的 tag 一致。\n\n\n\n接着可以使用 modern bump 命令更新具体的版本号,此时不会真正的“消耗”记录变更的 Markdown 文件:\n\n\n\n然后可以看到 package.json 中更新的版本号会类似这样:0.1.2-next.0。\n\n最后,如果不需要再进行预发布,则一定要执行 modern pre exit 命令,这样可以退出预发布状态,并且当再次执行 modern bump\n命令的时候,就可以发布正式的版本。","routePath":"/module-tools/guide/basic/publish-your-project","lang":"zh","toc":[{"text":"跟踪变更","id":"跟踪变更","depth":2,"charIndex":231},{"text":"版本更新","id":"版本更新","depth":2,"charIndex":519},{"text":"发布","id":"发布","depth":2,"charIndex":728},{"text":"预发布","id":"预发布","depth":2,"charIndex":1040}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":74,"title":"使用微生成器","content":"#\n\nModern.js Module 提供了微生成器工具,它可以为当前项目:\n\n * 新增目录和文件\n * 修改 package.json\n * 执行命令\n\n因此通过这些能力,微生成器可以为项目开启额外的特性功能。\n\n可以通过 modern new 启动微生成器。目前 Modern.js Module 支持的微生成器功能有:\n\n\n开发模块文档#\n\n当我们想要为模块编写文档的时候,可以启用模块文档功能。会在项目目录下创建 docs 目录以及相关文件,在 package.json 中新增\n\"@modern-js/plugin-rspress\" 依赖。 使用 modern dev 和 modern build --platform\n来调试和构建你的文档站点。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n\n\n\nStorybook 调试#\n\n当我们想要对组件或者普通模块进行调试的时候,可以启用 Storybook 调试功能。启动该功能后,会在项目目录下创建 stories 目录以及\n.storybook 目录,在 package.json 中新增 \"@modern-js/storybook\" 依赖。使用 storybook dev 和\nstorybook build 来调试和构建。\n\n\nTailwind CSS 支持#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\n如果你想要在项目使用 Tailwind CSS,可以参考 「使用 Tailwind CSS」。\n\n\nModern.js Runtime API 支持#\n\nModern.js 提供了 Runtime API 能力,这些 API 只能在 Modern.js 的应用项目环境中使用。如果你需要开发一个 Modern.js\n应用环境中使用的组件,那么你可以开启该特性,微生成器会增加 \"@modern-js/runtime\"依赖。\n\n另外,Storybook 调试工具也会通过检测项目的依赖确定项目是否需要使用 Runtime API,并且提供与 Modern.js 应用项目一样的\nRuntime API 运行环境。\n\n:::tip 在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n","routePath":"/module-tools/guide/basic/use-micro-generator","lang":"zh","toc":[{"text":"开发模块文档","id":"开发模块文档","depth":2,"charIndex":166},{"text":"Storybook 调试","id":"storybook-调试","depth":2,"charIndex":370},{"text":"Tailwind CSS 支持","id":"tailwind-css-支持","depth":2,"charIndex":561},{"text":"Modern.js Runtime API 支持","id":"modernjs-runtime-api-支持","depth":2,"charIndex":709}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":75,"title":"开发模块文档","content":"#\n\n本章介绍如何为模块项目快速搭建一个静态文档站点。\n\n\n开始之前#\n\n\n为什么我们需要为模块搭建一个文档站点#\n\n 1. 文档站点可以帮助我们更好地组织文档的结构。\n 2. 文档站点具有更好的表现形式,例如可以在页面中执行函数,渲染组件等。\n 3. 可以更好地利用 AI 搜索的能力。\n\n\n前置准备#\n\n 1. 通过微生成器开启文档功能。\n 2. 阅读Rspress 介绍。\n\n完成准备工作之后,接下来我们会基于 Rspress 为模块项目搭建一个文档站点。\n\n\n站点基本结构#\n\n站点整体布局由三部分组成:导航栏、侧边栏以及正文部分,其中正文还包括了 TOC(Table of contents found at the beginning\nof a book or document)。\n\nRspress 使用的是文件系统路由,模块文档基于此实现了侧边栏的自动生成。 例如,如果你有以下的文件结构:\n\n\n\n那么 foo/bar.md 的路由路径会是 /foo/bar,foo.md 的路由路径会是 /foo,index.md 的路由路径会是 /。\n\n具体映射规则如下:\n\n文件路径 路由路径\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\n与上述文件路径和路由路径依次对应的侧边栏如下所示:\n\n\n配置侧边栏#\n\n如上图所示,模块文档已经为文件系统路由自动生成了侧边栏,其中侧边栏每一栏的文本是由文件的一级标题或者目录名决定。 如果你需要自定义侧边栏,请使用\n_meta.json 或者直接配置 sidebar。\n\nINFO\n\n如果你的文档目录结构是符合国际化的,例如:\n\n\n\n你需要按照国际化章节,同时配置 lang 和 locales,否则模块自动生成的侧边栏不会处理 zh 和 en 这两个目录。\n\n\n编写文档#\n\n接下来我们可以专注于文档内容的编写了。除了最基本的编写 markdown 以外,你可能还需要了解以下进阶内容:\n\n * 使用 MDX\n * 使用静态资源\n\n\n组件预览#\n\n模块文档为组件库提供了预览能力,jsx和tsx的代码块里的内容将会被解析为 React 组件。\n\n\n示例#\n\n假设我们的项目名是demo,并导出了一个 Button 组件。\n\n 1. 首先新增 docs/Button.mdx 文件:\n\n\n\n 2. 在tsconfig.json里配置别名,将包名指向当前项目目录,使得文档开发者和用户使用组件方式一致:\n\n\n\n 3. 在 .gitignore 文件下添加 doc_build/,文档产物将会生成在此目录下:\n\n\n\n恭喜你,已经完成了一个组件文档的编写,执行pnpm run dev看看效果吧,记得先构建一下组件库,确保组件产物存在。\n\n\n移动端预览#\n\n同时,我们也支持了移动端预览的方式,即使用 iframe 渲染移动端组件,并可以通过 iframePosition 设置 iframe\n的位置,支持扫码预览以及新页面打开。\n\n\n\nTIP\n\n如果只想要改变某一个 jsx 和 tsx 代码块的预览方式,可以使用不同的修饰符进行标识:\n\n\n\n\n使用外部 demo#\n\n如果我们的 demo 非常复杂,那么建议单独编写 demo,然后在 MDX 中使用 code 标签:\n\n\n\n这同样支持单独设置代码块的预览方式,例如:\n\n\n\n\n使用内置组件#\n\n插件内部实现了一部分内置组件,以便于你可以更轻松地开发模块文档。\n\n\nAPI#\n\n展示模块的 API 内容\n\n解析文件#\n\n在使用 API 组件之前,首先我们需要指定解析的文件:\n\n\n\n内容生成#\n\n接下来我们了解一下根据解析的文件会生成什么样的 markdown 内容。\n\n内容可以通过 react-docgen-typescript 或者 documentation 两个不同的工具生成:\n\n * react-docgen-typescript针对于组件库场景,仅会解析 props 生成表格。\n\n\n\n上面是一个标准写法,其中 ButtonProps 将被提取至表格中, Button 作为表格的标题。如果使用默认导出,文件名将作为表格标题。\n\n需要注意的是,export 导出事先定义的特性将不会被解析。\n\n\n\n生成的内容如下:\n\n\n\nWARNING\n\n如果 Props 里使用了 React 的类型,你需要在 tsconfig.json 里添加 types ,否则会解析不到 React 命名空间下的类型。\n\n\n\n更好的方式是直接引用类型,例如\n\n\n\n * documentation适用于工具库场景,用来解析 JSDoc 注释。\n\n\n\n上面是一个带有 JSDoc 注释的 greet 函数。生成的内容如下:\n\n\n\n组件使用#\n\n接下来,你便可以在文档里使用我们的内置 API 组件了,将key值传入moduleName属性里\n\n\n\n\nOverview#\n\n展示模块列表,可以放在首页用来展示所有模块。\n\nOverview 组件只有一个 list 属性,接收一个对象数组,下面是对象的属性\n\n属性 说明 类型 默认值\nicon 图标 React.ReactNode \ntext 文本(必填) string \nlink 链接(必填) string \narrow 是否展示箭头 boolean false\n\n\n插件配置#\n\n\napiParseTool#\n\nAPI 解析工具\n\n * 类型:'react-docgen-typescript' | 'documentation'\n * 默认值:'react-docgen-typescript'\n\n\ndoc#\n\n文档框架配置\n\n\nentries#\n\n自动生成文档的模块名称及相对路径\n\n * 类型:Entries | ToolEntries\n * 默认值:{}\n\n\n\nEntries 同时支持针对不同的文件使用不同的解析工具:\n\n\n\n\niframePosition#\n\niframe 所处页面位置\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nfollow时,每一个代码块都会有一个 iframe 展示其渲染视图。 fixed时,iframe 将会固定在页面右侧,展示当前页面所有代码块的视图。\n\n\nparseToolOptions#\n\nAPI 解析工具的参数\n\n * 类型:ParseToolOptions\n * 默认值:{}\n\n\n\n\npreviewMode#\n\n代码块预览方式。\n\n * 类型:'internal' | 'iframe'\n * 默认值: 'internal'\n\ninternal时,代码块内容将会直接渲染在页面中,反之将会通过 iframe 加载。\n\n\ndeprecated: languages#\n\nWARNING\n\n从 2.44.0 版本开始,请参考 国际化 章节来实现多语言。\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\n从 2.44.0 版本开始,内部实现了嗅探机制,请直接使用 _meta.json 或者直接配置 sidebar 来实现自定义侧边栏。\n\n\n命令行#\n\n * modern dev: 启动文档站本地开发。\n * modern build --platform: 构建生产环境产物。\n\n\n进阶指南#\n\n以上已经介绍完了开发模块文档的基本内容,但是这对于开发一个完整的文档站是不够的。查看Rspress以深入了解我们的文档框架。 你可以通过 doc\n配置来修改文档框架配置。\n\n","routePath":"/module-tools/guide/basic/use-module-doc","lang":"zh","toc":[{"text":"开始之前","id":"开始之前","depth":2,"charIndex":29},{"text":"为什么我们需要为模块搭建一个文档站点","id":"为什么我们需要为模块搭建一个文档站点","depth":3,"charIndex":37},{"text":"前置准备","id":"前置准备","depth":3,"charIndex":146},{"text":"站点基本结构","id":"站点基本结构","depth":2,"charIndex":233},{"text":"配置侧边栏","id":"配置侧边栏","depth":3,"charIndex":625},{"text":"编写文档","id":"编写文档","depth":2,"charIndex":830},{"text":"组件预览","id":"组件预览","depth":2,"charIndex":916},{"text":"示例","id":"示例","depth":3,"charIndex":973},{"text":"移动端预览","id":"移动端预览","depth":3,"charIndex":1216},{"text":"使用外部 demo","id":"使用外部-demo","depth":3,"charIndex":1369},{"text":"使用内置组件","id":"使用内置组件","depth":2,"charIndex":1461},{"text":"API","id":"api","depth":3,"charIndex":1505},{"text":"解析文件","id":"解析文件","depth":4,"charIndex":1525},{"text":"内容生成","id":"内容生成","depth":4,"charIndex":1563},{"text":"组件使用","id":"组件使用","depth":4,"charIndex":2032},{"text":"Overview","id":"overview","depth":3,"charIndex":2092},{"text":"插件配置","id":"插件配置","depth":2,"charIndex":2360},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":2368},{"text":"doc","id":"doc","depth":3,"charIndex":2478},{"text":"entries","id":"entries","depth":3,"charIndex":2493},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":2596},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":2749},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":2818},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":2936},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":3003},{"text":"命令行","id":"命令行","depth":2,"charIndex":3112},{"text":"进阶指南","id":"进阶指南","depth":2,"charIndex":3184}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":76,"title":"使用 Storybook","content":"#\n\nStorybook 是一个专门用于组件调试的工具,它围绕着组件开发提供了:\n\n * 丰富多样的调试能力\n * 可与一些测试工具结合使用\n * 可重复使用的文档内容\n * 可分享能力\n * 工作流程自动化\n\n在使用 Storybook 时,难免会遇到各种配置问题,需要手动配置 Babel 插件,手动配置 Webpack 去支持 less,sass 等。\nModern.js 集成了 Storybook,这对于我们开发 Storybook 项目来说极大地简化了配置工作。\n\n\nV7 (推荐)#\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建配置文件夹 .storybook,以及默认配置文件 .storybook/main.ts\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @storybook/addon-essential 和 @modern-js/storybook,以及创建\n storybook 相关脚本。\n\n\n开启产物调试#\n\n事实上,Modern.js Module 是基于 esbuild 实现的,而 Storybook 使用 Webpack\n作为默认构建工具,二者的配置无法完全兼容, 所以这里我们推荐先对组件进行构建,然后在 stories 里引入组件产物。\n\n引入组件产物的方式非常简单,假设你的模块导出了一个 Button 组件,那么在 stories 里可以这样使用:\n\n\n\n如果想要更新组件,则可以在启动 Storybook 前启动监听模式的构建:\n\n\n\nINFO\n\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:\n\n对于 pnpm 的项目,可以按照下面的内容对 package.json 进行修改:\n\n\n\n> 关于 pnpm 的 publishConfig 的使用,可以阅读下面这个链接。\n\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在开发阶段和发布阶段对 package.json 的 types 的值进行修改。\n\n\n开启 Rspack 构建#\n\nRspack 构建速度非常快,只需要如下配置即可使用 Rspack 作为构建工具。\n\n\n\n注意上面配置中,更改了 reactDocgen 配置,因为 Rspack 目前还不支持\n@storybook/react-docgen-typescript-plugin。\n\n\n配置#\n\n在 .storybook/main.js 中包含一些独有的配置。\n\nbundler#\n\n * 类型: 'webpack' | 'rspack'\n * 默认值: webpack\n\n指定底层打包工具使用 Webpack 还是 Rspack。\n\n\n\nbuilderConfig#\n\n * 类型: BuilderConfig\n * 默认值: undefined\n\nModern.js 的 Storybook 构建能力由 Rsbuild 提供,可通过 builderConfig 修改 Rsbuild 构建配置。\n\n\n\n\n命令行#\n\n@modern-js/storybook 代理了部分 storybook cli 的命令。\n\nstorybook dev#\n\n启动 Storybook,查看详情\n\nstorybook build#\n\n对 Storybook 进行生产环境构建,查看详情\n\n\n配置文件#\n\n配置文件中除了 Rsbuild 配置还包含一个额外的字段,builderPlugins,方便使用 Rsbuild 插件,例如启用 SWC 编译。\n\n\n\n\n从 V6 迁移至 V7#\n\n我们对于两个版本的支持方式不同,因此如果你是从 V6 迁移至 V7 的用户,我们希望你也按上述方式使用 V7,同时做以下调整:\n\n * 配置文件:将原来 root/config/storybook/main.(j|t)s 里的自定义配置(如果有)迁移到新的\n root/.storybook/main.(j|t)s。\n * 依赖:升级 @storybook/addon-* 系列依赖(如果有)到 7 版本,并删除 @modern-js/plugin-storybook 依赖。\n * 命令: 将原来 edenx dev storybook 和 edenx build --platform 命令删除,如果习惯了原来的 pnpm run\n dev 的调用方式,可以 将其替换成 storybook dev -p 6006 和 storybook build。\n * modern.config.(j|t)s : 删除 @modern-js/plugin-storybook 插件的注册。\n\n\nV6 (legacy)#\n\n从 2.40.0 版本开始,@modern-js/plugin-storybook将停止迭代。建议使用 V7 版本。 如果你的\n@modern-js/module-tools 版本低于 2.40.0,可以按照以下方式使用 Storybook V6:\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @modern-js/plugin-storybook,以及添加 pnpm dev storybook\n 等相关脚本。\n\n\n配置 Storybook#\n\nStorybook 官方通过一个名为 .storybook 的文件夹来进行项目配置,其中包含各种配置文件。在 Modern.js Module 中,可以在项目的\nconfig/storybook 目录下增加 Storybook 配置文件。\n\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\n\n * Configure Storybook\n\n不过这在模块项目里使用时存在一些限制:\n\n * 不能修改 Story 文件存放的位置,即无法在 main.js 文件里修改 stories 配置。\n * 不能修改 Webpack 和 Babel 相关的配置,即无法在 main.js 文件里修改 webpackFinal 和 babel 配置。\n\n\n构建 Storybook 产物#\n\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\n\n\n\n构建完成后,可以在 dist/storybook-static 目录看到构建产物文件。","routePath":"/module-tools/guide/basic/using-storybook","lang":"zh","toc":[{"text":"V7 (推荐)","id":"v7-推荐","depth":2,"charIndex":239},{"text":"开启 Storybook","id":"开启-storybook","depth":3,"charIndex":250},{"text":"开启产物调试","id":"开启产物调试","depth":3,"charIndex":492},{"text":"开启 Rspack 构建","id":"开启-rspack-构建","depth":3,"charIndex":946},{"text":"配置","id":"配置","depth":3,"charIndex":1095},{"text":"bundler","id":"bundler","depth":4,"charIndex":1134},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":1222},{"text":"命令行","id":"命令行","depth":3,"charIndex":1356},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":1409},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":1444},{"text":"配置文件","id":"配置文件","depth":3,"charIndex":1490},{"text":"从 V6 迁移至 V7","id":"从-v6-迁移至-v7","depth":2,"charIndex":1574},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":2037},{"text":"开启 Storybook","id":"开启-storybook-1","depth":3,"charIndex":2178},{"text":"配置 Storybook","id":"配置-storybook","depth":3,"charIndex":2358},{"text":"构建 Storybook 产物","id":"构建-storybook-产物","depth":3,"charIndex":2705}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":77,"title":"开发组件","content":"#\n\n本章将要介绍如何使用 Modern.js Module 开发组件项目。\n\n\n初始化项目#\n\n 1. 推荐使用 @modern-js/create 命令来初始化一个 npm 项目。\n\n\n\n 2. 初始化的目录结构如下:\n\n\n\n 3. 最后修改 ./src/index.ts 文件后缀和内容如下,就完成了组件项目的初始化。\n\n\n\n\n使用 Storybook 调试代码#\n\n请参考 「使用 Storybook」 来使用 Storybook 调试代码。\n\n\n开发样式#\n\n接下来我们可以给组件添加样式。\n\n目前支持开发样式的能力有:\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module 支持 PostCSS,并且内置了以下 PostCSS 插件:\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\n因此我们可以在项目中创建 .css 文件,并且可以直接在 css 文件中使用这些插件提供的语法支持和能力。\n\n * 源代码:\n\n\n\n * CSS 产物:\n\n\n\n\nLess#\n\nModern.js Module 支持使用 Less 开发样式。\n\n> 目前内置的 Less 版本为 v4.1.3\n\n * 源代码:\n\n\n\n * Less 产物:\n\n\n\n\nSass/Scss#\n\nModern.js Module 支持使用 Scss/Sass 开发样式。\n\n> 目前内置的 Sass 版本为 v1.54.4\n\n * 源代码:\n\n\n\n * Sass 产物:\n\n\n\n\nTailwind CSS#\n\n请参考 「使用 Tailwind CSS」 来了解相关用法。\n\n\nCSS Modules#\n\nModern.js Module 支持使用 CSS Module 开发样式。默认情况下会将以下文件识别为 CSS Module 文件:\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\n如果需要对 CSS Modules 进行配置,可以查看以下 API:\n\n * style.autoModules\n * style.modules\n\n下面是一个代码示例:\n\n\n\n\n\n\n配置构建产物#\n\n根据组件项目使用的多数场景,推荐使用 npm-component 构建预设。该预设得到的产物目录结构为:\n\n\n\n * ./dist/es: 包含了支持 es6 语法的 ES modules 格式的 bundleless 产物。\n * ./dist/lib: 包含了支持 es6 语法的 CommonJS 格式的 bundleless 产物。\n * ./dist/types: 包含了类型文件。\n\n如果对使用语法支持有要求,可以手动配置 buildPreset,并且支持在 npm-component 基础上增加后缀的方式修改支持的语法:\n\n\n\n如果对构建产物目录结构有特殊需求,则可以使用 buildConfig API,可以通过以下文档来了解使用方式:\n\n * 修改输出产物\n * 深入理解构建\n\n\n发布组件#\n\n推荐使用 Modern.js Module 提供的版本发布功能,可以参考 「版本管理与发布」。","routePath":"/module-tools/guide/best-practices/components","lang":"zh","toc":[{"text":"初始化项目","id":"初始化项目","depth":2,"charIndex":40},{"text":"使用 Storybook 调试代码","id":"使用-storybook-调试代码","depth":2,"charIndex":166},{"text":"开发样式","id":"开发样式","depth":2,"charIndex":227},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":335},{"text":"Less","id":"less","depth":3,"charIndex":587},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":680},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":784},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":832},{"text":"配置构建产物","id":"配置构建产物","depth":2,"charIndex":1071},{"text":"发布组件","id":"发布组件","depth":2,"charIndex":1431}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":78,"title":"使用 Tailwind CSS","content":"#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\nModern.js Module 支持使用 Tailwind CSS 开发组件样式。\n\n\n启用 Tailwind CSS#\n\n在 Modern.js Module 中使用 Tailwind CSS,你只需要按照以下步骤操作:\n\n 1. 在项目根目录下执行 pnpm run new,按照如下进行选择:\n\n\n\n成功开启后,你会看到 package.json 中新增了 tailwindcss 和 @modern-js/plugin-tailwindcss 依赖。\n\n 2. 在 modern.config.ts 中注册 Tailwind 插件:\n\n\n\n 3. 创建 index.css 文件,添加以下代码:\n\n\n\nINFO\n\n根据需求不同,你可以选择性地导入 Tailwind CSS 提供的 CSS 样式。请参考 @tailwind 文档 来了解 @tailwind 指令的详细用法。\n\n 4. 引用 index.css 文件,比如在入口的 src/index.jsx 文件添加如下代码:\n\n\n\n 5. 然后即可在各个组件中使用 Tailwind CSS 提供的 Utility Class 了:\n\n\n\n\n配置 Tailwind CSS#\n\n在 Modern.js Module 中,你有两种方式来配置 Tailwind CSS:\n\n 1. 使用 tailwind.config.{ts,js} 文件,该用法与 Tailwind CSS 的官方用法一致,请参考 \"Tailwind CSS -\n Configuration\" 来了解更多用法。\n\n\n\nTIP\n\n请升级 Modern.js Module 到 >= 2.33.0 版本,以支持自动读取 tailwind.config.{ts,js} 文件。\n\n 2. 使用 style.tailwindcss 配置项,这是旧版本的用法,我们更推荐使用 tailwind.config.{ts,js} 文件进行配置。\n\n\n\n如果你同时使用了 tailwind.config.{ts,js} 文件和 style.tailwindcss 选项,那么 style.tailwindcss\n定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n\n\nTailwind CSS 自动补全#\n\nTailwind CSS 官方提供了 Tailwind CSS IntelliSense 插件,用于在 VS Code 中自动补全 Tailwind CSS 的\nclass names、CSS functions 和 directives。\n\n你可以参考以下步骤来启动自动补全功能:\n\n 1. 在 VS Code 中安装 Tailwind CSS IntelliSense 插件。\n 2. 如果项目的根目录没有 tailwind.config.{ts,js} 文件,那么你需要创建该文件,并写入当前项目的 Tailwind CSS 配置,否则\n IDE 插件将无法正确生效。\n\n\n构建模式#\n\n在使用 Tailwind CSS 时,请注意构建产物在 bundle 和 bundleless 两种模式下会有很大区别。\n\nTIP\n\n关于 bundle 和 bundleless 的定义,可以查看 「深入理解构建」\n\n\nBundle 模式#\n\n在 Bundle 模式下,会生成一份单独的产物 CSS 文件,并且 JS 产物不会自动引用产物 CSS 文件。\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n\n如果你需要将样式注入 JS 产物中,可以开启 style.inject 选项。\n\n如果你没有开启 style.inject,那么也可以让用户手动引用产物 CSS 文件:\n\n\n\n\nBundleless 模式#\n\n在 Bundleless 模式下,默认会引用产物 CSS 文件,无须进行额外处理。\n\n * 产物代码:\n\n\n\n\n类名前缀#\n\n你可以通过 Tailwind CSS 提供的 prefix 选项来添加类名前缀,这样可以避免潜在的类名冲突问题(比如 App 和 Module 使用了不同版本的\nTailwind CSS)。\n\n例如,通过 prefix 选项添加 foo- 前缀:\n\n\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n用法介绍#\n\n下面是一些 Tailwind CSS 的用法示例。\n\n\nHTML 类名#\n\nTailwind CSS 支持在 HTML 标签上通过类名的方式增加样式。当使用 HTML 类名的时候,请注意必须要提前导入 Tailwind CSS 相应的\nCSS 样式。\n\n\n\n样式产物(此时是 bundle 构建):\n\n\n\n\n@apply#\n\nTailwind CSS 提供了 @apply 指令,可以通过它将 Tailwind CSS 提供的样式内联到我们编写的样式中。\n\n@apply 可以用于 CSS、Less、Sass 中。\n\n\n\n但是使用过程中,对于 Less 和 Sass 有些情况需要注意:\n\nSass#\n\n当将 Tailwind 与 Sass 一起使用时,@apply 后面存在 !important 的时候,需要使用插值来让 Sass 正确编译。\n\n * 不能正常工作:\n\n\n\n * 能够正常工作:\n\n\n\nLess#\n\n在与 Less 一起使用 Tailwind 时,你不能嵌套 Tailwind 的 @screen 指令。\n\n * 不能正常工作:\n\n\n\n * 相反,使用常规的媒体查询和 theme() 函数来引用你的屏幕尺寸,或者干脆不要嵌套你的 @screen 指令。\n\n\n\n\n\n\n关于 designSystem 配置#\n\ndesignSystem 是 Modern.js Module 中废弃的配置项。\n\n从 Modern.js Module v2.33.0 版本开始,你可以使用 Tailwind CSS 的 theme 配置项来代替\ndesignSystem,不再需要将 theme 配置拆分并设置到 designSystem 上。\n\n * 旧版本用法:\n\n\n\n * 当前版本用法:\n\n","routePath":"/module-tools/guide/best-practices/use-tailwindcss","lang":"zh","toc":[{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":2,"charIndex":127},{"text":"配置 Tailwind CSS","id":"配置-tailwind-css","depth":2,"charIndex":585},{"text":"Tailwind CSS 自动补全","id":"tailwind-css-自动补全","depth":2,"charIndex":1047},{"text":"构建模式","id":"构建模式","depth":2,"charIndex":1360},{"text":"Bundle 模式","id":"bundle-模式","depth":3,"charIndex":1477},{"text":"Bundleless 模式","id":"bundleless-模式","depth":3,"charIndex":1660},{"text":"类名前缀","id":"类名前缀","depth":2,"charIndex":1732},{"text":"用法介绍","id":"用法介绍","depth":2,"charIndex":1890},{"text":"HTML 类名","id":"html-类名","depth":3,"charIndex":1925},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":2192},{"text":"Less","id":"less","depth":4,"charIndex":2300},{"text":"关于 `designSystem` 配置","id":"关于-designsystem-配置","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":79,"title":"通用类问题","content":"#\n\n\nModern.js Module 和 Rsbuild 的关系?#\n\nModern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于解决 Web 应用构建场景。\n\n\nModern.js Module 是否可以使用 webpack plugin 或者 loader?#\n\nModern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。 这里可以发现更多 esbuild 社区插件\n\n如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 UMD Plugin 构建 UMD 产物。","routePath":"/module-tools/guide/faq/basic","lang":"zh","toc":[{"text":"Modern.js Module 和 Rsbuild 的关系?","id":"modernjs-module-和-rsbuild-的关系","depth":2,"charIndex":3},{"text":"Modern.js Module 是否可以使用 webpack plugin 或者 loader?","id":"modernjs-module-是否可以使用-webpack-plugin-或者-loader","depth":2,"charIndex":103}],"domain":"","frontmatter":{},"version":""},{"id":80,"title":"构建相关问题","content":"#\n\n这里只记录了一些常见问题和 bad case。\n\n如果是构建产物不符合预期的场景,尤其是配置了 buildPreset 的情况下, 请先了解 buildPreset 代表了哪些配置项,再根据所有的配置项逐个检查\n\n\n产物问题#\n\n\nClass Fields 的初始化处理#\n\nTypeSript 提供了 useDefineForClassFields 配置用于控制对于 public class fields 的转换处理。\n\n如果有一段代码:\n\n\n\n当 useDefineForClassFields 为 false 的时候,则编译后的代码会变为:\n\n\n\n当 useDefineForClassFields 为 true 的时候,则编译后的代码会变为:\n\n\n\n同时该配置的默认值会根据 tsconfig.json 的 target 配置而变化:当 target 是 ES2022 或者更高的时候,则\nuseDefineForClassFields 默认配置为 true,否则就是默认为 false。\n\n关于 TypeScript 这个配置的更多信息,可以参考下面的链接:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nModern.js Module 目前会根据下面的逻辑进行处理:\n\n 1. 首先根据当前项目的 tsconfig.json 的 useDefineForClassFields 配置确定在 Modern.js Module\n 内部如何处理。目前只会读取当前项目路径下的 tsconfig.json 文件的内容,暂时不支持根据 extends 配置来获取最终的 tsconfig\n 配置。\n 2. 如果没有检测 tsconfig.json 的 useDefineForClassFields 配置,则会根据 tsconfig.json 的\n target 配置来确定默认值。如果 target 大于 ES2022(包含 EsNext),则useDefineForClassFields默认为\n true,否则为 false。\n 3. 如果没有检测到 tsconfig.json 的 target,则按照 useDefineForClassFields的值 为 true 进行处理。\n\n\nbabel-plugin-lodash 将引入的 lodash 处理成 undefined#\n\n当使用类似下面的方式的时候,会出现这个问题:\n\n\n\n目前在 babel-plugin-lodash Github 上的相关 Issue:\n\n * #235\n\n这个问题的解决办法是移除 babel-plugin-lodash,因为此时不需要该插件进行按需引用,使用该插件会产生副作用。\n\n类似的情况在 babel-plugin-import 上也可能会出现。比如有类似如下的代码:\n\n\n\n此时 babel-plugin-import 也可能会导致 Comps 变为 undefined。因此也需要移除对应的 babel-plugin-import。\n\n\nCannot find module 'http'#\n\n如果产物在浏览器运行时报了类似 Cannot find module 'http' 的错误,说明你的产物打包进了 node 模块。\n这可能会发生于你的依赖里有一些同时支持 browser 和 node 的三方包,例如 axios,此时只需要将 platform 设置为 browser 即可。\n如果一些三方包不支持 browser, 你可能需要手动注入 node polyfill。\n\n\n异常类问题#\n\n\nDynamic require of \"react\" is not supported#\n\n问题描述#\n\n当构建的产物配置中产物格式为 ES modules 的时候:\n\n\n\n如果导入了的第三方 npm 包的 cjs 产物,那么生成的产物可能会在 webpack 下有可能无法正常运行。\n\n\n\n解决办法#\n\n 1. 首先需要找到是哪个第三方包引起的问题。例如报错信息中指向了 react 这个包,那么就要寻找在哪个第三方包里存在 require('react')\n 这样的代码。比如 react-draggable ,这个包仅包含 cjs 产物,那么问题定位到 react-draggable 这个包。\n 2. 然后我们需要将这个包通过下面的配置进行排除,即不打包存在问题的第三方包。\n\n\n\n参考链接#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\n编译过程中,因为某个组件库的 less 文件报错:'Operation on an invalid type'#\n\n可能是因为该组件库依赖的 Less 版本是 v3,而 Modern.js Module 默认是 v4。v3 与 v4 在 math 配置上存在有 Break\nChange,可以查看这个链接 了解详情。\n\n因此,如果是在源码中使用了类似这样的组件库:\n\n在构建配置中使用了 buildPreset 的情况下,按照下面进行修改:\n\n\n\n或者使用了自定义的 buildConfig 的情况下,按照下面进行修改:\n\n\n\n如果是在 Storybook 中使用了类似这样的组件,则需要修改 Storybook 的调试配置:\n\n\n\n\nBundleless DTS failed#\n\n在不打包的场景下,是直接 tsc\n生成类型声明文件。通过终端打印的错误信息,你可以找到问题文件。对于源码文件,推荐将类型问题进行修复,这能够更好地使你的包得到复用。但如果遇到三方包的类型检查问题\n:\n\n 1. 开启 skipLibCheck 来跳过三方包的 d.ts 检查。\n 2. 如果三方包直接导出 ts 文件, skipLibCheck 将会失效,因为其只能跳过 d.ts 检查,因此你只能关闭 dts.abortOnError\n 来忽略这些错误。\n\n\nBundle DTS failed#\n\nModern.js Module 直接使用 rollup-plugin-dts 来打包你的类型描述文件。 它可能无法处理某些第三方依赖的类型文件。\n\n如果遇到 Modern.js Module 构建过程中出现 Bundle DTS failed\n的错误信息标题的时候,可以观察报错信息是来自某个第三方依赖。尝试设置 dts.respectExternal 为 false\n来关闭打包第三方依赖的类型文件的行为。\n\n\ndefineConfig 函数类型报错:如果没有引用 \"...\",则无法命名 \"default\" 的推断类型#\n\n检查项目的 tsconfig.json 文件中是否存在 include 配置,如果没有,则尝试增加下面的内容:\n\n\n\n\n其他#\n\n\nbundleless 如何跳过对 less / scss 文件的预处理#\n\nbundleless 是单文件编译的方式,只需要将你的 less / scss 文件从入口里移除并且将其拷贝到产物里即可。 注意我们还会把 js 引用 less\n/ scss 的 moduleId 进行改写,你可以通过 redirect 配置关闭它。\n\n下面是一个跳过 less 文件处理的例子,你会发现 src 里面所有的 less 文件都被拷贝到 dist 里并且保留了一致的相对路径。\n\n\n\n\n增加额外的编译能力#\n\nModern.js Module 基于 esbuild 实现,因此如果有特殊需求或者想要增加额外的编译能力,可以通过实现 esbuild 插件来解决。\n\nModern.js Module 提供了 esbuildOptions 配置允许修改 Modern.js Module 内部的 esbuild\n配置,因此可以通过该配置来增加自定义的 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\n\n支持生成 CSS Modules 的 TypeScript 声明文件#\n\n * 方案一:typed-css-modules\n * 方案二:postcss-modules-dts\n\n","routePath":"/module-tools/guide/faq/build","lang":"zh","toc":[{"text":"产物问题","id":"产物问题","depth":2,"charIndex":110},{"text":"Class Fields 的初始化处理","id":"class-fields-的初始化处理","depth":3,"charIndex":118},{"text":"babel-plugin-lodash 将引入的 lodash 处理成 `undefined`","id":"babel-plugin-lodash-将引入的-lodash-处理成-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":1337},{"text":"异常类问题","id":"异常类问题","depth":2,"charIndex":1559},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":1568},{"text":"问题描述","id":"问题描述","depth":4,"charIndex":1614},{"text":"解决办法","id":"解决办法","depth":4,"charIndex":1714},{"text":"参考链接","id":"参考链接","depth":4,"charIndex":1916},{"text":"编译过程中,因为某个组件库的 less 文件报错:`'Operation on an invalid type'`","id":"编译过程中因为某个组件库的-less-文件报错operation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":2338},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":2595},{"text":"`defineConfig` 函数类型报错:`如果没有引用 \"...\",则无法命名 \"default\" 的推断类型`","id":"defineconfig-函数类型报错如果没有引用-则无法命名-default-的推断类型","depth":3,"charIndex":-1},{"text":"其他","id":"其他","depth":2,"charIndex":2940},{"text":"bundleless 如何跳过对 less / scss 文件的预处理","id":"bundleless-如何跳过对-less--scss-文件的预处理","depth":3,"charIndex":2946},{"text":"增加额外的编译能力","id":"增加额外的编译能力","depth":3,"charIndex":3184},{"text":"支持生成 CSS Modules 的 TypeScript 声明文件","id":"支持生成-css-modules-的-typescript-声明文件","depth":3,"charIndex":3492}],"domain":"","frontmatter":{},"version":""},{"id":81,"title":"常见问题","content":"#\n\n这里是 Modern.js Module 常见问题分类列表:\n\n * 通用类问题\n * 构建相关问题\n * Storybook 相关问题\n * 测试相关问题","routePath":"/module-tools/guide/faq/","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":82,"title":"Storybook 相关问题","content":"#\n\n\n支持 Storybook v7#\n\nStorybook v7 目前已全面支持并已成为我们的推荐使用版本。\n\n\n使用 Storybook Addon 或者其他配置不生效#\n\nModern.js Module 目前使用的 Storybook 版本是 v6,如果使用了 v7 版本的 Addon 可能会出现插件不生效的情况。\n\n除了 Addon 以外,其他配置也可能会有区别。比如修改 preview.js 配置文件的话,Storybook v6 与 v7 的写法也不相同:\n\n * v6:文档链接\n * v7:文档链接\n\n\nCannot find module 'react-dom/package.json'#\n\n在执行 Storybook 调试的时候,出现下面的报错提示:\n\n\n\n解决办法:在项目中安装 react-dom 依赖。\n\n\n\n\n报错后,看不到具体报错信息#\n\n解决办法:\n\n 1. 找到 @storybook/core-server/dist/cjs/dev-server.js\n 2. 找到 var _await$Promise$all = await Promise.all([preview, manager 这附近的代码。\n 3. 修改成:\n\n\n\n\nCouldn't find any stories is your Storybook#\n\n\n\n当在预览区域看到类似这样的报错提示的时候,首先可以打开一下浏览器的控制台,应该会有些报错信息。可以先根据报错信息来推断是不是编写代码里出现的问题导致\nStorybook 无法正常运行。修复后,再次刷新查看是否正常。\n\n\nStorybook 添加 Proxy 功能#\n\nStorybook 没有提供相关方案,不过 Storybook Issue 中有找到相关的解决办法。在 Modern.js Module 中,你可以:\n\n 1. 添加 config/storybook/middleware.js 文件,并初始化下面的内容:\n\n\n\n 2. 添加 http-proxy-middleware 依赖\n 3. 添加代理路由相关配置\n\n\n\n相关 issue 链接:#11551。","routePath":"/module-tools/guide/faq/storybook","lang":"zh","toc":[{"text":"支持 Storybook v7","id":"支持-storybook-v7","depth":2,"charIndex":3},{"text":"使用 Storybook Addon 或者其他配置不生效","id":"使用-storybook-addon-或者其他配置不生效","depth":2,"charIndex":58},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":263},{"text":"报错后,看不到具体报错信息","id":"报错后看不到具体报错信息","depth":2,"charIndex":373},{"text":"Couldn't find any stories is your Storybook","id":"couldnt-find-any-stories-is-your-storybook","depth":2,"charIndex":538},{"text":"Storybook 添加 Proxy 功能","id":"storybook-添加-proxy-功能","depth":2,"charIndex":696}],"domain":"","frontmatter":{},"version":""},{"id":83,"title":"测试相关问题","content":"#\n\n\n执行 test 命令报错 TypeError: Cannot read property 'testEnvironmentOptions' of\nundefined#\n\n\n\n问题原因多是存在多个版本的 jest-environment-jsdom 依赖,可以检查 Monorepo 中其他项目是否有\njest-environment-jsdom 依赖,并通过 Monorepo 提供的 overrides 能力统一依赖版本。","routePath":"/module-tools/guide/faq/test","lang":"zh","toc":[{"text":"执行 `test` 命令报错 `TypeError: Cannot read property 'testEnvironmentOptions' of undefined`","id":"执行-test-命令报错-typeerror-cannot-read-property-testenvironmentoptions-of-undefined","depth":2,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":84,"title":"快速开始","content":"#\n\n\n三分钟快速上手#\n\n想要实际体验 Modern.js Module?首先你需要安装 Node.js LTS,并确保 Node 版本大于等于 16.0.0。我们推荐使用\nNode.js 18 的 LTS 版本。\n\n\n创建新项目#\n\n如果你想要创建一个完整的 Modern.js Module 项目,可以执行以下命令:\n\n\n\nINFO\n\n执行 npx @modern-js/create -h 查看更多命令行参数\n\n接着在问题交互中,按照如下选择:\n\n\n\n> 项目名称为 package.json 中的 \"name\" 字段值。\n\n接着就会开始初始化项目的流程。在项目目录和文件生成以及依赖安装完毕后,此时就创建了一个完整的 Modern.js Module 项目。\n\n我们可以直接执行 pnpm build 命令启动项目的构建,执行 pnpm build --watch 命令开启构建的观察模式。\n\n\n接入已有项目#\n\n在你的项目里安装以下依赖:\n\n * \"@modern-js/module-tools\"\n\n * \"typescript\"(如果不是 TypeScript 项目,则省略)\n\n> 对于使用 pnpm 或者 Yarn 包管理器的项目,只需要替换 npm 就可以了。推荐使用 pnpm。\n\n接着在项目的根目录下创建 modern.config.(t|j)s 文件:\n\n\n\n最后在项目的 package.json 文件里增加命令 \"build\": \"modern build\":\n\n\n\n如果你的项目存在 src/index.(js|jsx) 文件或者同时存在 src/index.(ts|tsx) 和 tsconfig.json\n文件,那么恭喜你可以运行直接运行 npm run build 来使用 Modern.js Module 构建你的项目了。\n\n\n核心 npm 包#\n\n@modern-js/module-tools 是 Modern.js Module 的核心 npm 包,主要提供以下能力:\n\n * 提供 modern dev, modern build 等常用的 CLI 命令。\n * 集成 Modern.js Core,提供配置解析、插件加载等能力。\n * 集成 esbuild 和 SWC,提供构建能力。\n * 集成一些最为常用的插件,比如 plugin-lint、plugin-changeset 等。\n\n@modern-js/module-tools 是基于 Modern.js 的插件体系实现的,本质上是一个插件,因此你需要在配置文件的 plugins\n字段中注册 moduleTools:\n\n\n\n\n查看官方示例#\n\n如果你想要看看使用了 Modern.js Module 的完整项目,可以执行以下命令:\n\n\n\n\n让我们开始吧#\n\n选择适合你的教程:\n\n * 我是初学者,需要学习 Modern.js Module 的基础使用。\n * 我已经初步掌握了 Modern.js Module 的使用,可以学习 Modern.js Module 的进阶指南。\n * 我需要扩展项目能力,需要学习如何开发 Modern.js Module 的插件。","routePath":"/module-tools/guide/intro/getting-started","lang":"zh","toc":[{"text":"三分钟快速上手","id":"三分钟快速上手","depth":2,"charIndex":3},{"text":"创建新项目","id":"创建新项目","depth":3,"charIndex":110},{"text":"接入已有项目","id":"接入已有项目","depth":3,"charIndex":402},{"text":"核心 npm 包","id":"核心-npm-包","depth":3,"charIndex":784},{"text":"查看官方示例","id":"查看官方示例","depth":3,"charIndex":1118},{"text":"让我们开始吧","id":"让我们开始吧","depth":2,"charIndex":1175}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":85,"title":"欢迎使用","content":"#\n\nModern.js Module 是 Modern.js\n的模块工程解决方案,同时也是核心依赖。它可以让开发者更轻松地构建、调试、发布模块类型的项目。模块类型的项目大多数情况可以认为是 npm\n包类型的项目,它可能是一个组件、组件库或者工具库项目。\n\n如果你正打算开发一个 npm 包类型的项目,那么你就来对地方了!Modern.js 提供了专业的模块工程解决方案。它带来了:\n\n * 简单的项目初始化:仅需执行 npx @modern-js/create project-dir\n 命令,然后进行几个交互问题,就可以创建一个完整的模块类型项目。创建的项目还支持选择 pnpm、Yarn 两种包管理器。\n * 代码格式化:在模块工程项目中,你可以执行 modern lint 来对代码进行格式化。同时初始化的模块工程项目里包含了 Modern.js 的\n ESLint 规则集,可以满足大部分场景下的需求。\n * 全面的构建能力和更快的构建速度:Modern.js Module 基于 esbuild 和 SWC\n 提供了高性能的构建能力,并且为不同构建模块的场景提供了丰富的配置。\n * Storybook 调试工具:Modern.js Module 为调试模块项目提供了 Storybook 调试工具。在安装了 Modern.js\n Module 的 Storybook 插件后,你可以使用 storybook dev 命令来启动它。你不仅可以使用 Storybook\n 对组件进行调试,也可以使用在其他类型的模块上。\n * 集成 Jest 的测试能力:在需要对模块测试的时候,可以使用 Modern.js Module 的 modern test 命令。Modern.js\n Module 不仅集成了 Jest,同时也提供了配置 Jest 的 API。\n * 基于 Changesets 实现的版本管理:当需要对项目记录变更内容的时候,可以使用 modern change 命令生成包含变更内容的 Markdown\n 文件;当需要对项目进行版本升级的时候,可以使用 modern bump 命令通过 Markdown 文件分析并升级版本;当需要发布项目的时候,可以使用\n modern release 命令对项目进行发布。Modern.js Module 基于 Changesets 实现了这些命令。\n * 可扩展性的插件机制:想要为项目集成其他的调试工具?又或者是想要在构建过程中做一些额外处理?Modern.js Module\n 提供了插件机制和插件钩子,插件钩子覆盖了 dev 命令和 build 命令两个流程。你可以通过它们为项目进行能力的扩展。\n * 还有更多:Modern.js Module\n 在未来还会不断地在构建、调试功能上进行优化。如果在模块项目构建上存在需要解决的重要问题,又或者是某个主流的模块项目调试工具、模式出现的时候,那么它们很可能\n 成为 Modern.js Module 将要支持功能。","routePath":"/module-tools/guide/intro/welcome","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":86,"title":"为什么需要 Modern.js Module","content":"#\n\n大家可能都经历过:从零开始开发一个组件库或者工具库的过程中,我们不仅要考虑项目本身的代码逻辑如何编写,还要考虑项目的构建、调试、测试、代码格式化等等和代码逻辑无\n关的事情。\n\n比如说,当我们考虑构建模块项目的代码是使用什么构建工具的时候,在之前我们可能会考虑使用 webpack 还是 Rollup,然而现在的话,也许还会考虑是使用\nesbuild 还是 SWC。\n\n无论选择哪个构建工具,这对于没有熟练掌握这些构建工具使用方式的开发者来说,是需要一定的成本去学习的。即使想要快速使用,也会需要花费大量的时间和精力。\n\n而除了构建这件事情以外,像为项目提供调试工具、支持测试能力、增加代码格式校验等等,对于一个新手来说都有可能需要花费很长的时间和精力了解或者掌握它们,并且真正的服\n务于当前的项目中。\n\n而为了保证代码质量以及项目的完整性,我们往往是需要做这些与代码逻辑实现无关的事情。然而这些事情很有可能会影响整体的项目开发进度,降低开发者的开发体验,会让开发者\n感觉模块项目的开发门槛很高。\n\n如果说每次开发一个模块类型的项目都需要经历一遍这些工作准备的话,那么基本上刚开始开发的时间会大部分花费在这些与代码实现无关的事情上。如果能够提供一个模块工程解决\n方案,它能够帮助开发者解决项目工程上的事情,让开发者可以更专注于代码的实现上,那么这将会大大提升模块类型项目的开发体验。\n\n\n\nModern.js 为了让开发模块类型的项目更简单、解决上述提到的问题,提供了模块工程解决方案,并且通过 Modern.js Module\n提供了主要的功能。Modern.js Module 可以理解为是一个专门用于模块类型项目开发的工具。","routePath":"/module-tools/guide/intro/why-module-engineering-solution","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":88,"title":"快速开始","content":"#\n\nModern.js Module 不仅提供了丰富的功能,同时也支持通过插件的方式为当前项目扩展能力。\n\n我们可以通过下面的例子来快速了解如何编写一个 Modern.js Module 插件:\n\n 1. 首先我们在初始化的项目下创建 ./plugins/example.ts 文件。\n\n\n\n 2. 接着在 example.ts 文件中增加插件的代码。\n\n\n\n 3. 然后我们通过 plugins API,将刚刚写好的插件进行注册。\n\n\n\n 4. 最后运行 modern build,就可以看到:\n\n\n\n通过上面这个例子,我们了解到了下面几件事:\n\n * 推荐的插件目录结构\n * 插件的初始化代码\n * 插件的注册\n\n除了以上内容以外,我们还需要了解:\n\n * 插件对象、类型定义与推荐配置项\n * setup 函数、api 对象参数、生命周期钩子","routePath":"/module-tools/plugins/guide/getting-started","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":89,"title":"插件对象","content":"#\n\nModern.js Module 的插件是一个对象,对象包含以下属性:\n\n * name:插件的名称,唯一标识符。\n * setup:插件初始化函数,只会执行一次。setup 函数可以返回一个 Hooks 对象,Modern.js Module 会在特定的时机执行 Hooks\n 对象上定义的 Hook 对应的函数。\n\n例如在下面的插件代码示例中,在项目开始执行构建任务之前会触发 beforeBuild 函数的执行,并打印 build start 的 log 内容。\n\n\n\n\n\n\n插件类型定义#\n\n使用 TypeScript 时,可以引入内置的 CliPlugin 和 ModuleTools 类型,为插件提供正确的类型推导:\n\n\n\n\n插件配置项#\n\n建议将插件写成函数的形式,使插件能通过函数入参来接收配置项:\n\n","routePath":"/module-tools/plugins/guide/plugin-object","lang":"zh","toc":[{"text":"插件类型定义","id":"插件类型定义","depth":2,"charIndex":245},{"text":"插件配置项","id":"插件配置项","depth":2,"charIndex":323}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":90,"title":"Setup 函数","content":"#\n\n在「插件对象」 部分我们知道插件对象包含了一个 setup 函数,该函数不仅包含了一个 api 对象参数,同时还可以返回一个 Hooks 对象。\n\n\n插件 API 对象#\n\n插件的 setup 函数会提供一个 api 对象参数,你可以调用该对象上提供的一些方法来获取到配置、项目上下文等信息。\n\n\n\n\napi.useAppContext#\n\n用于获取项目上下文信息。\n\n\n\nINFO\n\n通过实际的类型文件,我们可以看到还存在一些其他字段,不过目前对于 Modern.js Module 有意义的字段只有以上内容,api 对象其他的方法也是如此。\n\n\napi.useResolvedConfigContext#\n\n用于获取解析之后的最终配置。\n\nINFO\n\n如果需要获取构建相关的最终配置,需要使用 beforeBuild Hook。\n\n\n\n\napi.useHookRunners#\n\n用于获取 Hooks 的执行器,并触发特定的 Hook 执行。\n\n\n\n\n异步 setup#\n\nCLI 插件的 setup 可以是一个异步函数,在初始化过程中执行异步逻辑。\n\n\n\n注意,只有当前插件的 setup 异步函数执行完毕,才会继续执行下一个插件的 setup 函数。因此,你需要避免在 setup\n函数中进行耗时过长的异步操作,防止影响 CLI 启动性能。\n\n\n生命周期钩子#\n\n我们知道 setup 函数会返回一个 Hooks 对象,所谓 Hooks 对象也可以理解是具有 Modern.js Module 生命周期钩子的对象。\n\n目前主要包含两类钩子:\n\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n关于生命周期钩子的完整列表参考 API 文档。","routePath":"/module-tools/plugins/guide/setup-function","lang":"zh","toc":[{"text":"插件 API 对象","id":"插件-api-对象","depth":2,"charIndex":77},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"异步 setup","id":"异步-setup","depth":2,"charIndex":430},{"text":"生命周期钩子","id":"生命周期钩子","depth":2,"charIndex":579}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":91,"title":"总览","content":"#\n\n\n官方插件#\n\n * @modern-js/plugin-module-import:使用 SWC 提供与 babel-plugin-import 一样的能力。\n * @modern-js/plugin-module-banner:为每个 JS 和 CSS 文件的顶部和底部添加自定义内容,例如版权信息。\n * @modern-js/plugin-module-node-polyfill:会自动注入 Node 核心模块在浏览器端的 polyfills。\n * @modern-js/plugin-module-polyfill:为你的代码中使用到的不支持的功能注入 polyfill。\n * @modern-js/plugin-module-babel:使用 Babel 转换你的代码。\n * @modern-js/plugin-module-vue:提供对 Vue 3 组件构建的支持。","routePath":"/module-tools/plugins/official-list/overview","lang":"zh","toc":[{"text":"官方插件","id":"官方插件","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":92,"title":"Babel 插件","content":"#\n\nTIP\n\n通常情况下,我们无需使用 Babel 转换我们的代码,此插件仅作为一种降级方式。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时需要打包 A,B 两个文件,并只需要在打包 A 时使用 babel:\n\n\n\n\n配置#\n\nSee Babel options\n\n下面是一个配置了@babel/preset-env的例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-babel","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":50},{"text":"安装","id":"安装","depth":3,"charIndex":58},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":64},{"text":"配置","id":"配置","depth":2,"charIndex":172}],"domain":"","frontmatter":{},"version":""},{"id":93,"title":"Banner 插件","content":"#\n\n提供为每个 JS 和 CSS 文件的顶部和底部注入内容的能力。\n\nTIP\n\n从 @modern-js/module-tools 2.36.0 版本开始,该插件功能内置在 Modern.js Module 中,由 banner 和\nfooter 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\nTIP\n\n注意:CSS 的注释不支持 //comment 这样的写法。详见「CSS 注释」\n\n\n示例#\n\n\n在 JS 文件顶部增加版权信息#\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nbanner#\n\n在顶部增加内容。\n\n * banner.js:在 JS 文件顶部增加内容。\n * banner.css:在 CSS 文件顶部增加内容。\n\n\nfooter#\n\n在底部增加内容。\n\n * footer.js:在 JS 文件底部增加内容。\n * footer.css:在 CSS 文件底部增加内容。","routePath":"/module-tools/plugins/official-list/plugin-banner","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":132},{"text":"安装","id":"安装","depth":3,"charIndex":140},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":146},{"text":"示例","id":"示例","depth":2,"charIndex":240},{"text":"在 JS 文件顶部增加版权信息","id":"在-js-文件顶部增加版权信息","depth":3,"charIndex":246},{"text":"配置","id":"配置","depth":2,"charIndex":267},{"text":"banner","id":"banner","depth":3,"charIndex":283},{"text":"footer","id":"footer","depth":3,"charIndex":362}],"domain":"","frontmatter":{},"version":""},{"id":94,"title":"Import 插件","content":"#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现。\n\nTIP\n\n从 @modern-js/module-tools 2.16.0 版本开始,该插件功能内置在 Modern.js Module 中,由\ntransformImport 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n这样我们就可以在 Modern.js Module 中使用自动导入的能力了。\n\n\n配置#\n\n * 类型:\n\n\n\n\npluginImport#\n\n * 类型:object[]\n\n其中数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n\n注意事项#\n\nSWC (Speedy Web Compiler) 是基于 Rust 语言编写的,而该插件是基于 SWC,移植自\nbabel-plugin-import,配置选项保持了一致。\n\n一些配置可以传入函数,例如 customName,customStyleName 等, 但在 Modern.js Module\n里,我们不建议在此配置项里使用函数。 因为我们会在 esbuild 的插件里调用 SWC,然后再当 Rust 通过 Node-API\n调用这些配置函数时,会出现死锁现象。\n\n简单的函数逻辑其实可以通过模版语言来代替,下面是一个 customName 使用模板的示例:\n\n\n\n添加以下配置:\n\n\n\n其中的 {{ member }} 会被替换为相应的引入成员,转换后:\n\n\n\n可以看出配置 customName: \"foo/es/{{ member }}\" 的效果等同于配置 customName: (member) =>\n`foo/es/${member}` 。\n\n这里使用到的模版是 handlebars,模版配置中还内置了一些有用的辅助工具,还是以上面的导入语句为例,配置成:\n\n\n\n会转换成下面的结果:\n\n\n\n除了 kebabCase 以外还有 camelCase,snakeCase,upperCase,lowerCase 可以使用。","routePath":"/module-tools/plugins/official-list/plugin-import","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":144},{"text":"安装","id":"安装","depth":3,"charIndex":152},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":158},{"text":"配置","id":"配置","depth":2,"charIndex":245},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":261},{"text":"注意事项","id":"注意事项","depth":2,"charIndex":357}],"domain":"","frontmatter":{},"version":""},{"id":95,"title":"Node Polyfill 插件","content":"#\n\nNode Polyfill 介绍\n\n通常情况下,我们不会在浏览器端使用 Node 模块。但在当前代码需要同时在 Node 端和浏览器端运行时,用到一些 Node 模块是有可能的。Node\nPolyfill 为这些 Node 模块提供了浏览器版本的 polyfills。\n\n通过使用 Node Polyfill 插件,会自动注入 Node 核心模块在浏览器端的 polyfills,让你可以在浏览器端放心使用这些模块。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nexclude#\n\n排除要注入的 Node Polyfill。\n\n\n\n\noverrides#\n\n覆盖内置的 Node Polyfill。\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\n当你在代码中使用以上全局变量时,对应 polyfill 会被自动注入。\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\n当你通过 require 或 import 等语法在代码中引用以上模块时,对应 polyfill 会被注入。\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\n目前浏览器端没有以上模块的 polyfill,因此当你引用以上模块时,会自动 fallback 为一个空对象。\n\n","routePath":"/module-tools/plugins/official-list/plugin-node-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":213},{"text":"安装","id":"安装","depth":3,"charIndex":221},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":227},{"text":"配置","id":"配置","depth":2,"charIndex":274},{"text":"exclude","id":"exclude","depth":3,"charIndex":290},{"text":"overrides","id":"overrides","depth":3,"charIndex":326},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":363},{"text":"Globals","id":"globals","depth":3,"charIndex":381},{"text":"Modules","id":"modules","depth":3,"charIndex":464},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":860}],"domain":"","frontmatter":{},"version":""},{"id":96,"title":"Polyfill 插件","content":"#\n\nTIP\n\n通常情况下,我们不需要为 npm 包注入 polyfill,这一步应该在 Web\n应用的框架侧完成,但是在某些场景,为了让我们的库能够直接运行在低版本浏览器里,我们需要注入 polyfill。\n\n请注意,此插件并不会转化你的代码语法,只会为你的代码中使用到的不支持的功能注入 polyfill,把它们作为普通函数导入而不是污染全局。你需要安装\ncore-js-pure 依赖\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时具有多份构建配置,并只需要在 bundle 构建时注入 polyfill:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\ntargets#\n\n参考 Babel target.\n\n下面是一个例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":197},{"text":"安装","id":"安装","depth":3,"charIndex":205},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":211},{"text":"配置","id":"配置","depth":2,"charIndex":322},{"text":"targets","id":"targets","depth":3,"charIndex":338}],"domain":"","frontmatter":{},"version":""},{"id":97,"title":"Vue 插件","content":"#\n\nVue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 esbuild-plugin-vue3 和 @vue/babel-plugin-jsx。\n\nWARNING\n\n请注意,此插件仍有一些用法限制:\n\n 1. 目前此插件的实现是直接集成社区插件,因此不支持在 sfc 里写 jsx/tsx。\n 2. 如果要为组件生成 d.ts,请使用官方推荐方式 vue-tsc。\n 3. 仅支持打包场景,推荐将 input 设置为 ['src/**/*.vue'] 或者 ['src/index.ts']。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\n传递给 @vue/babel-plugin-jsx 的选项,请查阅 @vue/babel-plugin-jsx 文档 来了解具体用法。","routePath":"/module-tools/plugins/official-list/plugin-vue","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":256},{"text":"安装","id":"安装","depth":3,"charIndex":264},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":270},{"text":"配置","id":"配置","depth":2,"charIndex":317},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":323}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file