@modern-js/module-tools-docs 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +144 -0
- package/docs/en/api/plugin-api/plugin-hooks.md +2 -10
- package/docs/en/guide/advance/in-depth-about-dev-command.md +56 -12
- package/docs/en/guide/basic/before-getting-started.md +4 -14
- package/docs/en/guide/basic/command-preview.md +1 -1
- package/docs/en/guide/basic/modify-output-product.md +6 -2
- package/docs/en/guide/basic/use-micro-generator.md +62 -1
- package/docs/en/guide/basic/using-storybook.mdx +31 -9
- package/docs/en/guide/intro/getting-started.md +17 -8
- package/docs/en/index.md +14 -8
- package/docs/en/plugins/guide/getting-started.mdx +1 -1
- package/docs/zh/api/plugin-api/plugin-hooks.md +2 -10
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +52 -13
- package/docs/zh/guide/basic/before-getting-started.md +4 -14
- package/docs/zh/guide/basic/command-preview.md +2 -2
- package/docs/zh/guide/basic/modify-output-product.md +5 -3
- package/docs/zh/guide/basic/publish-your-project.md +4 -4
- package/docs/zh/guide/basic/test-your-project.mdx +18 -5
- package/docs/zh/guide/basic/use-micro-generator.md +61 -1
- package/docs/zh/guide/basic/using-storybook.mdx +39 -13
- package/docs/zh/guide/intro/getting-started.md +17 -11
- package/docs/zh/index.md +16 -10
- package/docs/zh/plugins/guide/getting-started.mdx +1 -1
- package/modern.config.ts +4 -6
- package/package.json +4 -4
- package/doc_build/api/config/build-config.html +0 -332
- package/doc_build/api/config/build-preset.html +0 -43
- package/doc_build/api/config/design-system.html +0 -103
- package/doc_build/api/config/plugins.html +0 -7
- package/doc_build/api/config/testing.html +0 -21
- package/doc_build/api/index.html +0 -1
- package/doc_build/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/api/config/build-config.html +0 -316
- package/doc_build/en/api/config/build-preset.html +0 -43
- package/doc_build/en/api/config/design-system.html +0 -117
- package/doc_build/en/api/config/plugins.html +0 -7
- package/doc_build/en/api/config/testing.html +0 -21
- package/doc_build/en/api/index.html +0 -1
- package/doc_build/en/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/guide/advance/asset.html +0 -25
- package/doc_build/en/guide/advance/build-umd.html +0 -32
- package/doc_build/en/guide/advance/copy.html +0 -42
- package/doc_build/en/guide/advance/external-dependency.html +0 -31
- package/doc_build/en/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/en/guide/advance/in-depth-about-dev-command.html +0 -12
- package/doc_build/en/guide/advance/theme-config.html +0 -29
- package/doc_build/en/guide/basic/before-getting-started.html +0 -89
- package/doc_build/en/guide/basic/command-preview.html +0 -63
- package/doc_build/en/guide/basic/modify-output-product.html +0 -98
- package/doc_build/en/guide/basic/publish-your-project.html +0 -50
- package/doc_build/en/guide/basic/test-your-project.html +0 -31
- package/doc_build/en/guide/basic/use-micro-generator.html +0 -29
- package/doc_build/en/guide/basic/using-storybook.html +0 -66
- package/doc_build/en/guide/best-practices/components.html +0 -111
- package/doc_build/en/guide/intro/getting-started.html +0 -36
- package/doc_build/en/guide/intro/welcome.html +0 -13
- package/doc_build/en/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/en/index.html +0 -1
- package/doc_build/en/plugins/guide/getting-started.html +0 -15
- package/doc_build/en/plugins/guide/plugin-object.html +0 -14
- package/doc_build/en/plugins/guide/setup-function.html +0 -30
- package/doc_build/en/plugins/official-list/overview.html +0 -3
- package/doc_build/guide/advance/asset.html +0 -25
- package/doc_build/guide/advance/build-umd.html +0 -32
- package/doc_build/guide/advance/copy.html +0 -42
- package/doc_build/guide/advance/external-dependency.html +0 -31
- package/doc_build/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/guide/advance/in-depth-about-dev-command.html +0 -14
- package/doc_build/guide/advance/theme-config.html +0 -28
- package/doc_build/guide/basic/before-getting-started.html +0 -89
- package/doc_build/guide/basic/command-preview.html +0 -63
- package/doc_build/guide/basic/modify-output-product.html +0 -97
- package/doc_build/guide/basic/publish-your-project.html +0 -52
- package/doc_build/guide/basic/test-your-project.html +0 -32
- package/doc_build/guide/basic/use-micro-generator.html +0 -27
- package/doc_build/guide/basic/using-storybook.html +0 -67
- package/doc_build/guide/best-practices/components.html +0 -111
- package/doc_build/guide/intro/getting-started.html +0 -39
- package/doc_build/guide/intro/welcome.html +0 -13
- package/doc_build/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/index.html +0 -1
- package/doc_build/plugins/guide/getting-started.html +0 -15
- package/doc_build/plugins/guide/plugin-object.html +0 -14
- package/doc_build/plugins/guide/setup-function.html +0 -30
- package/doc_build/plugins/official-list/overview.html +0 -3
- package/doc_build/static/css/main.edaad072.css +0 -1
- package/doc_build/static/js/1607.70af642a.js +0 -2
- package/doc_build/static/js/1607.70af642a.js.LICENSE.txt +0 -23
- package/doc_build/static/js/async/3799.e31e8293.js +0 -1
- package/doc_build/static/js/async/8652.6fbf1cb7.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-config.367a5701.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-preset.0d78b268.js +0 -1
- package/doc_build/static/js/async/en_api_config_design-system.b28d6723.js +0 -1
- package/doc_build/static/js/async/en_api_config_plugins.fc95fb77.js +0 -1
- package/doc_build/static/js/async/en_api_config_testing.8bc7f316.js +0 -1
- package/doc_build/static/js/async/en_api_index.669f0a56.js +0 -1
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.60d0260c.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_asset.5ff1d623.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_build-umd.c254ed46.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_copy.45c0a51d.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_external-dependency.a52d3247.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.51bf3569.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.aec0b4e1.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_theme-config.db0ad9fc.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.a22fc49a.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_command-preview.1707ed29.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.ad453d13.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.08c5112f.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_test-your-project.f5f6b204.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.56325139.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_using-storybook.9d721554.js +0 -1
- package/doc_build/static/js/async/en_guide_best-practices_components.45155af9.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_getting-started.f8682be3.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_welcome.9cc45924.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.7f2dae5c.js +0 -1
- package/doc_build/static/js/async/en_index.7bd869c4.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_getting-started.b850249c.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.bf6c6221.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_setup-function.80a2bd97.js +0 -1
- package/doc_build/static/js/async/en_plugins_official-list_overview.84e5cea0.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-config.048fd5ec.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-preset.7c13584d.js +0 -1
- package/doc_build/static/js/async/zh_api_config_design-system.1eecd474.js +0 -1
- package/doc_build/static/js/async/zh_api_config_plugins.c22dc4be.js +0 -1
- package/doc_build/static/js/async/zh_api_config_testing.a9888eed.js +0 -1
- package/doc_build/static/js/async/zh_api_index.22957707.js +0 -1
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.a4d81bf6.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_asset.5b936003.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_build-umd.b6d541ff.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_copy.21a1aea4.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.c7cf5d4b.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.64e795f3.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.168ce7dd.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_theme-config.b9570109.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.6b06b54a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_command-preview.1199124a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.8ccbc8d1.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.bf11b1c4.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.ae52c47a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.a091d57d.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.27829e44.js +0 -1
- package/doc_build/static/js/async/zh_guide_best-practices_components.7454d916.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_getting-started.a4c00d9a.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_welcome.71c3fe16.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.6f8b5ff6.js +0 -1
- package/doc_build/static/js/async/zh_index.c19f9dcf.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.099dfaea.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.963289d5.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.67d07b91.js +0 -1
- package/doc_build/static/js/async/zh_plugins_official-list_overview.a7635714.js +0 -1
- package/doc_build/static/js/lib-lodash.c5845536.js +0 -1
- package/doc_build/static/js/lib-polyfill.b3038509.js +0 -1
- package/doc_build/static/js/lib-react.d41ace5e.js +0 -2
- package/doc_build/static/js/lib-react.d41ace5e.js.LICENSE.txt +0 -29
- package/doc_build/static/js/main.2d3257a4.js +0 -1
- package/doc_build/static/search_index.json +0 -1
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png" /><title data-rh="true">Using Storybook - Module Tools</title><meta data-rh="true" name="description" content="Module Engineering Solutions"/><script>!function(){"use strict";var e,n,i,t,o,r={},u={};function _(e){var n=u[e];if(void 0!==n)return n.exports;var i=u[e]={exports:{}};return r[e].call(i.exports,i,i.exports,_),i.exports}_.m=r,e=[],_.O=function(n,i,t,o){if(!i){var r=1/0;for(a=0;a<e.length;a++){i=e[a][0],t=e[a][1],o=e[a][2];for(var u=!0,d=0;d<i.length;d++)(!1&o||r>=o)&&Object.keys(_.O).every((function(e){return _.O[e](i[d])}))?i.splice(d--,1):(u=!1,o<r&&(r=o));if(u){e.splice(a--,1);var c=t();void 0!==c&&(n=c)}}return n}o=o||0;for(var a=e.length;a>0&&e[a-1][2]>o;a--)e[a]=e[a-1];e[a]=[i,t,o]},_.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return _.d(n,{a:n}),n},i=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},_.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);_.r(o);var r={};n=n||[null,i({}),i([]),i(i)];for(var u=2&t&&e;"object"==typeof u&&!~n.indexOf(u);u=i(u))Object.getOwnPropertyNames(u).forEach((function(n){r[n]=function(){return e[n]}}));return r.default=function(){return e},_.d(o,r),o},_.d=function(e,n){for(var i in n)_.o(n,i)&&!_.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},_.f={},_.e=function(e){return Promise.all(Object.keys(_.f).reduce((function(n,i){return _.f[i](e,n),n}),[]))},_.u=function(e){return"static/js/async/"+({229:"en_guide_intro_getting-started",237:"zh_api_config_build-config",315:"en_index",421:"zh_api_config_testing",727:"zh_guide_advance_in-depth-about-build",775:"zh_guide_basic_before-getting-started",1085:"en_api_index",1108:"zh_guide_intro_why-module-engineering-solution",1178:"zh_api_plugin-api_plugin-hooks",1180:"zh_guide_advance_theme-config",1189:"zh_api_index",1677:"en_api_plugin-api_plugin-hooks",1756:"zh_guide_basic_command-preview",1895:"zh_index",2013:"zh_guide_best-practices_components",2020:"zh_guide_basic_publish-your-project",2033:"en_guide_intro_welcome",2034:"zh_guide_intro_welcome",2097:"en_api_config_plugins",2532:"en_guide_basic_use-micro-generator",2540:"zh_guide_advance_in-depth-about-dev-command",2556:"en_api_config_testing",2611:"zh_guide_advance_copy",2633:"zh_guide_intro_getting-started",2678:"en_guide_basic_before-getting-started",2821:"zh_guide_basic_modify-output-product",2892:"zh_plugins_guide_setup-function",3032:"en_guide_basic_publish-your-project",3741:"en_guide_basic_test-your-project",3806:"zh_api_config_plugins",4260:"en_guide_advance_external-dependency",4390:"zh_plugins_official-list_overview",4663:"en_guide_advance_build-umd",4695:"zh_api_config_design-system",4749:"en_plugins_guide_setup-function",4837:"zh_guide_advance_build-umd",5057:"en_guide_advance_copy",5107:"zh_guide_basic_using-storybook",5284:"zh_plugins_guide_plugin-object",5300:"en_plugins_guide_plugin-object",5532:"zh_guide_advance_external-dependency",5578:"en_guide_basic_modify-output-product",5654:"en_api_config_build-config",5723:"zh_guide_advance_asset",5966:"zh_guide_basic_test-your-project",6098:"en_guide_advance_theme-config",7241:"zh_api_config_build-preset",7294:"zh_guide_basic_use-micro-generator",7401:"en_guide_best-practices_components",7512:"en_guide_intro_why-module-engineering-solution",7571:"en_guide_basic_command-preview",8230:"en_guide_advance_asset",8687:"en_plugins_guide_getting-started",8782:"en_api_config_build-preset",8927:"en_guide_advance_in-depth-about-build",9220:"en_api_config_design-system",9479:"en_plugins_official-list_overview",9675:"en_guide_basic_using-storybook",9826:"en_guide_advance_in-depth-about-dev-command",9868:"zh_plugins_guide_getting-started"}[e]||e)+"."+{229:"f8682be3",237:"048fd5ec",315:"7bd869c4",421:"a9888eed",727:"64e795f3",775:"6b06b54a",1085:"669f0a56",1108:"6f8b5ff6",1178:"a4d81bf6",1180:"b9570109",1189:"22957707",1677:"60d0260c",1756:"1199124a",1895:"c19f9dcf",2013:"7454d916",2020:"bf11b1c4",2033:"9cc45924",2034:"71c3fe16",2097:"fc95fb77",2532:"56325139",2540:"168ce7dd",2556:"8bc7f316",2611:"21a1aea4",2633:"a4c00d9a",2678:"a22fc49a",2821:"8ccbc8d1",2892:"67d07b91",3032:"08c5112f",3741:"f5f6b204",3799:"e31e8293",3806:"c22dc4be",4260:"a52d3247",4390:"a7635714",4663:"c254ed46",4695:"1eecd474",4749:"80a2bd97",4837:"b6d541ff",5057:"45c0a51d",5107:"27829e44",5284:"963289d5",5300:"bf6c6221",5532:"c7cf5d4b",5578:"ad453d13",5654:"367a5701",5723:"5b936003",5966:"ae52c47a",6098:"db0ad9fc",7241:"7c13584d",7294:"a091d57d",7401:"45155af9",7512:"7f2dae5c",7571:"1707ed29",8230:"5ff1d623",8652:"6fbf1cb7",8687:"b850249c",8782:"0d78b268",8927:"51bf3569",9220:"b28d6723",9479:"84e5cea0",9675:"9d721554",9826:"aec0b4e1",9868:"099dfaea"}[e]+".js"},_.miniCssF=function(e){},_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),_.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t={},o="@modern-js/module-tools-docs:",_.l=function(e,n,i,r){if(t[e])t[e].push(n);else{var u,d;if(void 0!==i)for(var c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var f=c[a];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==o+i){u=f;break}}u||(d=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,_.nc&&u.setAttribute("nonce",_.nc),u.setAttribute("data-webpack",o+i),u.src=e),t[e]=[n];var s=function(n,i){u.onerror=u.onload=null,clearTimeout(g);var o=t[e];if(delete t[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach((function(e){return e(i)})),n)return n(i)},g=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),d&&document.head.appendChild(u)}},_.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},_.p="/",function(){var e={6272:0};_.f.j=function(n,i){var t=_.o(e,n)?e[n]:void 0;if(0!==t)if(t)i.push(t[2]);else if(6272!=n){var o=new Promise((function(i,o){t=e[n]=[i,o]}));i.push(t[2]=o);var r=_.p+_.u(n),u=new Error;_.l(r,(function(i){if(_.o(e,n)&&(0!==(t=e[n])&&(e[n]=void 0),t)){var o=i&&("load"===i.type?"missing":i.type),r=i&&i.target&&i.target.src;u.message="Loading chunk "+n+" failed.\n("+o+": "+r+")",u.name="ChunkLoadError",u.type=o,u.request=r,t[1](u)}}),"chunk-"+n,n)}else e[n]=0},_.O.j=function(n){return 0===e[n]};var n=function(n,i){var t,o,r=i[0],u=i[1],d=i[2],c=0;if(r.some((function(n){return 0!==e[n]}))){for(t in u)_.o(u,t)&&(_.m[t]=u[t]);if(d)var a=d(_)}for(n&&n(i);c<r.length;c++)o=r[c],_.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return _.O(a)},i=self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[];i.forEach(n.bind(null,0)),i.push=n.bind(null,i.push.bind(i))}()}();</script><script defer="defer" src="/static/js/lib-polyfill.b3038509.js"></script><script defer="defer" src="/static/js/lib-lodash.c5845536.js"></script><script defer="defer" src="/static/js/lib-react.d41ace5e.js"></script><script defer="defer" src="/static/js/1607.70af642a.js"></script><script defer="defer" src="/static/js/main.2d3257a4.js"></script><link href="/static/css/main.edaad072.css" rel="stylesheet"></head><body><div id="root"><div style="height:100%"><header class="top-0 left-0 relative md:fixed w-full" style="border-bottom:1px solid var(--modern-c-divider-light);z-index:var(--modern-z-index-nav)"><div class="J5RhI modern-doc-nav" p="x-6"><div flex="~" justify="between" align="items-center" h="full" class="Be7Bu"><div class="undefined"><a href="/module-tools/en" w="full" h="full" text="1rem" font="semibold" transition="opacity duration-300" hover="opacity-60" class="flex items-center"><span>Module Tools</span></a></div><div flex="~ 1" justify="end" align-items-center="~"><div class="fxz4T"><div class="search" flex="sm:1" p="sm:l-8"><div flex="~" align="items-center" pos="relative" m="r-2" font="semibold"><svg width="32" height="32" viewBox="0 0 32 32" w="5" h="5" fill="currentColor"><path fill="#888888" d="m29 27.586l-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9a9.01 9.01 0 0 1-9-9Z"></path></svg><input disabled="" cursor="text focus:auto" placeholder="Search" height="8" border="none" type="text" text="sm" p="t-0 r-2 b-0 l-2" transition="all duration-200 ease" class="rounded-sm SjSZ2 " aria-label="Search" autoComplete="off"/><div m="r-3" w="10" h="6" p="x-1.5" border="1px solid gray-light-3 rounded-md" text="xs gray-light-3" flex="~" align="items-center" justify="around" class="iUJv9"><span>⌘</span><span>K</span></div></div></div><div class="menu" h="14"><div text="sm" font="medium" m="x-3" class="text-brand"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html">Guide</a></div><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/api/index.html">API</a></div><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/plugins/guide/getting-started.html">Plugins</a></div><div m="x-3" last="mr-0"><div h="14" class="relative" flex="~ center"><button flex="~ center" align="items-center" font="medium" text="sm text-1 hover:text-2" transition="color duration-200" class="nav-menu-group-button"><span m="r-1" text="sm" font="medium">v2.2.0</span><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div pos="top-13 right-0" m="x-0.8" transition="opacity duration-300" class="nav-menu-group-content absolute" style="opacity:0;visibility:hidden"><div p="3" w="full" h="full" class="min-w-128px max-h-100vh rounded-xl whitespace-nowrap" bg="white" style="box-shadow:var(--modern-shadow-3);margin-right:-1.5rem;z-index:100;border:1px solid var(--modern-c-divider-light)"><div font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">Changelog<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div><div font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">Contributing<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div></div></div></div></div></div><div flex="~" text="sm" font="bold" align="items-center" class="translation WjR05"><div m="x-1.5"><div h="14" class="relative" flex="~ center"><button flex="~ center" align="items-center" font="medium" text="sm text-1 hover:text-2" transition="color duration-200" class="nav-menu-group-button"><span m="r-1" text="sm" font="medium"><svg width="32" height="32" viewBox="0 0 32 32" w="18px" h="18px"><path fill="currentColor" d="M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6l2.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"></path></svg></span><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div pos="top-13 right-0" m="x-0.8" transition="opacity duration-300" class="nav-menu-group-content absolute" style="opacity:0;visibility:hidden"><div p="3" w="full" h="full" class="min-w-128px max-h-100vh rounded-xl whitespace-nowrap" bg="white" style="box-shadow:var(--modern-shadow-3);margin-right:-1.5rem;z-index:100;border:1px solid var(--modern-c-divider-light)"><div font="medium"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/guide/basic/using-storybook"><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">简体中文<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div><div class="rounded-md" p="y-1.6 l-3"><span m="r-1" text="brand">English</span></div></div></div></div></div></div><div class="WjR05 modern-doc-appearance" display="none sm:flex" align-items-center="center"><button class="DdK0_ undefined" id="" type="button" role="switch"><span class="WLpap"><span class="Q_Ula"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="JMkpU"><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="tgdgB"><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg></span></span></button></div><div class="social-links FU7nx" nav-h="mobile sm:desktop" flex="~" align-items-center="~" pos="relative"><div h="full" flex="~" gap="x-4" align-items-center="~" transition="color duration-300"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools" target="_blank" rel="noopener noreferrer"><div class="_8YjQ"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><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"></path></svg></div></a></div></div></div><button class=" wzxr1"><span class="kECx4"><span class="wzOB6"></span><span class="coO8e"></span><span class="RrwJk"></span></span></button><div class="NeczB " id="navScreen"><div class="WLObZ"><div class="_3YuLy"><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class="text-brand"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html">Guide</a></div></div><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/api/index.html">API</a></div></div><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/plugins/guide/getting-started.html">Plugins</a></div></div><div w="full" class="osgV9"><div m="x-3" last="mr-0"><div pos="relative" class=" Tk5bz"><button class="X7ejb"><span class="IOfpr">v2.2.0</span><svg width="1em" height="1em" viewBox="0 0 32 32" class=" uavm2 "><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div><div class="ciUdc"><div class="pa-1" font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div><div flex="~"><span m="r-1">Changelog</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div><div class="pa-1" font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div><div flex="~"><span m="r-1">Contributing</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div></div></div></div></div></div></div><div class="rp9pY" flex="~" justify="center" align-items-center="center"><div class="align-items-center appearance pa-2 ctzdQ" flex="~" justify="center"><button class="DdK0_ undefined" id="" type="button" role="switch"><span class="WLpap"><span class="Q_Ula"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="JMkpU"><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="tgdgB"><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg></span></span></button></div></div><div flex="~" text="sm" font="bold" justify="center"><div m="x-1.5"><div pos="relative" class=" Tk5bz"><button class="X7ejb"><span class="IOfpr"><svg width="32" height="32" viewBox="0 0 32 32" w="18px" h="18px"><path fill="currentColor" d="M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6l2.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"></path></svg></span><svg width="1em" height="1em" viewBox="0 0 32 32" class=" uavm2 "><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div><div class="ciUdc"><div class="pa-1" font="medium"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/zh"><div><div flex="~"><span m="r-1">简体中文</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div><div class="pa-1"><span m="r-1" text="brand">English</span></div></div></div></div></div></div><div class="social-links FU7nx" nav-h="mobile sm:desktop" flex="~" align-items-center="~" pos="relative"><div h="full" flex="~" gap="x-4" align-items-center="~" transition="color duration-300"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools" target="_blank" rel="noopener noreferrer"><div class="_8YjQ"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><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"></path></svg></div></a></div></div></div></div></div></div></div></header><section><div p="t-0" m="md:t-14" class="Q34AI"><div class="_aGGP"><button flex="~ center" class="wNUbj"><div text="md" m="r-2"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"></path></svg></div><span text="sm">Menu</span></button></div><aside class="UroNu "><nav m="t-1"><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Introduction</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:96px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Welcome to Module Tools</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/why-module-engineering-solution.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Why module project solution</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/getting-started.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Quick start</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Basic Guide</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:224px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/before-getting-started.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Before you start</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/command-preview.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Command Preview</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/modify-output-product.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">modify-output-product</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/use-micro-generator.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Using the Microgenerator</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/using-storybook.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="RCb_U" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Using Storybook</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/test-your-project.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Testing Projects</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/publish-your-project.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Versioning and Publishing</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Advanced Guide</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:224px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/in-depth-about-build.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">In-depth understanding of build</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/in-depth-about-dev-command.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">深入理解 dev 命令</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/copy.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Use the Copy Tools</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/external-dependency.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">How to handle third-party dependencies</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/build-umd.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Build umd products</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/asset.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Handle static resource files</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/theme-config.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Theme Configuration</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Best practices</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:32px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/best-practices/components.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Developing Components</div></a></div></div></section></nav></aside><div flex="~ shrink-0" class="TP8A7"><div w="full"><div class="modern-doc"><!--$--><h1 id="using-storybook"><a class="header-anchor" aria-hidden="true" href="#using-storybook">#</a>Using Storybook</h1>
|
|
2
|
-
<p>First of all, if you haven't read the following, take a few minutes to understand it first.</p>
|
|
3
|
-
<ul>
|
|
4
|
-
<li><a href="/module-tools/en/guide/basic/use-micro-generator.html#storybook-debug">use micro-generator to enable Storybook debugging</a></li>
|
|
5
|
-
<li><a href="/module-tools/en/guide/basic/command-preview.html#modern-dev"><code>modern dev</code></a></li>
|
|
6
|
-
</ul>
|
|
7
|
-
<p><a href="https://storybook.js.org/" target="_blank" rel="nofollow">Storybook</a> is a tool dedicated to component debugging, providing around component development.</p>
|
|
8
|
-
<ul>
|
|
9
|
-
<li>Develop UIs that are more durable</li>
|
|
10
|
-
<li>Test UIs with less effort and no flakes</li>
|
|
11
|
-
<li>Document UI for your team to reuse</li>
|
|
12
|
-
<li>Share how the UI actually works</li>
|
|
13
|
-
<li>Automate UI workflows</li>
|
|
14
|
-
</ul>
|
|
15
|
-
<p>So it is a complex and powerful tool.</p>
|
|
16
|
-
<p>The modular engineering solution is integrated with Storybook, so you can pretty much follow the official Storybook documentation. However, there are still a few things to keep in mind, which are explained below.</p>
|
|
17
|
-
<h2 id="debugging-code"><a class="header-anchor" aria-hidden="true" href="#debugging-code">#</a>Debugging code</h2>
|
|
18
|
-
<p>Component code needs to be introduced during debugging code, and currently component code can be introduced in two ways:</p>
|
|
19
|
-
<ul>
|
|
20
|
-
<li>Referencing the component product</li>
|
|
21
|
-
<li>Referencing component source code</li>
|
|
22
|
-
</ul>
|
|
23
|
-
<p>We recommend the first way of "<strong>referencing component product</strong>". Because it is almost close to the real usage scenario, not only can we debug the component functionality, but also verify the correctness of the build product.</p>
|
|
24
|
-
<p>Next, we will talk about how to use each of these two methods.</p>
|
|
25
|
-
<h3 id="referencing-component-products"><a class="header-anchor" aria-hidden="true" href="#referencing-component-products">#</a>Referencing component products</h3>
|
|
26
|
-
<p>If the TypeScript project <code>foo</code> exists.</p>
|
|
27
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>Make sure the <code>main</code> and <code>types</code> of <code>package.json</code>
|
|
28
|
-
values are real paths.</p></div><div class="ch-spotlight-tab"><p>The source code of the <code>foo</code> project.</p></div><div class="ch-spotlight-tab"><p>Make sure that the <code>paths</code> configuration pointing to the project root is set in <code>stories/tsconfig.json</code>.
|
|
29
|
-
The <code>key</code> of <code>paths</code> is the same as the project name.</p></div><div class="ch-spotlight-tab"><p>Finally, it is referenced directly in the Story code by the project name.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="package.json" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5"></span>package.json</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "name": "foo",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "main": "./dist/index.js",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "types": "./dist/types/index.d.ts"</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></div></div></section>
|
|
30
|
-
<p>If, during development, you encounter a situation where the type definition is not available in real time, at that point.</p>
|
|
31
|
-
<p>For <code>pnpm</code> projects, <code>package.json</code> can be modified as follows.</p>
|
|
32
|
-
<div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "name": "foo",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "main": "./dist/index.js",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "types": "./src/index.ts",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "publishConfig": {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> "types": "./dist/index.d.ts",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div>
|
|
33
|
-
<blockquote>
|
|
34
|
-
<p>For the use of pnpm's <code>publishConfig</code>, you can read the following <a href="https://pnpm.io/package_json#publishconfig" target="_blank" rel="nofollow">link</a>.</p>
|
|
35
|
-
</blockquote>
|
|
36
|
-
<p>For npm and Yarn projects, the values of <code>types</code> of <code>package.json</code> can only be changed manually in <strong>development phase</strong> and <strong>release phase</strong>.</p>
|
|
37
|
-
<p>So why is it possible to reference the product directly?</p>
|
|
38
|
-
<ol>
|
|
39
|
-
<li>the <code>modern build</code> command is executed automatically before the <code>modern dev storybook</code> command, ensuring the existence of the project build product.</li>
|
|
40
|
-
<li>The project name is added as an alias inside Storybook to ensure that the path to the project's product can be parsed <strong>according to <code>package.json</code></strong>.</li>
|
|
41
|
-
</ol>
|
|
42
|
-
<h3 id="referencing-component-source-code"><a class="header-anchor" aria-hidden="true" href="#referencing-component-source-code">#</a>Referencing component source code</h3>
|
|
43
|
-
<p>Referencing component source code can be done by means of relative paths to:</p>
|
|
44
|
-
<div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./stories/index.tsx" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./stories/</span>index.tsx</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>import { content } from '../src';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>const Component = () => <div>this is a Story Component {content}</div>;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export const YourStory = () => <Component />;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export default {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> title: 'Your Stories',</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><br/></code></div></div></div></div>
|
|
45
|
-
<p>So why is the source code approach not recommended?</p>
|
|
46
|
-
<p>Not only is it impossible to verify that the component product is correct using the component source code, <strong>but also some of the configurations supported by the module project for building the product cannot be fully translated into Storybook internal configuration</strong>. If some of the configurations cannot be converted to each other, there will be unintended results during Storybook debugging.</p>
|
|
47
|
-
<h2 id="configure-storybook"><a class="header-anchor" aria-hidden="true" href="#configure-storybook">#</a>Configure Storybook</h2>
|
|
48
|
-
<p>Storybook is officially configured for projects through a folder called <code>.storybook</code>, which contains various configuration files. <strong>In a module project scenario, Storybook configuration files can be added to the <code>config/storybook</code> directory of the project.</strong></p>
|
|
49
|
-
<p>For more information on how to use the various Storybook configuration files, see the following links:</p>
|
|
50
|
-
<ul>
|
|
51
|
-
<li><a href="https://storybook.js.org/docs/react/configure/overview" target="_blank" rel="nofollow">Configure Storybook</a></li>
|
|
52
|
-
</ul>
|
|
53
|
-
<p><strong>But there are some limitations to Storybooking in a module project</strong>:</p>
|
|
54
|
-
<ul>
|
|
55
|
-
<li>It is currently not possible to change the location of the Story file, i.e., you cannot change the <code>stories</code> configuration in the <code>main.js</code> file.</li>
|
|
56
|
-
<li>Currently you cannot modify Webpack and Babel related configuration, i.e. you cannot modify <code>webpackFinal</code> and <code>babel</code> configuration in the <code>main.js</code> file.</li>
|
|
57
|
-
</ul>
|
|
58
|
-
<p>In the future we will consider whether these configurations can be allowed to be modified, but for now we are limiting their use to reduce unpredictable issues.</p>
|
|
59
|
-
<h2 id="building-storybook-products"><a class="header-anchor" aria-hidden="true" href="#building-storybook-products">#</a>Building Storybook Products</h2>
|
|
60
|
-
<p>In addition to Storybook debugging of components or common modules, you can also perform Storybook build tasks with the following commands.</p>
|
|
61
|
-
<div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>modern build --platform storybook</span></div></div><br/></code></div></div>
|
|
62
|
-
<p>For the <code>modern build --platform</code> command you can see.</p>
|
|
63
|
-
<ul>
|
|
64
|
-
<li><a href="/module-tools/en/guide/basic/command-preview.html#modern-build"><code>modern build</code></a></li>
|
|
65
|
-
</ul>
|
|
66
|
-
<p>After the build is complete, you can see the build product files in the <code>dist/storybook-static</code> directory.</p><!--/$--><div><footer m="t-8"><div flex="~ col sm:row" justify="sm:around" gap="2" p="t-6"><div flex="~ col" class="ajVjQ"><a class="R5q4o pAnzs" target="" cursor="pointer" href="/module-tools/en/guide/basic/use-micro-generator.html"><span class="rVEMI">Previous Page</span><span class="jr5Zr">Using the Microgenerator</span></a></div><div flex="~ col" class="A2aco"><a class="R5q4o pAnzs A2aco" target="" cursor="pointer" href="/module-tools/en/guide/basic/test-your-project.html"><span class="rVEMI">Next page</span><span class="jr5Zr">Testing Projects</span></a></div></div></footer></div></div></div><div class="RsCtL" style="min-height:calc(100vh - (var(--modern-nav-height) + 32px))"><div><div flex="~ col"><div class="<lg:hidden"><div p="l-4" text="sm" font-medium="~" id="aside-container" style="border-left:1px solid var(--modern-c-divider-light)" class="relative"><div class="absolute" opacity="0" w="1px" h="18px" bg="brand" style="top:33px;left:-1px;transition:top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s" id="aside-marker"></div><div block="~" class="leading-7" text="sm" font="semibold">ON THIS PAGE</div><nav><ul class="relative"><li><a href="#debugging-code" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Debugging code</a></li><li><a href="#referencing-component-products" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Referencing component products</a></li><li><a href="#referencing-component-source-code" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Referencing component source code</a></li><li><a href="#configure-storybook" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Configure Storybook</a></li><li><a href="#building-storybook-products" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Building Storybook Products</a></li></ul></nav></div></div></div></div></div></div></div></section></div></div></body></html>
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png" /><title data-rh="true"># Initialize the project - Module Tools</title><meta data-rh="true" name="description" content="Module Engineering Solutions"/><script>!function(){"use strict";var e,n,i,t,o,r={},u={};function _(e){var n=u[e];if(void 0!==n)return n.exports;var i=u[e]={exports:{}};return r[e].call(i.exports,i,i.exports,_),i.exports}_.m=r,e=[],_.O=function(n,i,t,o){if(!i){var r=1/0;for(a=0;a<e.length;a++){i=e[a][0],t=e[a][1],o=e[a][2];for(var u=!0,d=0;d<i.length;d++)(!1&o||r>=o)&&Object.keys(_.O).every((function(e){return _.O[e](i[d])}))?i.splice(d--,1):(u=!1,o<r&&(r=o));if(u){e.splice(a--,1);var c=t();void 0!==c&&(n=c)}}return n}o=o||0;for(var a=e.length;a>0&&e[a-1][2]>o;a--)e[a]=e[a-1];e[a]=[i,t,o]},_.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return _.d(n,{a:n}),n},i=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},_.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);_.r(o);var r={};n=n||[null,i({}),i([]),i(i)];for(var u=2&t&&e;"object"==typeof u&&!~n.indexOf(u);u=i(u))Object.getOwnPropertyNames(u).forEach((function(n){r[n]=function(){return e[n]}}));return r.default=function(){return e},_.d(o,r),o},_.d=function(e,n){for(var i in n)_.o(n,i)&&!_.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},_.f={},_.e=function(e){return Promise.all(Object.keys(_.f).reduce((function(n,i){return _.f[i](e,n),n}),[]))},_.u=function(e){return"static/js/async/"+({229:"en_guide_intro_getting-started",237:"zh_api_config_build-config",315:"en_index",421:"zh_api_config_testing",727:"zh_guide_advance_in-depth-about-build",775:"zh_guide_basic_before-getting-started",1085:"en_api_index",1108:"zh_guide_intro_why-module-engineering-solution",1178:"zh_api_plugin-api_plugin-hooks",1180:"zh_guide_advance_theme-config",1189:"zh_api_index",1677:"en_api_plugin-api_plugin-hooks",1756:"zh_guide_basic_command-preview",1895:"zh_index",2013:"zh_guide_best-practices_components",2020:"zh_guide_basic_publish-your-project",2033:"en_guide_intro_welcome",2034:"zh_guide_intro_welcome",2097:"en_api_config_plugins",2532:"en_guide_basic_use-micro-generator",2540:"zh_guide_advance_in-depth-about-dev-command",2556:"en_api_config_testing",2611:"zh_guide_advance_copy",2633:"zh_guide_intro_getting-started",2678:"en_guide_basic_before-getting-started",2821:"zh_guide_basic_modify-output-product",2892:"zh_plugins_guide_setup-function",3032:"en_guide_basic_publish-your-project",3741:"en_guide_basic_test-your-project",3806:"zh_api_config_plugins",4260:"en_guide_advance_external-dependency",4390:"zh_plugins_official-list_overview",4663:"en_guide_advance_build-umd",4695:"zh_api_config_design-system",4749:"en_plugins_guide_setup-function",4837:"zh_guide_advance_build-umd",5057:"en_guide_advance_copy",5107:"zh_guide_basic_using-storybook",5284:"zh_plugins_guide_plugin-object",5300:"en_plugins_guide_plugin-object",5532:"zh_guide_advance_external-dependency",5578:"en_guide_basic_modify-output-product",5654:"en_api_config_build-config",5723:"zh_guide_advance_asset",5966:"zh_guide_basic_test-your-project",6098:"en_guide_advance_theme-config",7241:"zh_api_config_build-preset",7294:"zh_guide_basic_use-micro-generator",7401:"en_guide_best-practices_components",7512:"en_guide_intro_why-module-engineering-solution",7571:"en_guide_basic_command-preview",8230:"en_guide_advance_asset",8687:"en_plugins_guide_getting-started",8782:"en_api_config_build-preset",8927:"en_guide_advance_in-depth-about-build",9220:"en_api_config_design-system",9479:"en_plugins_official-list_overview",9675:"en_guide_basic_using-storybook",9826:"en_guide_advance_in-depth-about-dev-command",9868:"zh_plugins_guide_getting-started"}[e]||e)+"."+{229:"f8682be3",237:"048fd5ec",315:"7bd869c4",421:"a9888eed",727:"64e795f3",775:"6b06b54a",1085:"669f0a56",1108:"6f8b5ff6",1178:"a4d81bf6",1180:"b9570109",1189:"22957707",1677:"60d0260c",1756:"1199124a",1895:"c19f9dcf",2013:"7454d916",2020:"bf11b1c4",2033:"9cc45924",2034:"71c3fe16",2097:"fc95fb77",2532:"56325139",2540:"168ce7dd",2556:"8bc7f316",2611:"21a1aea4",2633:"a4c00d9a",2678:"a22fc49a",2821:"8ccbc8d1",2892:"67d07b91",3032:"08c5112f",3741:"f5f6b204",3799:"e31e8293",3806:"c22dc4be",4260:"a52d3247",4390:"a7635714",4663:"c254ed46",4695:"1eecd474",4749:"80a2bd97",4837:"b6d541ff",5057:"45c0a51d",5107:"27829e44",5284:"963289d5",5300:"bf6c6221",5532:"c7cf5d4b",5578:"ad453d13",5654:"367a5701",5723:"5b936003",5966:"ae52c47a",6098:"db0ad9fc",7241:"7c13584d",7294:"a091d57d",7401:"45155af9",7512:"7f2dae5c",7571:"1707ed29",8230:"5ff1d623",8652:"6fbf1cb7",8687:"b850249c",8782:"0d78b268",8927:"51bf3569",9220:"b28d6723",9479:"84e5cea0",9675:"9d721554",9826:"aec0b4e1",9868:"099dfaea"}[e]+".js"},_.miniCssF=function(e){},_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),_.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t={},o="@modern-js/module-tools-docs:",_.l=function(e,n,i,r){if(t[e])t[e].push(n);else{var u,d;if(void 0!==i)for(var c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var f=c[a];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==o+i){u=f;break}}u||(d=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,_.nc&&u.setAttribute("nonce",_.nc),u.setAttribute("data-webpack",o+i),u.src=e),t[e]=[n];var s=function(n,i){u.onerror=u.onload=null,clearTimeout(g);var o=t[e];if(delete t[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach((function(e){return e(i)})),n)return n(i)},g=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),d&&document.head.appendChild(u)}},_.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},_.p="/",function(){var e={6272:0};_.f.j=function(n,i){var t=_.o(e,n)?e[n]:void 0;if(0!==t)if(t)i.push(t[2]);else if(6272!=n){var o=new Promise((function(i,o){t=e[n]=[i,o]}));i.push(t[2]=o);var r=_.p+_.u(n),u=new Error;_.l(r,(function(i){if(_.o(e,n)&&(0!==(t=e[n])&&(e[n]=void 0),t)){var o=i&&("load"===i.type?"missing":i.type),r=i&&i.target&&i.target.src;u.message="Loading chunk "+n+" failed.\n("+o+": "+r+")",u.name="ChunkLoadError",u.type=o,u.request=r,t[1](u)}}),"chunk-"+n,n)}else e[n]=0},_.O.j=function(n){return 0===e[n]};var n=function(n,i){var t,o,r=i[0],u=i[1],d=i[2],c=0;if(r.some((function(n){return 0!==e[n]}))){for(t in u)_.o(u,t)&&(_.m[t]=u[t]);if(d)var a=d(_)}for(n&&n(i);c<r.length;c++)o=r[c],_.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return _.O(a)},i=self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[];i.forEach(n.bind(null,0)),i.push=n.bind(null,i.push.bind(i))}()}();</script><script defer="defer" src="/static/js/lib-polyfill.b3038509.js"></script><script defer="defer" src="/static/js/lib-lodash.c5845536.js"></script><script defer="defer" src="/static/js/lib-react.d41ace5e.js"></script><script defer="defer" src="/static/js/1607.70af642a.js"></script><script defer="defer" src="/static/js/main.2d3257a4.js"></script><link href="/static/css/main.edaad072.css" rel="stylesheet"></head><body><div id="root"><div style="height:100%"><header class="top-0 left-0 relative md:fixed w-full" style="border-bottom:1px solid var(--modern-c-divider-light);z-index:var(--modern-z-index-nav)"><div class="J5RhI modern-doc-nav" p="x-6"><div flex="~" justify="between" align="items-center" h="full" class="Be7Bu"><div class="undefined"><a href="/module-tools/en" w="full" h="full" text="1rem" font="semibold" transition="opacity duration-300" hover="opacity-60" class="flex items-center"><span>Module Tools</span></a></div><div flex="~ 1" justify="end" align-items-center="~"><div class="fxz4T"><div class="search" flex="sm:1" p="sm:l-8"><div flex="~" align="items-center" pos="relative" m="r-2" font="semibold"><svg width="32" height="32" viewBox="0 0 32 32" w="5" h="5" fill="currentColor"><path fill="#888888" d="m29 27.586l-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9a9.01 9.01 0 0 1-9-9Z"></path></svg><input disabled="" cursor="text focus:auto" placeholder="Search" height="8" border="none" type="text" text="sm" p="t-0 r-2 b-0 l-2" transition="all duration-200 ease" class="rounded-sm SjSZ2 " aria-label="Search" autoComplete="off"/><div m="r-3" w="10" h="6" p="x-1.5" border="1px solid gray-light-3 rounded-md" text="xs gray-light-3" flex="~" align="items-center" justify="around" class="iUJv9"><span>⌘</span><span>K</span></div></div></div><div class="menu" h="14"><div text="sm" font="medium" m="x-3" class="text-brand"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html">Guide</a></div><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/api/index.html">API</a></div><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/plugins/guide/getting-started.html">Plugins</a></div><div m="x-3" last="mr-0"><div h="14" class="relative" flex="~ center"><button flex="~ center" align="items-center" font="medium" text="sm text-1 hover:text-2" transition="color duration-200" class="nav-menu-group-button"><span m="r-1" text="sm" font="medium">v2.2.0</span><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div pos="top-13 right-0" m="x-0.8" transition="opacity duration-300" class="nav-menu-group-content absolute" style="opacity:0;visibility:hidden"><div p="3" w="full" h="full" class="min-w-128px max-h-100vh rounded-xl whitespace-nowrap" bg="white" style="box-shadow:var(--modern-shadow-3);margin-right:-1.5rem;z-index:100;border:1px solid var(--modern-c-divider-light)"><div font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">Changelog<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div><div font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">Contributing<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div></div></div></div></div></div><div flex="~" text="sm" font="bold" align="items-center" class="translation WjR05"><div m="x-1.5"><div h="14" class="relative" flex="~ center"><button flex="~ center" align="items-center" font="medium" text="sm text-1 hover:text-2" transition="color duration-200" class="nav-menu-group-button"><span m="r-1" text="sm" font="medium"><svg width="32" height="32" viewBox="0 0 32 32" w="18px" h="18px"><path fill="currentColor" d="M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6l2.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"></path></svg></span><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div pos="top-13 right-0" m="x-0.8" transition="opacity duration-300" class="nav-menu-group-content absolute" style="opacity:0;visibility:hidden"><div p="3" w="full" h="full" class="min-w-128px max-h-100vh rounded-xl whitespace-nowrap" bg="white" style="box-shadow:var(--modern-shadow-3);margin-right:-1.5rem;z-index:100;border:1px solid var(--modern-c-divider-light)"><div font="medium"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/guide/best-practices/components"><div class="rounded-md" hover="bg-mute" p="y-1.6 l-3 r-6"><div flex="~"><span m="r-1">简体中文<svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1 l-1" class="inline-block align-text-top"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></span></div></div></a></div><div class="rounded-md" p="y-1.6 l-3"><span m="r-1" text="brand">English</span></div></div></div></div></div></div><div class="WjR05 modern-doc-appearance" display="none sm:flex" align-items-center="center"><button class="DdK0_ undefined" id="" type="button" role="switch"><span class="WLpap"><span class="Q_Ula"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="JMkpU"><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="tgdgB"><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg></span></span></button></div><div class="social-links FU7nx" nav-h="mobile sm:desktop" flex="~" align-items-center="~" pos="relative"><div h="full" flex="~" gap="x-4" align-items-center="~" transition="color duration-300"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools" target="_blank" rel="noopener noreferrer"><div class="_8YjQ"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><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"></path></svg></div></a></div></div></div><button class=" wzxr1"><span class="kECx4"><span class="wzOB6"></span><span class="coO8e"></span><span class="RrwJk"></span></span></button><div class="NeczB " id="navScreen"><div class="WLObZ"><div class="_3YuLy"><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class="text-brand"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html">Guide</a></div></div><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/api/index.html">API</a></div></div><div w="full" class="osgV9"><div text="sm" font="medium" m="x-3" class=""><a class="R5q4o " target="" cursor="pointer" href="/module-tools/en/plugins/guide/getting-started.html">Plugins</a></div></div><div w="full" class="osgV9"><div m="x-3" last="mr-0"><div pos="relative" class=" Tk5bz"><button class="X7ejb"><span class="IOfpr">v2.2.0</span><svg width="1em" height="1em" viewBox="0 0 32 32" class=" uavm2 "><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div><div class="ciUdc"><div class="pa-1" font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div><div flex="~"><span m="r-1">Changelog</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div><div class="pa-1" font="medium"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="R5q4o "><div><div flex="~"><span m="r-1">Contributing</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div></div></div></div></div></div></div><div class="rp9pY" flex="~" justify="center" align-items-center="center"><div class="align-items-center appearance pa-2 ctzdQ" flex="~" justify="center"><button class="DdK0_ undefined" id="" type="button" role="switch"><span class="WLpap"><span class="Q_Ula"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="JMkpU"><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="tgdgB"><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg></span></span></button></div></div><div flex="~" text="sm" font="bold" justify="center"><div m="x-1.5"><div pos="relative" class=" Tk5bz"><button class="X7ejb"><span class="IOfpr"><svg width="32" height="32" viewBox="0 0 32 32" w="18px" h="18px"><path fill="currentColor" d="M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6l2.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"></path></svg></span><svg width="1em" height="1em" viewBox="0 0 32 32" class=" uavm2 "><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg></button><div><div class="ciUdc"><div class="pa-1" font="medium"><a class="R5q4o " target="" cursor="pointer" href="/module-tools/zh"><div><div flex="~"><span m="r-1">简体中文</span><svg width="32" height="32" viewBox="0 0 32 32" w="11px" h="11px" text="text-3" m="t-1 r-1"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"></path></svg></div></div></a></div><div class="pa-1"><span m="r-1" text="brand">English</span></div></div></div></div></div></div><div class="social-links FU7nx" nav-h="mobile sm:desktop" flex="~" align-items-center="~" pos="relative"><div h="full" flex="~" gap="x-4" align-items-center="~" transition="color duration-300"><a href="https://github.com/modern-js-dev/modern.js/tree/main/packages/solutions/module-tools" target="_blank" rel="noopener noreferrer"><div class="_8YjQ"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><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"></path></svg></div></a></div></div></div></div></div></div></div></header><section><div p="t-0" m="md:t-14" class="Q34AI"><div class="_aGGP"><button flex="~ center" class="wNUbj"><div text="md" m="r-2"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"></path></svg></div><span text="sm">Menu</span></button></div><aside class="UroNu "><nav m="t-1"><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Introduction</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:96px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/welcome.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Welcome to Module Tools</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/why-module-engineering-solution.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Why module project solution</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/intro/getting-started.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Quick start</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Basic Guide</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:224px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/before-getting-started.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Before you start</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/command-preview.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Command Preview</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/modify-output-product.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">modify-output-product</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/use-micro-generator.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Using the Microgenerator</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/using-storybook.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Using Storybook</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/test-your-project.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Testing Projects</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/basic/publish-your-project.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Versioning and Publishing</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Advanced Guide</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:224px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/in-depth-about-build.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">In-depth understanding of build</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/in-depth-about-dev-command.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">深入理解 dev 命令</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/copy.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Use the Copy Tools</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/external-dependency.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">How to handle third-party dependencies</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/build-umd.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Build umd products</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/asset.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Handle static resource files</div></a></div><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/advance/theme-config.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="r3Oz1" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Theme Configuration</div></a></div></div></section><section block="~" class="mt-1"><div flex="~" justify="between" items-start="~" cursor="pointer" class="items-center r3Oz1"><h2 p="y-1 x-2" text="sm" font="semibold">Best practices</h2><div p="2" class="BgJSm"><div cursor-pointer="~" style="transition:transform 0.2s ease-out;transform:rotate(90deg)"><svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"></path></svg></div></div></div><div style="transition:height 0.2s ease-in-out;overflow:hidden;height:32px"><div m="last:b-0.5 l-4"><a class="R5q4o EZlU3" target="" cursor="pointer" href="/module-tools/en/guide/best-practices/components.html"><div m="t-1" p="y-1 x-2" block="~" border="rounded-sm" font-medium="~" class="RCb_U" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Developing Components</div></a></div></div></section></nav></aside><div flex="~ shrink-0" class="TP8A7"><div w="full"><div class="modern-doc"><!--$--><h1 id="developing-components"><a class="header-anchor" aria-hidden="true" href="#developing-components">#</a>Developing Components</h1>
|
|
2
|
-
<p>This chapter will describe how to develop component projects using the module engineering solution.</p>
|
|
3
|
-
<h1 id="-initialize-the-project"><a class="header-anchor" aria-hidden="true" href="#-initialize-the-project">#</a># Initialize the project</h1>
|
|
4
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>It is recommended to use the <code>@modern-js/create</code> command to initialize an npm project.</p></div><div class="ch-spotlight-tab"><p>The initialized directory structure.</p></div><div class="ch-spotlight-tab"><p>Modify the <code>. /src/index.ts</code> file suffix and content.</p><p>At this point, a component project is initialized.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="Interactive" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5"></span>Interactive</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>npx @modern-js/create components-project</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Please select the solution you want to create Module Solution</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Package Name components-demo</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Development Language TS</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Package Management Tool pnpm</span></div></div><br/></code></div></div></div></div></div></section>
|
|
5
|
-
<h2 id="debugging-code-with-storybook"><a class="header-anchor" aria-hidden="true" href="#debugging-code-with-storybook">#</a>Debugging code with Storybook</h2>
|
|
6
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>Execute the <code>new</code> command in the project root directory to enable the Storybook feature.</p></div><div class="ch-spotlight-tab"><p>Once successfully opened, you will see that a new dependency has been added to <code>package.json</code>. The <code>stories</code> directory and related initialization files are also created.</p></div><div class="ch-spotlight-tab"><p>After initialization, the <code>tsconfig.json</code> file in the <code>. /stories</code> directory, the <code>tsconfig.json</code> file is set by default with the <code>paths</code> configuration of the same name as the project.</p></div><div class="ch-spotlight-tab"><p>Such a configuration allows you to introduce code in Story code directly using the name of the project.</p></div><div class="ch-spotlight-tab"><p>At this point Storybook identifies the entry point for the imported code based on fields like <code>main</code>, <code>exports</code> in the project's <code>package.json</code> file.
|
|
7
|
-
The location of the type file is determined by the <code>types</code> field.</p></div><div class="ch-spotlight-tab"><p>While importing source code for debugging is also supported, debugging using project artifacts is more reliable.</p><p>Debugging with source code has a limitation: some configurations are not equivalent in Storybook and in the original build support.</p><p><strong>This is why debugging with the product is recommended</strong>.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="Terminal" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5"></span>Terminal</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>pnpm run new</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Action Enable features</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Enable features Enable Visual Testing (Storybook)</span></div></div><br/></code></div></div></div></div></div></section>
|
|
8
|
-
<h2 id="developing-styles"><a class="header-anchor" aria-hidden="true" href="#developing-styles">#</a>Developing Styles</h2>
|
|
9
|
-
<p>Next we can add styles to the component.</p>
|
|
10
|
-
<p>The following capabilities are currently supported for developing styles.</p>
|
|
11
|
-
<ul>
|
|
12
|
-
<li>CSS/PostCSS</li>
|
|
13
|
-
<li>Less</li>
|
|
14
|
-
<li>Scss/Sass</li>
|
|
15
|
-
<li>Tailwind CSS</li>
|
|
16
|
-
<li>CSS Modules</li>
|
|
17
|
-
</ul>
|
|
18
|
-
<h3 id="csspostcss"><a class="header-anchor" aria-hidden="true" href="#csspostcss">#</a>CSS/PostCSS</h3>
|
|
19
|
-
<p>The module project supports PostCSS and has the following built-in postcss plugins.</p>
|
|
20
|
-
<ul>
|
|
21
|
-
<li><a href="https://github.com/luisrudge/postcss-flexbugs-fixes" target="_blank" rel="nofollow">flexbugs-fixes</a></li>
|
|
22
|
-
<li><a href="https://github.com/postcss/postcss-custom-properties" target="_blank" rel="nofollow">custom-properties</a></li>
|
|
23
|
-
<li><a href="https://github.com/maximkoretskiy/postcss-initial" target="_blank" rel="nofollow">initial</a></li>
|
|
24
|
-
<li><a href="https://github.com/shrpne/postcss-page-break" target="_blank" rel="nofollow">page-break</a></li>
|
|
25
|
-
<li><a href="https://github.com/postcss/postcss-font-variant" target="_blank" rel="nofollow">font-variant</a></li>
|
|
26
|
-
<li><a href="https://github.com/postcss/postcss-media-minmax" target="_blank" rel="nofollow">media-minmax</a></li>
|
|
27
|
-
<li><a href="https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme" target="_blank" rel="nofollow">nesting</a></li>
|
|
28
|
-
</ul>
|
|
29
|
-
<p>So we can create <code>.css</code> files in our projects and use the syntax support and capabilities provided by these plugins directly in our css files.</p>
|
|
30
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>Source Code.</p></div><div class="ch-spotlight-tab"><p>css product.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/index.css" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>index.css</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>a,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>b {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: red;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span> /* "&" comes first */</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> & c,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> & d {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: white;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span> /* "&" comes later, requiring "@nest" */</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @nest e & {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: yellow;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></div></div></section>
|
|
31
|
-
<h3 id="less"><a class="header-anchor" aria-hidden="true" href="#less">#</a>Less</h3>
|
|
32
|
-
<p>Module projects support development styles using Less.</p>
|
|
33
|
-
<blockquote>
|
|
34
|
-
<p>Currently supported version is 4.1.3</p>
|
|
35
|
-
</blockquote>
|
|
36
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>Source Code.</p></div><div class="ch-spotlight-tab"><p>Less product.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/common.less" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>common.less</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>@bg: black;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@bg-light: boolean(luma(@bg) > 50%);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>div {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> background: @bg;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: if(@bg-light, black, white);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></div></div></section>
|
|
37
|
-
<h3 id="sassscss"><a class="header-anchor" aria-hidden="true" href="#sassscss">#</a>Sass/Scss</h3>
|
|
38
|
-
<p>Module projects support developing styles using Scss/Sass.</p>
|
|
39
|
-
<blockquote>
|
|
40
|
-
<p>Currently supported version is 1.54.4</p>
|
|
41
|
-
</blockquote>
|
|
42
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>源代码。</p></div><div class="ch-spotlight-tab"><p>Less product.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/common.sass" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>common.sass</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>$font-stack: Helvetica, sans-serif;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>$primary-color: #333;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>body {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> font: 100% $font-stack;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: $primary-color;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></div></div></section>
|
|
43
|
-
<h3 id="tailwind-css"><a class="header-anchor" aria-hidden="true" href="#tailwind-css">#</a>Tailwind CSS</h3>
|
|
44
|
-
<p>The module project supports the development of component styles using Tailwind CSS.</p>
|
|
45
|
-
<p>By default, this feature is not enabled in the module project, you need to enable it as follows.</p>
|
|
46
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>The Tailwind CSS feature can be enabled by executing the <code>new</code> command in the project root directory.</p></div><div class="ch-spotlight-tab"><p>Once successfully opened, you will see that a new dependency has been added to <code>package.json</code>.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="Terminal" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5"></span>Terminal</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>pnpm run new</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Action Enable features</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>? Enable features Enable Visual Testing (Storybook)</span></div></div><br/></code></div></div></div></div></div></section>
|
|
47
|
-
<p>Tailwind CSS offers two ways to use it.</p>
|
|
48
|
-
<h4 id="html-class"><a class="header-anchor" aria-hidden="true" href="#html-class">#</a>HTML class</h4>
|
|
49
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>Tailwind CSS supports adding styles to HTML tags by using class names.</p></div><div class="ch-spotlight-tab"><p>**When using HTML class names, be sure to import the Tailwind CSS equivalent css file. **</p></div><div class="ch-spotlight-tab"><p>Style product.</p><blockquote>
|
|
50
|
-
<p>This is a bundle build.</p>
|
|
51
|
-
</blockquote></div></div><div class="ch-spotlight-sticker"><div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/index.tsx" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>index.tsx</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>import 'tailwindcss/utilities.css';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export default () => {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> return <div className="bg-black text-white">hello world</div>;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><br/></code></div></div></div></div></div></section>
|
|
52
|
-
<h4 id="apply"><a class="header-anchor" aria-hidden="true" href="#apply">#</a><code>@apply</code></h4>
|
|
53
|
-
<p>Tailwind CSS provides the <a href="https://v2.tailwindcss.com/docs/functions-and-directives#apply-1" target="_blank" rel="nofollow"><code>@apply</code></a> directive, which allows us to inline the styles provided by Tailwind CSS into the styles we write.</p>
|
|
54
|
-
<p><code>@apply</code> can be used in CSS, Less, and Sass.</p>
|
|
55
|
-
<div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>.btn {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @apply font-bold py-2 px-4 rounded;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div>
|
|
56
|
-
<p>However, there are some things to keep in mind when using Less and Sass.</p>
|
|
57
|
-
<h5 id="sass"><a class="header-anchor" aria-hidden="true" href="#sass">#</a>Sass</h5>
|
|
58
|
-
<p>When using Tailwind with Sass, the presence of <code>!important</code> after <code>@apply</code> requires interpolation to get Sass to compile correctly.</p>
|
|
59
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>It does not work properly.</p></div><div class="ch-spotlight-tab"><p>Can work properly.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>.alert {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @apply bg-red-500 !important;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></section>
|
|
60
|
-
<h5 id="less-1"><a class="header-anchor" aria-hidden="true" href="#less-1">#</a>Less</h5>
|
|
61
|
-
<p>When using Tailwind with Less, you cannot nest Tailwind's <code>@screen</code> directive.</p>
|
|
62
|
-
<section class="ch-spotlight "><div class="ch-spotlight-tabs"><div></div><div class="ch-spotlight-tab"><p>It does not work properly.</p></div><div class="ch-spotlight-tab"><p>Instead, use regular media queries and the <code>theme()</code> function to reference your screen size, or simply don't nest your <code>@screen</code> directive.</p></div></div><div class="ch-spotlight-sticker"><div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>.card {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @apply rounded-none;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @screen sm {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> @apply rounded-lg;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div></div></section>
|
|
63
|
-
<h4 id="recommended-method"><a class="header-anchor" aria-hidden="true" href="#recommended-method">#</a>Recommended method</h4>
|
|
64
|
-
<p>**It is recommended to develop styles in the way specified by <code>@apply</code>, so that only styles inlined by directives are included in the style product. **</p>
|
|
65
|
-
<p>When adding styles using HTML class names, by default Tailwind will not only add the styles corresponding to its own class name to the product, but will also have additional style code that may not affect its own styles.</p>
|
|
66
|
-
<h4 id="the-difference-between-bundle-and-bundleless-build-products"><a class="header-anchor" aria-hidden="true" href="#the-difference-between-bundle-and-bundleless-build-products">#</a>The difference between bundle and bundleless build products</h4>
|
|
67
|
-
<p>For the following code, there is a big difference between the bundle and bundleless modes of building products.</p>
|
|
68
|
-
<blockquote>
|
|
69
|
-
<p>The so-called bundle and bundleless can be found in [[Bundle and Bundleless]](/en/guide/advance/in-depth-about-build#bundle- and-bundleless)</p>
|
|
70
|
-
</blockquote>
|
|
71
|
-
<div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/index.tsx" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>index.tsx</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>import 'tailwindcss/utilities.css';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export default () => {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> return <div className="bg-black text-white">hello world11</div>;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><br/></code></div></div></div></div>
|
|
72
|
-
<p>In Bundle mode, third-party dependencies are packaged in.</p>
|
|
73
|
-
<p>For styles, a separate product file is generated, and there is no code related to importing styles in the Js product file.</p>
|
|
74
|
-
<p>If you need to inject styles into Js products, you can enable the <a href="/module-tools/en/api/config/build-config.html#inject"><code>style.inject</code> API</a>.</p>
|
|
75
|
-
<div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./dist/es/index.css" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./dist/es/</span>index.css</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>/* ../../node_modules/.pnpm/tailwindcss@2.2.19/node_modules/tailwindcss/utilities.css */</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>.table {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> display: table;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@keyframes spin {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> to {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> transform: rotate(360deg);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@keyframes ping {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> 75%, 100% {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> transform: scale(2);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> opacity: 0;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@keyframes pulse {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> 50% {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> opacity: .5;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@keyframes bounce {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> 0%, 100% {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> transform: translateY(-25%);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> animation-timing-function: cubic-bezier(0.8, 0, 1, 1);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> 50% {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> transform: none;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> animation-timing-function: cubic-bezier(0, 0, 0.2, 1);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>.bg-black {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-bg-opacity: 1;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> background-color: rgba(0, 0, 0, var(--tw-bg-opacity));</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>.text-white {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-text-opacity: 1;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> color: rgba(255, 255, 255, var(--tw-text-opacity));</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>*,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>::before,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>::after {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-shadow: 0 0 #0000 ;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>*,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>::before,</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>::after {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-inset: var(--tw-empty, );</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-offset-width: 0px;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-offset-color: #fff;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-color: rgba(59, 130, 246, 0.5);</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-offset-shadow: 0 0 #0000;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> --tw-ring-shadow: 0 0 #0000 ;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@media (min-width: 640px) {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@media (min-width: 768px) {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@media (min-width: 1024px) {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@media (min-width: 1280px) {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>@media (min-width: 1536px) {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br/></code></div></div><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div style="position:absolute;height:1px;background:#3b425201;width:100%;top:0;z-index:1"></div><div></div><div title="./dist/es/index.js" data-ch-tab="south" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./dist/es/</span>index.js</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="south" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>// src/index.tsx</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>import { jsx } from "react/jsx-runtime";</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>var src_default = () => {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> return /* @__PURE__ */ jsx("div", {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> className: "bg-black text-white",</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> children: "hello world11"</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> });</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> src_default as default</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><br/></code></div></div></div></div>
|
|
76
|
-
<p>In Bundleless mode, no third-party dependencies are packaged in, and no style products are generated at this time.</p>
|
|
77
|
-
<div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./dist/es/index.js" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./dist/es/</span>index.js</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>import { jsx } from 'react/jsx-runtime';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>import 'tailwindcss/utilities.css';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>var src_default = () => {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> return /* @__PURE__ */ jsx('div', {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> className: 'bg-black text-white',</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> children: 'hello world11',</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> });</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export { src_default as default };</span></div></div><br/></code></div></div></div></div>
|
|
78
|
-
<h3 id="css-modules"><a class="header-anchor" aria-hidden="true" href="#css-modules">#</a>CSS Modules</h3>
|
|
79
|
-
<p>Module projects support the development of styles using CSS Modules. By default, the following files are recognized as CSS Module files.</p>
|
|
80
|
-
<ul>
|
|
81
|
-
<li><code>.module.css</code></li>
|
|
82
|
-
<li><code>.module.less</code></li>
|
|
83
|
-
<li><code>.module.scss</code></li>
|
|
84
|
-
<li><code>.module.sass</code></li>
|
|
85
|
-
</ul>
|
|
86
|
-
<p>If you need to configure CSS Modules, you can check out the API at</p>
|
|
87
|
-
<ul>
|
|
88
|
-
<li><a href="/module-tools/en/api/config/build-config.html#automodules">autoModules</a></li>
|
|
89
|
-
<li><a href="/module-tools/en/api/config/build-config.html#modules">modules</a></li>
|
|
90
|
-
</ul>
|
|
91
|
-
<p>The following is a code example.</p>
|
|
92
|
-
<div class="ch-codegroup not-prose "><div class="ch-editor-frame" style="background:#2e3440"><div class="ch-frame-title-bar" style="color:#C5C5C5;background:#2e3440"><div class="ch-frame-buttons"><div class="ch-frame-button ch-frame-button-left"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-middle"></div><div class="ch-frame-button-space"></div><div class="ch-frame-button ch-frame-button-right"></div></div><div title="./src/index.tsx" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-active" style="background:#3b4252;color:#d8dee9;border-right-color:#3b425200;border-bottom-color:#88c0d000"><div><span style="opacity:0.5">./src/</span>index.tsx</div></div><div title="./src/index.module.css" data-ch-tab="north" class="ch-editor-tab ch-editor-tab-inactive" style="background:#2e3440;color:#d8dee966;border-right-color:#3b425200;border-bottom-color:#2e3440"><div><span style="opacity:0.5">./src/</span>index.module.css</div></div><div style="flex:1;min-width:0.8em"></div><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ch-editor-button"><title>Copy</title><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6px" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></div><div data-ch-panel="north" style="flex-grow:1;overflow:hidden"><div class="ch-code-wrapper" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto;height:100%"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>import style from './index.module.css';</span></div></div><div><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><div style="display:inline-block;margin-left:16px"><span>export default () => {</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> return <div className={style.btn}>hello world</div>;</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>};</span></div></div><br/></code></div></div></div></div>
|
|
93
|
-
<h2 id="configuring-build-products"><a class="header-anchor" aria-hidden="true" href="#configuring-build-products">#</a>Configuring build products</h2>
|
|
94
|
-
<p>Based on most scenarios of component project usage, <strong>it is recommended to use the <code>npm-component</code> build preset</strong>. This preset yields a product directory structure of</p>
|
|
95
|
-
<div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>.</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>├── dist</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>│ ├── es</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>│ ├── lib</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>│ └── types</span></div></div><br/></code></div></div>
|
|
96
|
-
<ul>
|
|
97
|
-
<li><code>. /dist/es</code>: Contains bundleless products in ES modules format that support the es6 syntax.</li>
|
|
98
|
-
<li><code>. /dist/lib</code>: Contains bundleless products in CommonJS format with support for es6 syntax.</li>
|
|
99
|
-
<li><code>. /dist/types</code>: Contains the types file.</li>
|
|
100
|
-
</ul>
|
|
101
|
-
<p>The <a href="/module-tools/en/api/config/build-preset.html"><code>buildPreset</code></a> can be configured manually if there is a requirement to use syntax support, and supports modifying the supported syntax by adding a suffix to <code>npm-component</code>.</p>
|
|
102
|
-
<div class="ch-codeblock not-prose "><div class="ch-code" style="margin:0;padding:0;position:relative;white-space:pre;box-sizing:content-box;opacity:0;overflow:auto"><code class="ch-code-scroll-parent"><br/><div><div style="display:inline-block;margin-left:16px"><span>export default defineConfig({</span></div></div><div><div style="display:inline-block;margin-left:16px"><span> buildPreset: 'npm-component-es2019',</span></div></div><div><div style="display:inline-block;margin-left:16px"><span>});</span></div></div><br/></code></div></div>
|
|
103
|
-
<p>If you have special needs for the build product directory structure, you can use the <a href="/module-tools/en/api/config/build-config.html"><code>buildConfig</code> API</a>, which can be used by the following documentation.</p>
|
|
104
|
-
<ul>
|
|
105
|
-
<li><a href="/module-tools/en/guide/basic/modify-output-product.html#build-configuration-object">modify-output-product</a></li>
|
|
106
|
-
<li><a href="/module-tools/en/guide/advance/in-depth-about-build.html">in-depth-about-build</a></li>
|
|
107
|
-
</ul>
|
|
108
|
-
<h2 id="testing-components"><a class="header-anchor" aria-hidden="true" href="#testing-components">#</a>Testing components</h2>
|
|
109
|
-
<p>For more information on how to test components, please refer to <a href="/module-tools/en/guide/basic/test-your-project.html">[Test project]</a>.</p>
|
|
110
|
-
<h2 id="releasing-components"><a class="header-anchor" aria-hidden="true" href="#releasing-components">#</a>Releasing components</h2>
|
|
111
|
-
<p>It is recommended to use module project to provide version publishing function, you can refer to <a href="/module-tools/en/guide/basic/publish-your-project.html">[Versioning and publishing]</a>.</p><!--/$--><div><footer m="t-8"><div flex="~ col sm:row" justify="sm:around" gap="2" p="t-6"><div flex="~ col" class="ajVjQ"><a class="R5q4o pAnzs" target="" cursor="pointer" href="/module-tools/en/guide/advance/theme-config.html"><span class="rVEMI">Previous Page</span><span class="jr5Zr">Theme Configuration</span></a></div><div flex="~ col" class="A2aco"><a class="R5q4o pAnzs A2aco" target="" cursor="pointer" href="/module-tools/en/plugins/guide/getting-started.html"><span class="rVEMI">Next page</span><span class="jr5Zr">Quick Start</span></a></div></div></footer></div></div></div><div class="RsCtL" style="min-height:calc(100vh - (var(--modern-nav-height) + 32px))"><div><div flex="~ col"><div class="<lg:hidden"><div p="l-4" text="sm" font-medium="~" id="aside-container" style="border-left:1px solid var(--modern-c-divider-light)" class="relative"><div class="absolute" opacity="0" w="1px" h="18px" bg="brand" style="top:33px;left:-1px;transition:top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s" id="aside-marker"></div><div block="~" class="leading-7" text="sm" font="semibold">ON THIS PAGE</div><nav><ul class="relative"><li><a href="#debugging-code-with-storybook" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Debugging code with Storybook</a></li><li><a href="#developing-styles" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Developing Styles</a></li><li><a href="#csspostcss" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">CSS/PostCSS</a></li><li><a href="#less" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Less</a></li><li><a href="#sassscss" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Sass/Scss</a></li><li><a href="#tailwind-css" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Tailwind CSS</a></li><li><a href="#html-class" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">HTML class</a></li><li><a href="#apply" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">@apply</a></li><li><a href="#recommended-method" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Recommended method</a></li><li><a href="#the-difference-between-bundle-and-bundleless-build-products" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">The difference between bundle and bundleless build products</a></li><li><a href="#css-modules" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">CSS Modules</a></li><li><a href="#configuring-build-products" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Configuring build products</a></li><li><a href="#testing-components" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Testing components</a></li><li><a href="#releasing-components" block="~" text="text-2" hover="text-text-1" transition="color duration-300" class="leading-7" style="font-size:13px;padding-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Releasing components</a></li></ul></nav></div></div></div></div></div></div></div></section></div></div></body></html>
|